From 394a7a141753a35d2e89d16b1bfd29e32df44a2d Mon Sep 17 00:00:00 2001 From: wolf Date: Fri, 19 Feb 1999 11:52:00 +0000 Subject: [PATCH] Change the working of the Makefile to automatically extract the libraries to link with from the testcases. Modify the testcases accordingly. git-svn-id: https://svn.dealii.org/trunk@844 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/deal.II/Makefile | 17 ++++++++++------- tests/deal.II/gradients.cc | 4 ++++ tests/deal.II/second_derivatives.cc | 3 +++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/tests/deal.II/Makefile b/tests/deal.II/Makefile index 83e753f9ea..482feabf0a 100644 --- a/tests/deal.II/Makefile +++ b/tests/deal.II/Makefile @@ -20,21 +20,24 @@ lib-h-files = $(wildcard ../../deal_II/include/*/*.h) \ $(wildcard ../../lac/include/*/*.h) \ $(wildcard ../../base/include/*/*.h) executables = $(cc-files:.cc=.testcase) +output-files= $(cc-files:.cc=.output) # list of libraries needed to link with -libs.g = $D/deal.II/lib/libdeal_II_2d.g.a $D/lac/lib/liblac.g.a $D/base/lib/libbase.g.a -libs = $D/deal.II/lib/libdeal_II_2d.a $D/lac/lib/liblac.a $D/base/lib/libbase.a +libs.g = $D/lac/lib/liblac.g.a $D/base/lib/libbase.g.a +libs = $D/lac/lib/liblac.a $D/base/lib/libbase.a # check whether we use debug mode or not ifeq ($(debug-mode),on) libraries = $(libs.g) -flags = $(CXXFLAGS.g) +flags = $(CXXFLAGS.g) -L$D/deal.II/lib +lib-tag = "deal_II_libraries.g=" endif ifeq ($(debug-mode),off) libraries = $(libs) -flags = $(CXXFLAGS) +flags = $(CXXFLAGS) -L$D/deal.II/lib +lib-tag = "deal_II_libraries=" endif @@ -42,7 +45,7 @@ endif # rule to make executables %.testcase: %.cc $(libraries) @echo ============================ Compiling Testcase: $< - @$(CXX) $(flags) $< -o $@ $(libraries) + @$(CXX) $(flags) $< -o $@ $(shell grep $(lib-tag) $< | perl -pe 's/.*=//;') $(libs) @@ -56,7 +59,7 @@ targets = $(addsuffix .target, $(executables)) # the right filename by dropping the suffix added for the make-rule %.target : % @echo ============================ Executing Testcase: $< - @./$< + ./$< > $(subst testcase,output,$<) # this is the main target # make dependence so that it first wants to compile all files then @@ -66,7 +69,7 @@ check: $(executables) $(targets) clean: - -rm -f *.o *.go *~ Makefile.dep $(executables) + -rm -f *.o *.go *~ Makefile.dep $(executables) $(output-files) diff --git a/tests/deal.II/gradients.cc b/tests/deal.II/gradients.cc index ff0f2de02d..cf420b3a03 100644 --- a/tests/deal.II/gradients.cc +++ b/tests/deal.II/gradients.cc @@ -1,5 +1,9 @@ +// $Id$ // test for correctness of gradients on a given cell +// deal_II_libraries.g=-ldeal_II_2d.g +// deal_II_libraries=-ldeal_II_2d + #include #include diff --git a/tests/deal.II/second_derivatives.cc b/tests/deal.II/second_derivatives.cc index b33d670144..cfac394bba 100644 --- a/tests/deal.II/second_derivatives.cc +++ b/tests/deal.II/second_derivatives.cc @@ -1,5 +1,8 @@ +// $Id$ // test for correctness of gradients on a given cell +// deal_II_libraries.g=-ldeal_II_2d.g +// deal_II_libraries=-ldeal_II_2d #include #include -- 2.39.5