From 8597f5b934fc78fb5a721901e871f964e1dfa7a6 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Thu, 29 Jul 2004 21:43:23 +0000 Subject: [PATCH] Added a depends target --- test_problems/diamondSurf/.cvsignore | 3 +++ test_problems/diamondSurf/Makefile.in | 28 ++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/test_problems/diamondSurf/.cvsignore b/test_problems/diamondSurf/.cvsignore index 4c3b4c8d3..18bdd9629 100644 --- a/test_problems/diamondSurf/.cvsignore +++ b/test_problems/diamondSurf/.cvsignore @@ -6,3 +6,6 @@ runDiamond ct2ctml.log diamond.xml xml_diff_test.out +.depends +*.d +.cttmp.py diff --git a/test_problems/diamondSurf/Makefile.in b/test_problems/diamondSurf/Makefile.in index 4c845febc..8a0b45f92 100644 --- a/test_problems/diamondSurf/Makefile.in +++ b/test_problems/diamondSurf/Makefile.in @@ -7,6 +7,9 @@ # ############################################################################# +# addition to suffixes +.SUFFIXES : .d + # the name of the executable program to be created PROG_NAME = runDiamond @@ -47,26 +50,45 @@ CANTERA_INCDIR=@ctroot@/build/include/cantera # flags passed to the C++ compiler/linker for the linking step LCXX_FLAGS = -L$(CANTERA_LIBDIR) @CXXFLAGS@ -# how to compile C++ source files to object files +# How to compile C++ source files to object files .@CXX_EXT@.@OBJ_EXT@: Interface.h $(CXX) -c $< -I$(CANTERA_INCDIR) $(CXX_FLAGS) +# How to compile the dependency file +.cpp.d: + g++ -MM -I$(CANTERA_INCDIR) $(CXX_FLAGS) $*.cpp > $*.d + +# List of dependency files to be created +DEPENDS=$(OBJS:.o=.d) + +# Program Name PROGRAM = $(PROG_NAME)$(EXE_EXT) +# all rule makes a single program all: $(PROGRAM) +# Rule to make the program $(PROGRAM): $(OBJS) $(CANTERA_LIBDIR)/libcantera.a $(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(CANTERA_LIBS) \ $(LINK_OPTIONS) $(EXT_LIBS) @LIBS@ $(FORT_LIBS) \ $(LCXX_END_LIBS) -$(OBJS): +# depends target +depends: .depends + $(RM) *.d .depends + @MAKE@ .depends +.depends: $(DEPENDS) + cat *.d > .depends + +# test target -> make the program and run the test test: @MAKE@ $(PROGRAM) ./runtest + +# clean target -> clean up clean: - $(RM) $(OBJS) $(PROGRAM) + $(RM) $(OBJS) $(PROGRAM) $(DEPENDS) .depends ../../bin/rm_cvsignore