# This file contains the machine independent stuff that must go in the
# machine dependent makefiles.

#ifndef SPECIALLIST
SPECIALLIST=
#endif

#ifndef LINTLIB
LINTLIB = V
#endif

LINTLIBRARY = llib-l$(LINTLIB).ln

objects: $(OBJECTS) $(SPECIALLIST) $(LINTLIBRARY)

# Set up compilation rules for Machine independent sources

# Note: rules for special files included in individual buildfiles

INCLUDES = -I. -I$(MI) -I../../include/$(MACHINE) -I../../include/mi

clean:
	rm -f *.$(OBJSUFFIX) *.CKP *.BAK .emacs_[0-9]*

object.list: . $(VPATH)
	../../makelists '\.[cs]' .$(OBJSUFFIX) $(VPATH)

# Construct dependencies on header files
# /dev/null is in there so that if there are no .c files, makedep won't vomit.
# sh -c because make invokes commands with -e and egrep returns 1 if there
# were no matches
depend: object.list
	sh -c 'makedep $(INCLUDES) -N -e $(OBJSUFFIX) -o dependencies \
		$(SOURCES) /dev/null'

# lint library components are built in the machine directory by this
# and collected by buildlibtemplate into the final master file.

lint-lib:	$(LINTLIBRARY)

$(LINTLIBRARY):	llib-l$(LINTLIB)
	$(LINT) -v$(Xx)V -n -C$(LINTLIB) $(INCLUDES) llib-l$(LINTLIB)

llib-l$(LINTLIB):	$(SOURCES)
	sh ../../mklintlib -D$(MACHINE) -C$(LINTLIB) -v$(Xx)V $(INCLUDES) \
		`echo $(SOURCES) | tr ' ' '\012' | sed '/\.s$$/d'`
