#
#  NeXT common include file for Internal Makefiles
#  Copyright 1987, 1991, NeXT Computer, Inc.
#
#  Maintained by Doug Wiebe.
#
#  This Makefile has the targets for various useful things.
#

#  The depend target scans the source files for includes and generates
#  the right dependencies to reflect those inter-file dependencies.
#$(PRODUCT): .depend_done

depend .depend_done::
	@if [ "`echo $(DERIVED_SRC)`" ]	; then		\
	    $(MAKE) $(DERIVED_SRC);			\
	fi
	-/bin/rm -f Makefile.depends
	-touch Makefile.depends
	$(CC) -MD -E $(CFLAGS) $(MFILES) $(CFILES) $(SFILES) $(DERIVED_SRC) \
		> /dev/null
	@md -m Makefile.depends -d $(DFILES)
	-touch .depend_done

# diffs the current sources with the installed sources
diff::
	for f in $(SRCS);					\
	    do (echo $$f;					\
	    csh -f -c "diff -c $(SRCROOT)/$$f $$f; exit 0")	\
	done

# lints all source files (oh, what to do about .m's?? )
lint:: $(CFILES)
	lint -I$(INCDIR) $(CFILES) $(LINTLIBS) -lc

#  prints out all source files
print:: $(SRCS)
	$(PRINT) $(SRCS)

# shows object code size
size:: $(PRODUCT)
	sizelib $(PRODUCT)

#  The tags target creates an index on the source files' functions.
tags:: $(MFILES) $(CFILES) $(PSWFILES) $(PSWMFILES) $(LFILES) \
		$(LMFILES) $(YFILES) $(YMFILES) $(HFILES)
	ctags $(MFILES) $(CFILES) $(PSWFILES) $(PSWMFILES) $(LFILES) \
		$(LMFILES) $(YFILES) $(YMFILES) $(HFILES)

# shows line count of source
wc: $(SRCS)
	wc $(SRCS)

