3 # This is a _generic_ Makefile to generate a dependency file
4 # using GNUmake and gcc.
5 # Advantage of this method (as compared to "makedepend(1)")
6 # is that one can easily filter out dependencies on
7 # non-application (i.e. system) headers using the -MM flag
8 # of gcc. The reason to demand GNUMake is basically to have a nice,
9 # simple rule for $(SRCS) as done below (and for the variable
11 # So one doesn't have to modify this file and manually add/update
12 # the source file list!
14 # To use it just you probably just have to edit the
15 # variables in the *CONFIG section* as you see fit.
18 # ***************** CONFIG section *****************
22 CPPFLAGS=-I$(HOME)/include
23 DEPENDFILE=dependencies
26 # Headers are required to determine _all_ files
27 # on which the dependency file itself may depend
29 HDRS=$(wildcard ../source/*.h) $(wildcard ../util/*.h)
31 # *************** End CONFIG section ************
35 # ************** Now the generic part ***********
37 .SUFFIXES: .c .o. deps
38 .PHONY: all default deps new
45 # This is the more conservative approach
48 # And this a more sophisticated one
51 # Remove old file, create new one and add CVS info line at top
53 /bin/rm -f $(DEPENDFILE)
54 echo '# $$Header: /home/bertw/cvsroot/nedit/nedit/makefiles/Makefile.depend,v 1.3 2002/09/26 12:37:38 ajhood Exp $$' >$(DEPENDFILE)
57 $(DEPENDFILE): new $(SRCS) $(HDRS)
58 $(GCC) $(CPPFLAGS) $(DEFINES) -MM $(SRCS) >>$(DEPENDFILE)
63 $(GCC) $(CPPFLAGS) $(DEFINES) -MM $< >>$(DEPENDFILE)