The following fragment from the Makefile shows how to do this:
########################################################################### # # Makefile fragment for tdrp_test program # ########################################################################### LDFLAGS = -ltdrp OBJS = \ _tdrp.o \ do_printout.o \ parse_args.o \ tdrp_test.o _tdrp.c: paramdef.tdrp_test tdrp_gen -f paramdef.tdrp_test -prog tdrp_test clean_tdrp: $(RM) _tdrp.h _tdrp.cNote that _tdrp.o is at the top of the OBJS list. This forces the generation of _tdrp.h before compiling the other files, since the program code will need the header file.
The following fragment from the Makefile shows how to do this:
########################################################################### # # Makefile fragment for tdrp_mult program # ########################################################################### LDFLAGS = -ltdrp OBJS = \ mod1_tdrp.o \ mod2_tdrp.o \ do_printout.o \ parse_args.o \ tdrp_mult.o mod1_tdrp.c: paramdef.mod1 tdrp_gen mod1 -f paramdef.mod1 -prog tdrp_test mod2_tdrp.c: paramdef.mod2 tdrp_gen mod2 -f paramdef.mod2 -prog tdrp_test clean_tdrp: $(RM) mod1_tdrp.h mod1_tdrp.c mod2_tdrp.h mod2_tdrp.c
The following fragment from the Makefile shows how to do this:
########################################################################### # # Makefile fragment for TdrpTest program # ########################################################################### LDFLAGS = -ltdrp OBJS = \ Params.o \ Args.o \ Main.o \ TdrpTest.o Params.cc: paramdef.TdrpTest tdrp_gen -f paramdef.TdrpTest -c++ -prog TdrpTest clean_tdrp: $(RM) Params.hh Params.ccNote that Params.o is at the top of the OBJS list. This forces the generation of Params.hh before compiling the other files, since the program code will need the header file.
########################################################################### # # Makefile fragment for TdrpMult program # ########################################################################### LDFLAGS = -ltdrp OBJS = \ Class1.o \ Class2.o \ Args.o \ Main.o \ TdrpTest.o Class1.cc: paramdef.Class1 tdrp_gen -f paramdef.Class1 -c++ -class Class1 -prog TdrpTest Class2.cc: paramdef.Class2 tdrp_gen -f paramdef.Class2 -c++ -class Class2 -prog TdrpTest clean_tdrp: $(RM) Class1.hh Class1.cc Class2.hh Class2.cc