]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Simplify makefiles and unify them.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 22 Dec 1999 22:46:14 +0000 (22:46 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 22 Dec 1999 22:46:14 +0000 (22:46 +0000)
git-svn-id: https://svn.dealii.org/trunk@2113 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/Attic/examples/step-by-step/Makefile
deal.II/deal.II/Attic/examples/step-by-step/step-1/Makefile
deal.II/deal.II/Attic/examples/step-by-step/step-2/Makefile
deal.II/deal.II/Attic/examples/step-by-step/step-3/Makefile
deal.II/deal.II/Attic/examples/step-by-step/step-4/Makefile
deal.II/examples/Makefile
deal.II/examples/step-1/Makefile
deal.II/examples/step-2/Makefile
deal.II/examples/step-3/Makefile
deal.II/examples/step-4/Makefile

index 10857510837eccfc3c6c9ca0d7cbfa2d7fb6e640..6cf1272375d24e94c4a5e2958824574dcd408d9d 100644 (file)
@@ -2,18 +2,35 @@
 #
 # This Makefile only recurses into the subdirs
 
-default:
-       cd step-1 ; $(MAKE)
-       cd step-2 ; $(MAKE)
-       cd step-3 ; $(MAKE)
 
+# existing examples. take dirnames and strip 'step'
+steps = $(shell echo step-*)
 
-run:
-       cd step-1 ; $(MAKE) run
-       cd step-2 ; $(MAKE) run
-       cd step-3 ; $(MAKE) run
 
-clean:
-       cd step-1 ; $(MAKE) clean
-       cd step-2 ; $(MAKE) clean
-       cd step-3 ; $(MAKE) clean
+# default is: build all examples. for each example, there is a target
+# build-step-N, where N in [1...]
+default: $(addprefix build-,$(steps))
+
+# run example programs; make a target run-step-N for each N
+run: $(addprefix run-,$(steps))
+
+# clean subdirs; make a target clean-step-N for each N
+clean: $(addprefix clean-,$(steps))
+
+
+
+# for each build/run/clean target: strip the build- prefix of the
+# target and build in that directory
+build-step-%:
+       cd $(@:build-%=%) ; $(MAKE)
+run-step-%:
+       cd $(@:run-%=%) ; $(MAKE) run
+clean-step-%:
+       cd $(@:clean-%=%) ; $(MAKE) clean
+
+
+# all targets in this directory do not produce files, so they are
+# .PHONY:
+.PHONY: $(addprefix build-step-,$(steps)) \
+        $(addprefix run-step-,$(steps))   \
+        $(addprefix clean-step-,$(steps))
index 467a0580b792b384bfec0732dfdebe8ae41d3134..dc2798f83951ccc2f42089e835bfb57050d1cd1a 100644 (file)
@@ -1,10 +1,11 @@
 # $Id$
-# Copyright W. Bangerth, University of Heidelberg, 1998
+# Copyright W. Bangerth, University of Heidelberg, 1999
 
 # Template for makefiles for the examples subdirectory. In principle,
 # everything should be done automatically if you set the target file
-# here correctly:
-target   = step-1
+# here correctly. We get deduce it from the files in the present
+# directory:
+target   = $(basename $(shell echo step-*.cc))
 
 # All dependencies between files should be updated by the included
 # file Makefile.dep if necessary. Object files are compiled into
@@ -13,24 +14,6 @@ target   = step-1
 # variable to "off"
 debug-mode = on
 
-# If you want your program to be linked with extra object or library
-# files, specify them here:
-user-libs =
-
-# To run the program, use "make run"; to give parameters to the program,
-# give the parameters to the following variable:
-run-parameters  = 
-
-# To execute additional action apart from running the program, fill
-# in this list:
-additional-run-action =
-
-# To specify which files are to be deleted by "make clean" (apart from
-# the usual ones: object files, executables, backups, etc), fill in the
-# following list
-delete-files = *gnuplot *inp *history
-
-
 
 
 ###############################################################################
@@ -42,77 +25,68 @@ D = ../../../..
 include $D/common/Make.global_options
 
 # get lists of files we need
-cc-files    = $(filter-out *%, $(shell echo *.cc))
-o-files     = $(cc-files:.cc=.o)
-go-files    = $(cc-files:.cc=.go)
-h-files     = $(filter-out *%, $(shell echo *.h))
-lib-h-files = $(filter-out *%, $(shell echo ../../include/*/*.h))
+
 
 # list of libraries needed to link with
-libs     = ./Obj.a   -ldeal_II_2d  -llac -lbase
-libs.g   = ./Obj.g.a -ldeal_II_2d.g -llac.g -lbase.g
+libs     = -ldeal_II_2d  -llac -lbase
+libs.g   = -ldeal_II_2d.g -llac.g -lbase.g
 
 
 # check whether we use debug mode or not
 ifeq ($(debug-mode),on)
-libraries = $(libs.g)
-flags     = $(CXXFLAGS.g)
-endif
-
-ifeq ($(debug-mode),off)
-libraries = $(libs)
-flags     = $(CXXFLAGS)
+  libraries = $(target).go $(libs.g)
+  flags     = $(CXXFLAGS.g)
+else
+  libraries = $(target).go $(libs)
+  flags     = $(CXXFLAGS.o)
 endif
 
 
 
-# make rule for the target
+# make rule for the target. $^ is the object file $(target).g?o
 $(target) : $(libraries)
        @echo ============================ Linking $@
-       @$(CXX) $(flags) -o $@ $^ $(user-libs)
+       @$(CXX) $(flags) -o $@ $^
 
 # rule how to run the program
 run: $(target)
-       $(target) $(run-parameters)
-       $(additional-run-action)
+       @echo ============================ Running $@
+       @./$(target)
 
 
 # rule to make object files
 %.go : %.cc
        @echo ============================ Compiling with debugging information:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS.g) -c $< -o $@
 %.o : %.cc
        @echo ============================ Compiling with optimization:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS) -c $< -o $@
 
 
-# rules which files the libraries depend upon
-Obj.a: ./Obj.a($(o-files))
-Obj.g.a: ./Obj.g.a($(go-files))
-
-
 clean:
-       -rm -f *.o *.go *~ Makefile.dep Obj.a Obj.g.a $(target) $(delete-files)
+       -rm -f *.o *.go *~ Makefile.dep $(target) *gmv *gnuplot *gpl *eps
 
 
 
 .PHONY: clean
 
 
-#Rule to generate the dependency file. This file is
-#automagically remade whenever needed, i.e. whenever
-#one of the cc-/h-files changed. Make detects whether
-#to remake this file upon inclusion at the bottom
-#of this file.
+# Rule to generate the dependency file. This file is
+# automagically remade whenever needed, i.e. whenever
+# one of the cc-/h-files changed. Make detects whether
+# to remake this file upon inclusion at the bottom
+# of this file.
 #
-#use perl to generate rules for the .go files as well
-#as to make rules not for tria.o and the like, but
-#rather for libnumerics.a(tria.o)
-Makefile.dep: $(cc-files) $(h-files) $(lib-h-files)
+# Since the script prefixes the output names by lib/g?o, we have to
+# strip that again (the script was written for the main libraries and
+# large projects where object files are put into subdirs)
+Makefile.dep: $(target).cc Makefile \
+              $(shell echo $D/base/include/base/*.h \
+                           $D/lac/include/lac/*.h  \
+                           $D/deal.II/include/*/*.h)
        @echo ============================ Remaking Makefile
-       @perl $D/common/scripts/Make_dep.pl ./Obj $(INCLUDE) $(cc-files) \
+       @perl $D/common/scripts/make_dependencies.pl  $(INCLUDE) $(target).cc \
+               | perl -pi -e 's!lib/g?o/!!g;' \
                > Makefile.dep
 
 
index 8fb10b1fec087e60949aeb199c213fba6bdad328..dc2798f83951ccc2f42089e835bfb57050d1cd1a 100644 (file)
@@ -1,10 +1,11 @@
 # $Id$
-# Copyright W. Bangerth, University of Heidelberg, 1998
+# Copyright W. Bangerth, University of Heidelberg, 1999
 
 # Template for makefiles for the examples subdirectory. In principle,
 # everything should be done automatically if you set the target file
-# here correctly:
-target   = step-2
+# here correctly. We get deduce it from the files in the present
+# directory:
+target   = $(basename $(shell echo step-*.cc))
 
 # All dependencies between files should be updated by the included
 # file Makefile.dep if necessary. Object files are compiled into
@@ -13,24 +14,6 @@ target   = step-2
 # variable to "off"
 debug-mode = on
 
-# If you want your program to be linked with extra object or library
-# files, specify them here:
-user-libs =
-
-# To run the program, use "make run"; to give parameters to the program,
-# give the parameters to the following variable:
-run-parameters  = 
-
-# To execute additional action apart from running the program, fill
-# in this list:
-additional-run-action =
-
-# To specify which files are to be deleted by "make clean" (apart from
-# the usual ones: object files, executables, backups, etc), fill in the
-# following list
-delete-files = *gnuplot *inp *history
-
-
 
 
 ###############################################################################
@@ -42,77 +25,68 @@ D = ../../../..
 include $D/common/Make.global_options
 
 # get lists of files we need
-cc-files    = $(filter-out *%, $(shell echo *.cc))
-o-files     = $(cc-files:.cc=.o)
-go-files    = $(cc-files:.cc=.go)
-h-files     = $(filter-out *%, $(shell echo *.h))
-lib-h-files = $(filter-out *%, $(shell echo ../../include/*/*.h))
+
 
 # list of libraries needed to link with
-libs     = ./Obj.a   -ldeal_II_2d  -llac -lbase
-libs.g   = ./Obj.g.a -ldeal_II_2d.g -llac.g -lbase.g
+libs     = -ldeal_II_2d  -llac -lbase
+libs.g   = -ldeal_II_2d.g -llac.g -lbase.g
 
 
 # check whether we use debug mode or not
 ifeq ($(debug-mode),on)
-libraries = $(libs.g)
-flags     = $(CXXFLAGS.g)
-endif
-
-ifeq ($(debug-mode),off)
-libraries = $(libs)
-flags     = $(CXXFLAGS)
+  libraries = $(target).go $(libs.g)
+  flags     = $(CXXFLAGS.g)
+else
+  libraries = $(target).go $(libs)
+  flags     = $(CXXFLAGS.o)
 endif
 
 
 
-# make rule for the target
+# make rule for the target. $^ is the object file $(target).g?o
 $(target) : $(libraries)
        @echo ============================ Linking $@
-       @$(CXX) $(flags) -o $@ $^ $(user-libs)
+       @$(CXX) $(flags) -o $@ $^
 
 # rule how to run the program
 run: $(target)
-       $(target) $(run-parameters)
-       $(additional-run-action)
+       @echo ============================ Running $@
+       @./$(target)
 
 
 # rule to make object files
 %.go : %.cc
        @echo ============================ Compiling with debugging information:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS.g) -c $< -o $@
 %.o : %.cc
        @echo ============================ Compiling with optimization:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS) -c $< -o $@
 
 
-# rules which files the libraries depend upon
-Obj.a: ./Obj.a($(o-files))
-Obj.g.a: ./Obj.g.a($(go-files))
-
-
 clean:
-       -rm -f *.o *.go *~ Makefile.dep Obj.a Obj.g.a $(target) $(delete-files)
+       -rm -f *.o *.go *~ Makefile.dep $(target) *gmv *gnuplot *gpl *eps
 
 
 
 .PHONY: clean
 
 
-#Rule to generate the dependency file. This file is
-#automagically remade whenever needed, i.e. whenever
-#one of the cc-/h-files changed. Make detects whether
-#to remake this file upon inclusion at the bottom
-#of this file.
+# Rule to generate the dependency file. This file is
+# automagically remade whenever needed, i.e. whenever
+# one of the cc-/h-files changed. Make detects whether
+# to remake this file upon inclusion at the bottom
+# of this file.
 #
-#use perl to generate rules for the .go files as well
-#as to make rules not for tria.o and the like, but
-#rather for libnumerics.a(tria.o)
-Makefile.dep: $(cc-files) $(h-files) $(lib-h-files)
+# Since the script prefixes the output names by lib/g?o, we have to
+# strip that again (the script was written for the main libraries and
+# large projects where object files are put into subdirs)
+Makefile.dep: $(target).cc Makefile \
+              $(shell echo $D/base/include/base/*.h \
+                           $D/lac/include/lac/*.h  \
+                           $D/deal.II/include/*/*.h)
        @echo ============================ Remaking Makefile
-       @perl $D/common/scripts/Make_dep.pl ./Obj $(INCLUDE) $(cc-files) \
+       @perl $D/common/scripts/make_dependencies.pl  $(INCLUDE) $(target).cc \
+               | perl -pi -e 's!lib/g?o/!!g;' \
                > Makefile.dep
 
 
index 0e96bf3a5b62447d7e18501d8157ec54e2931ea2..dc2798f83951ccc2f42089e835bfb57050d1cd1a 100644 (file)
@@ -1,10 +1,11 @@
 # $Id$
-# Copyright W. Bangerth, University of Heidelberg, 1998
+# Copyright W. Bangerth, University of Heidelberg, 1999
 
 # Template for makefiles for the examples subdirectory. In principle,
 # everything should be done automatically if you set the target file
-# here correctly:
-target   = step-3
+# here correctly. We get deduce it from the files in the present
+# directory:
+target   = $(basename $(shell echo step-*.cc))
 
 # All dependencies between files should be updated by the included
 # file Makefile.dep if necessary. Object files are compiled into
@@ -13,24 +14,6 @@ target   = step-3
 # variable to "off"
 debug-mode = on
 
-# If you want your program to be linked with extra object or library
-# files, specify them here:
-user-libs =
-
-# To run the program, use "make run"; to give parameters to the program,
-# give the parameters to the following variable:
-run-parameters  = 
-
-# To execute additional action apart from running the program, fill
-# in this list:
-additional-run-action =
-
-# To specify which files are to be deleted by "make clean" (apart from
-# the usual ones: object files, executables, backups, etc), fill in the
-# following list
-delete-files = *gpl *inp *history
-
-
 
 
 ###############################################################################
@@ -42,77 +25,68 @@ D = ../../../..
 include $D/common/Make.global_options
 
 # get lists of files we need
-cc-files    = $(filter-out *%, $(shell echo *.cc))
-o-files     = $(cc-files:.cc=.o)
-go-files    = $(cc-files:.cc=.go)
-h-files     = $(filter-out *%, $(shell echo *.h))
-lib-h-files = $(filter-out *%, $(shell echo ../../include/*/*.h))
+
 
 # list of libraries needed to link with
-libs     = ./Obj.a   -ldeal_II_2d  -llac -lbase
-libs.g   = ./Obj.g.a -ldeal_II_2d.g -llac.g -lbase.g
+libs     = -ldeal_II_2d  -llac -lbase
+libs.g   = -ldeal_II_2d.g -llac.g -lbase.g
 
 
 # check whether we use debug mode or not
 ifeq ($(debug-mode),on)
-libraries = $(libs.g)
-flags     = $(CXXFLAGS.g)
-endif
-
-ifeq ($(debug-mode),off)
-libraries = $(libs)
-flags     = $(CXXFLAGS)
+  libraries = $(target).go $(libs.g)
+  flags     = $(CXXFLAGS.g)
+else
+  libraries = $(target).go $(libs)
+  flags     = $(CXXFLAGS.o)
 endif
 
 
 
-# make rule for the target
+# make rule for the target. $^ is the object file $(target).g?o
 $(target) : $(libraries)
        @echo ============================ Linking $@
-       @$(CXX) $(flags) -o $@ $^ $(user-libs)
+       @$(CXX) $(flags) -o $@ $^
 
 # rule how to run the program
 run: $(target)
-       $(target) $(run-parameters)
-       $(additional-run-action)
+       @echo ============================ Running $@
+       @./$(target)
 
 
 # rule to make object files
 %.go : %.cc
        @echo ============================ Compiling with debugging information:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS.g) -c $< -o $@
 %.o : %.cc
        @echo ============================ Compiling with optimization:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS) -c $< -o $@
 
 
-# rules which files the libraries depend upon
-Obj.a: ./Obj.a($(o-files))
-Obj.g.a: ./Obj.g.a($(go-files))
-
-
 clean:
-       -rm -f *.o *.go *~ Makefile.dep Obj.a Obj.g.a $(target) $(delete-files)
+       -rm -f *.o *.go *~ Makefile.dep $(target) *gmv *gnuplot *gpl *eps
 
 
 
 .PHONY: clean
 
 
-#Rule to generate the dependency file. This file is
-#automagically remade whenever needed, i.e. whenever
-#one of the cc-/h-files changed. Make detects whether
-#to remake this file upon inclusion at the bottom
-#of this file.
+# Rule to generate the dependency file. This file is
+# automagically remade whenever needed, i.e. whenever
+# one of the cc-/h-files changed. Make detects whether
+# to remake this file upon inclusion at the bottom
+# of this file.
 #
-#use perl to generate rules for the .go files as well
-#as to make rules not for tria.o and the like, but
-#rather for libnumerics.a(tria.o)
-Makefile.dep: $(cc-files) $(h-files) $(lib-h-files)
+# Since the script prefixes the output names by lib/g?o, we have to
+# strip that again (the script was written for the main libraries and
+# large projects where object files are put into subdirs)
+Makefile.dep: $(target).cc Makefile \
+              $(shell echo $D/base/include/base/*.h \
+                           $D/lac/include/lac/*.h  \
+                           $D/deal.II/include/*/*.h)
        @echo ============================ Remaking Makefile
-       @perl $D/common/scripts/Make_dep.pl ./Obj $(INCLUDE) $(cc-files) \
+       @perl $D/common/scripts/make_dependencies.pl  $(INCLUDE) $(target).cc \
+               | perl -pi -e 's!lib/g?o/!!g;' \
                > Makefile.dep
 
 
index 921206942014604658f7ff0334a3753e1830e6fa..dc2798f83951ccc2f42089e835bfb57050d1cd1a 100644 (file)
@@ -1,10 +1,11 @@
 # $Id$
-# Copyright W. Bangerth, University of Heidelberg, 1998
+# Copyright W. Bangerth, University of Heidelberg, 1999
 
 # Template for makefiles for the examples subdirectory. In principle,
 # everything should be done automatically if you set the target file
-# here correctly:
-target   = step-4
+# here correctly. We get deduce it from the files in the present
+# directory:
+target   = $(basename $(shell echo step-*.cc))
 
 # All dependencies between files should be updated by the included
 # file Makefile.dep if necessary. Object files are compiled into
@@ -13,24 +14,6 @@ target   = step-4
 # variable to "off"
 debug-mode = on
 
-# If you want your program to be linked with extra object or library
-# files, specify them here:
-user-libs =
-
-# To run the program, use "make run"; to give parameters to the program,
-# give the parameters to the following variable:
-run-parameters  = 
-
-# To execute additional action apart from running the program, fill
-# in this list:
-additional-run-action =
-
-# To specify which files are to be deleted by "make clean" (apart from
-# the usual ones: object files, executables, backups, etc), fill in the
-# following list
-delete-files = *gpl *inp *history
-
-
 
 
 ###############################################################################
@@ -42,77 +25,68 @@ D = ../../../..
 include $D/common/Make.global_options
 
 # get lists of files we need
-cc-files    = $(filter-out *%, $(shell echo *.cc))
-o-files     = $(cc-files:.cc=.o)
-go-files    = $(cc-files:.cc=.go)
-h-files     = $(filter-out *%, $(shell echo *.h))
-lib-h-files = $(filter-out *%, $(shell echo ../../include/*/*.h))
+
 
 # list of libraries needed to link with
-libs     = ./Obj.a   -ldeal_II_2d  -llac -lbase
-libs.g   = ./Obj.g.a -ldeal_II_3d.g -llac.g -lbase.g
+libs     = -ldeal_II_2d  -llac -lbase
+libs.g   = -ldeal_II_2d.g -llac.g -lbase.g
 
 
 # check whether we use debug mode or not
 ifeq ($(debug-mode),on)
-libraries = $(libs.g)
-flags     = $(CXXFLAGS.g)
-endif
-
-ifeq ($(debug-mode),off)
-libraries = $(libs)
-flags     = $(CXXFLAGS)
+  libraries = $(target).go $(libs.g)
+  flags     = $(CXXFLAGS.g)
+else
+  libraries = $(target).go $(libs)
+  flags     = $(CXXFLAGS.o)
 endif
 
 
 
-# make rule for the target
+# make rule for the target. $^ is the object file $(target).g?o
 $(target) : $(libraries)
        @echo ============================ Linking $@
-       @$(CXX) $(flags) -o $@ $^ $(user-libs)
+       @$(CXX) $(flags) -o $@ $^
 
 # rule how to run the program
 run: $(target)
-       $(target) $(run-parameters)
-       $(additional-run-action)
+       @echo ============================ Running $@
+       @./$(target)
 
 
 # rule to make object files
 %.go : %.cc
        @echo ============================ Compiling with debugging information:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS.g) -c $< -o $@
 %.o : %.cc
        @echo ============================ Compiling with optimization:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS) -c $< -o $@
 
 
-# rules which files the libraries depend upon
-Obj.a: ./Obj.a($(o-files))
-Obj.g.a: ./Obj.g.a($(go-files))
-
-
 clean:
-       -rm -f *.o *.go *~ Makefile.dep Obj.a Obj.g.a $(target) $(delete-files)
+       -rm -f *.o *.go *~ Makefile.dep $(target) *gmv *gnuplot *gpl *eps
 
 
 
 .PHONY: clean
 
 
-#Rule to generate the dependency file. This file is
-#automagically remade whenever needed, i.e. whenever
-#one of the cc-/h-files changed. Make detects whether
-#to remake this file upon inclusion at the bottom
-#of this file.
+# Rule to generate the dependency file. This file is
+# automagically remade whenever needed, i.e. whenever
+# one of the cc-/h-files changed. Make detects whether
+# to remake this file upon inclusion at the bottom
+# of this file.
 #
-#use perl to generate rules for the .go files as well
-#as to make rules not for tria.o and the like, but
-#rather for libnumerics.a(tria.o)
-Makefile.dep: $(cc-files) $(h-files) $(lib-h-files)
+# Since the script prefixes the output names by lib/g?o, we have to
+# strip that again (the script was written for the main libraries and
+# large projects where object files are put into subdirs)
+Makefile.dep: $(target).cc Makefile \
+              $(shell echo $D/base/include/base/*.h \
+                           $D/lac/include/lac/*.h  \
+                           $D/deal.II/include/*/*.h)
        @echo ============================ Remaking Makefile
-       @perl $D/common/scripts/Make_dep.pl ./Obj $(INCLUDE) $(cc-files) \
+       @perl $D/common/scripts/make_dependencies.pl  $(INCLUDE) $(target).cc \
+               | perl -pi -e 's!lib/g?o/!!g;' \
                > Makefile.dep
 
 
index 10857510837eccfc3c6c9ca0d7cbfa2d7fb6e640..6cf1272375d24e94c4a5e2958824574dcd408d9d 100644 (file)
@@ -2,18 +2,35 @@
 #
 # This Makefile only recurses into the subdirs
 
-default:
-       cd step-1 ; $(MAKE)
-       cd step-2 ; $(MAKE)
-       cd step-3 ; $(MAKE)
 
+# existing examples. take dirnames and strip 'step'
+steps = $(shell echo step-*)
 
-run:
-       cd step-1 ; $(MAKE) run
-       cd step-2 ; $(MAKE) run
-       cd step-3 ; $(MAKE) run
 
-clean:
-       cd step-1 ; $(MAKE) clean
-       cd step-2 ; $(MAKE) clean
-       cd step-3 ; $(MAKE) clean
+# default is: build all examples. for each example, there is a target
+# build-step-N, where N in [1...]
+default: $(addprefix build-,$(steps))
+
+# run example programs; make a target run-step-N for each N
+run: $(addprefix run-,$(steps))
+
+# clean subdirs; make a target clean-step-N for each N
+clean: $(addprefix clean-,$(steps))
+
+
+
+# for each build/run/clean target: strip the build- prefix of the
+# target and build in that directory
+build-step-%:
+       cd $(@:build-%=%) ; $(MAKE)
+run-step-%:
+       cd $(@:run-%=%) ; $(MAKE) run
+clean-step-%:
+       cd $(@:clean-%=%) ; $(MAKE) clean
+
+
+# all targets in this directory do not produce files, so they are
+# .PHONY:
+.PHONY: $(addprefix build-step-,$(steps)) \
+        $(addprefix run-step-,$(steps))   \
+        $(addprefix clean-step-,$(steps))
index 467a0580b792b384bfec0732dfdebe8ae41d3134..dc2798f83951ccc2f42089e835bfb57050d1cd1a 100644 (file)
@@ -1,10 +1,11 @@
 # $Id$
-# Copyright W. Bangerth, University of Heidelberg, 1998
+# Copyright W. Bangerth, University of Heidelberg, 1999
 
 # Template for makefiles for the examples subdirectory. In principle,
 # everything should be done automatically if you set the target file
-# here correctly:
-target   = step-1
+# here correctly. We get deduce it from the files in the present
+# directory:
+target   = $(basename $(shell echo step-*.cc))
 
 # All dependencies between files should be updated by the included
 # file Makefile.dep if necessary. Object files are compiled into
@@ -13,24 +14,6 @@ target   = step-1
 # variable to "off"
 debug-mode = on
 
-# If you want your program to be linked with extra object or library
-# files, specify them here:
-user-libs =
-
-# To run the program, use "make run"; to give parameters to the program,
-# give the parameters to the following variable:
-run-parameters  = 
-
-# To execute additional action apart from running the program, fill
-# in this list:
-additional-run-action =
-
-# To specify which files are to be deleted by "make clean" (apart from
-# the usual ones: object files, executables, backups, etc), fill in the
-# following list
-delete-files = *gnuplot *inp *history
-
-
 
 
 ###############################################################################
@@ -42,77 +25,68 @@ D = ../../../..
 include $D/common/Make.global_options
 
 # get lists of files we need
-cc-files    = $(filter-out *%, $(shell echo *.cc))
-o-files     = $(cc-files:.cc=.o)
-go-files    = $(cc-files:.cc=.go)
-h-files     = $(filter-out *%, $(shell echo *.h))
-lib-h-files = $(filter-out *%, $(shell echo ../../include/*/*.h))
+
 
 # list of libraries needed to link with
-libs     = ./Obj.a   -ldeal_II_2d  -llac -lbase
-libs.g   = ./Obj.g.a -ldeal_II_2d.g -llac.g -lbase.g
+libs     = -ldeal_II_2d  -llac -lbase
+libs.g   = -ldeal_II_2d.g -llac.g -lbase.g
 
 
 # check whether we use debug mode or not
 ifeq ($(debug-mode),on)
-libraries = $(libs.g)
-flags     = $(CXXFLAGS.g)
-endif
-
-ifeq ($(debug-mode),off)
-libraries = $(libs)
-flags     = $(CXXFLAGS)
+  libraries = $(target).go $(libs.g)
+  flags     = $(CXXFLAGS.g)
+else
+  libraries = $(target).go $(libs)
+  flags     = $(CXXFLAGS.o)
 endif
 
 
 
-# make rule for the target
+# make rule for the target. $^ is the object file $(target).g?o
 $(target) : $(libraries)
        @echo ============================ Linking $@
-       @$(CXX) $(flags) -o $@ $^ $(user-libs)
+       @$(CXX) $(flags) -o $@ $^
 
 # rule how to run the program
 run: $(target)
-       $(target) $(run-parameters)
-       $(additional-run-action)
+       @echo ============================ Running $@
+       @./$(target)
 
 
 # rule to make object files
 %.go : %.cc
        @echo ============================ Compiling with debugging information:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS.g) -c $< -o $@
 %.o : %.cc
        @echo ============================ Compiling with optimization:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS) -c $< -o $@
 
 
-# rules which files the libraries depend upon
-Obj.a: ./Obj.a($(o-files))
-Obj.g.a: ./Obj.g.a($(go-files))
-
-
 clean:
-       -rm -f *.o *.go *~ Makefile.dep Obj.a Obj.g.a $(target) $(delete-files)
+       -rm -f *.o *.go *~ Makefile.dep $(target) *gmv *gnuplot *gpl *eps
 
 
 
 .PHONY: clean
 
 
-#Rule to generate the dependency file. This file is
-#automagically remade whenever needed, i.e. whenever
-#one of the cc-/h-files changed. Make detects whether
-#to remake this file upon inclusion at the bottom
-#of this file.
+# Rule to generate the dependency file. This file is
+# automagically remade whenever needed, i.e. whenever
+# one of the cc-/h-files changed. Make detects whether
+# to remake this file upon inclusion at the bottom
+# of this file.
 #
-#use perl to generate rules for the .go files as well
-#as to make rules not for tria.o and the like, but
-#rather for libnumerics.a(tria.o)
-Makefile.dep: $(cc-files) $(h-files) $(lib-h-files)
+# Since the script prefixes the output names by lib/g?o, we have to
+# strip that again (the script was written for the main libraries and
+# large projects where object files are put into subdirs)
+Makefile.dep: $(target).cc Makefile \
+              $(shell echo $D/base/include/base/*.h \
+                           $D/lac/include/lac/*.h  \
+                           $D/deal.II/include/*/*.h)
        @echo ============================ Remaking Makefile
-       @perl $D/common/scripts/Make_dep.pl ./Obj $(INCLUDE) $(cc-files) \
+       @perl $D/common/scripts/make_dependencies.pl  $(INCLUDE) $(target).cc \
+               | perl -pi -e 's!lib/g?o/!!g;' \
                > Makefile.dep
 
 
index 8fb10b1fec087e60949aeb199c213fba6bdad328..dc2798f83951ccc2f42089e835bfb57050d1cd1a 100644 (file)
@@ -1,10 +1,11 @@
 # $Id$
-# Copyright W. Bangerth, University of Heidelberg, 1998
+# Copyright W. Bangerth, University of Heidelberg, 1999
 
 # Template for makefiles for the examples subdirectory. In principle,
 # everything should be done automatically if you set the target file
-# here correctly:
-target   = step-2
+# here correctly. We get deduce it from the files in the present
+# directory:
+target   = $(basename $(shell echo step-*.cc))
 
 # All dependencies between files should be updated by the included
 # file Makefile.dep if necessary. Object files are compiled into
@@ -13,24 +14,6 @@ target   = step-2
 # variable to "off"
 debug-mode = on
 
-# If you want your program to be linked with extra object or library
-# files, specify them here:
-user-libs =
-
-# To run the program, use "make run"; to give parameters to the program,
-# give the parameters to the following variable:
-run-parameters  = 
-
-# To execute additional action apart from running the program, fill
-# in this list:
-additional-run-action =
-
-# To specify which files are to be deleted by "make clean" (apart from
-# the usual ones: object files, executables, backups, etc), fill in the
-# following list
-delete-files = *gnuplot *inp *history
-
-
 
 
 ###############################################################################
@@ -42,77 +25,68 @@ D = ../../../..
 include $D/common/Make.global_options
 
 # get lists of files we need
-cc-files    = $(filter-out *%, $(shell echo *.cc))
-o-files     = $(cc-files:.cc=.o)
-go-files    = $(cc-files:.cc=.go)
-h-files     = $(filter-out *%, $(shell echo *.h))
-lib-h-files = $(filter-out *%, $(shell echo ../../include/*/*.h))
+
 
 # list of libraries needed to link with
-libs     = ./Obj.a   -ldeal_II_2d  -llac -lbase
-libs.g   = ./Obj.g.a -ldeal_II_2d.g -llac.g -lbase.g
+libs     = -ldeal_II_2d  -llac -lbase
+libs.g   = -ldeal_II_2d.g -llac.g -lbase.g
 
 
 # check whether we use debug mode or not
 ifeq ($(debug-mode),on)
-libraries = $(libs.g)
-flags     = $(CXXFLAGS.g)
-endif
-
-ifeq ($(debug-mode),off)
-libraries = $(libs)
-flags     = $(CXXFLAGS)
+  libraries = $(target).go $(libs.g)
+  flags     = $(CXXFLAGS.g)
+else
+  libraries = $(target).go $(libs)
+  flags     = $(CXXFLAGS.o)
 endif
 
 
 
-# make rule for the target
+# make rule for the target. $^ is the object file $(target).g?o
 $(target) : $(libraries)
        @echo ============================ Linking $@
-       @$(CXX) $(flags) -o $@ $^ $(user-libs)
+       @$(CXX) $(flags) -o $@ $^
 
 # rule how to run the program
 run: $(target)
-       $(target) $(run-parameters)
-       $(additional-run-action)
+       @echo ============================ Running $@
+       @./$(target)
 
 
 # rule to make object files
 %.go : %.cc
        @echo ============================ Compiling with debugging information:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS.g) -c $< -o $@
 %.o : %.cc
        @echo ============================ Compiling with optimization:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS) -c $< -o $@
 
 
-# rules which files the libraries depend upon
-Obj.a: ./Obj.a($(o-files))
-Obj.g.a: ./Obj.g.a($(go-files))
-
-
 clean:
-       -rm -f *.o *.go *~ Makefile.dep Obj.a Obj.g.a $(target) $(delete-files)
+       -rm -f *.o *.go *~ Makefile.dep $(target) *gmv *gnuplot *gpl *eps
 
 
 
 .PHONY: clean
 
 
-#Rule to generate the dependency file. This file is
-#automagically remade whenever needed, i.e. whenever
-#one of the cc-/h-files changed. Make detects whether
-#to remake this file upon inclusion at the bottom
-#of this file.
+# Rule to generate the dependency file. This file is
+# automagically remade whenever needed, i.e. whenever
+# one of the cc-/h-files changed. Make detects whether
+# to remake this file upon inclusion at the bottom
+# of this file.
 #
-#use perl to generate rules for the .go files as well
-#as to make rules not for tria.o and the like, but
-#rather for libnumerics.a(tria.o)
-Makefile.dep: $(cc-files) $(h-files) $(lib-h-files)
+# Since the script prefixes the output names by lib/g?o, we have to
+# strip that again (the script was written for the main libraries and
+# large projects where object files are put into subdirs)
+Makefile.dep: $(target).cc Makefile \
+              $(shell echo $D/base/include/base/*.h \
+                           $D/lac/include/lac/*.h  \
+                           $D/deal.II/include/*/*.h)
        @echo ============================ Remaking Makefile
-       @perl $D/common/scripts/Make_dep.pl ./Obj $(INCLUDE) $(cc-files) \
+       @perl $D/common/scripts/make_dependencies.pl  $(INCLUDE) $(target).cc \
+               | perl -pi -e 's!lib/g?o/!!g;' \
                > Makefile.dep
 
 
index 0e96bf3a5b62447d7e18501d8157ec54e2931ea2..dc2798f83951ccc2f42089e835bfb57050d1cd1a 100644 (file)
@@ -1,10 +1,11 @@
 # $Id$
-# Copyright W. Bangerth, University of Heidelberg, 1998
+# Copyright W. Bangerth, University of Heidelberg, 1999
 
 # Template for makefiles for the examples subdirectory. In principle,
 # everything should be done automatically if you set the target file
-# here correctly:
-target   = step-3
+# here correctly. We get deduce it from the files in the present
+# directory:
+target   = $(basename $(shell echo step-*.cc))
 
 # All dependencies between files should be updated by the included
 # file Makefile.dep if necessary. Object files are compiled into
@@ -13,24 +14,6 @@ target   = step-3
 # variable to "off"
 debug-mode = on
 
-# If you want your program to be linked with extra object or library
-# files, specify them here:
-user-libs =
-
-# To run the program, use "make run"; to give parameters to the program,
-# give the parameters to the following variable:
-run-parameters  = 
-
-# To execute additional action apart from running the program, fill
-# in this list:
-additional-run-action =
-
-# To specify which files are to be deleted by "make clean" (apart from
-# the usual ones: object files, executables, backups, etc), fill in the
-# following list
-delete-files = *gpl *inp *history
-
-
 
 
 ###############################################################################
@@ -42,77 +25,68 @@ D = ../../../..
 include $D/common/Make.global_options
 
 # get lists of files we need
-cc-files    = $(filter-out *%, $(shell echo *.cc))
-o-files     = $(cc-files:.cc=.o)
-go-files    = $(cc-files:.cc=.go)
-h-files     = $(filter-out *%, $(shell echo *.h))
-lib-h-files = $(filter-out *%, $(shell echo ../../include/*/*.h))
+
 
 # list of libraries needed to link with
-libs     = ./Obj.a   -ldeal_II_2d  -llac -lbase
-libs.g   = ./Obj.g.a -ldeal_II_2d.g -llac.g -lbase.g
+libs     = -ldeal_II_2d  -llac -lbase
+libs.g   = -ldeal_II_2d.g -llac.g -lbase.g
 
 
 # check whether we use debug mode or not
 ifeq ($(debug-mode),on)
-libraries = $(libs.g)
-flags     = $(CXXFLAGS.g)
-endif
-
-ifeq ($(debug-mode),off)
-libraries = $(libs)
-flags     = $(CXXFLAGS)
+  libraries = $(target).go $(libs.g)
+  flags     = $(CXXFLAGS.g)
+else
+  libraries = $(target).go $(libs)
+  flags     = $(CXXFLAGS.o)
 endif
 
 
 
-# make rule for the target
+# make rule for the target. $^ is the object file $(target).g?o
 $(target) : $(libraries)
        @echo ============================ Linking $@
-       @$(CXX) $(flags) -o $@ $^ $(user-libs)
+       @$(CXX) $(flags) -o $@ $^
 
 # rule how to run the program
 run: $(target)
-       $(target) $(run-parameters)
-       $(additional-run-action)
+       @echo ============================ Running $@
+       @./$(target)
 
 
 # rule to make object files
 %.go : %.cc
        @echo ============================ Compiling with debugging information:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS.g) -c $< -o $@
 %.o : %.cc
        @echo ============================ Compiling with optimization:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS) -c $< -o $@
 
 
-# rules which files the libraries depend upon
-Obj.a: ./Obj.a($(o-files))
-Obj.g.a: ./Obj.g.a($(go-files))
-
-
 clean:
-       -rm -f *.o *.go *~ Makefile.dep Obj.a Obj.g.a $(target) $(delete-files)
+       -rm -f *.o *.go *~ Makefile.dep $(target) *gmv *gnuplot *gpl *eps
 
 
 
 .PHONY: clean
 
 
-#Rule to generate the dependency file. This file is
-#automagically remade whenever needed, i.e. whenever
-#one of the cc-/h-files changed. Make detects whether
-#to remake this file upon inclusion at the bottom
-#of this file.
+# Rule to generate the dependency file. This file is
+# automagically remade whenever needed, i.e. whenever
+# one of the cc-/h-files changed. Make detects whether
+# to remake this file upon inclusion at the bottom
+# of this file.
 #
-#use perl to generate rules for the .go files as well
-#as to make rules not for tria.o and the like, but
-#rather for libnumerics.a(tria.o)
-Makefile.dep: $(cc-files) $(h-files) $(lib-h-files)
+# Since the script prefixes the output names by lib/g?o, we have to
+# strip that again (the script was written for the main libraries and
+# large projects where object files are put into subdirs)
+Makefile.dep: $(target).cc Makefile \
+              $(shell echo $D/base/include/base/*.h \
+                           $D/lac/include/lac/*.h  \
+                           $D/deal.II/include/*/*.h)
        @echo ============================ Remaking Makefile
-       @perl $D/common/scripts/Make_dep.pl ./Obj $(INCLUDE) $(cc-files) \
+       @perl $D/common/scripts/make_dependencies.pl  $(INCLUDE) $(target).cc \
+               | perl -pi -e 's!lib/g?o/!!g;' \
                > Makefile.dep
 
 
index 921206942014604658f7ff0334a3753e1830e6fa..dc2798f83951ccc2f42089e835bfb57050d1cd1a 100644 (file)
@@ -1,10 +1,11 @@
 # $Id$
-# Copyright W. Bangerth, University of Heidelberg, 1998
+# Copyright W. Bangerth, University of Heidelberg, 1999
 
 # Template for makefiles for the examples subdirectory. In principle,
 # everything should be done automatically if you set the target file
-# here correctly:
-target   = step-4
+# here correctly. We get deduce it from the files in the present
+# directory:
+target   = $(basename $(shell echo step-*.cc))
 
 # All dependencies between files should be updated by the included
 # file Makefile.dep if necessary. Object files are compiled into
@@ -13,24 +14,6 @@ target   = step-4
 # variable to "off"
 debug-mode = on
 
-# If you want your program to be linked with extra object or library
-# files, specify them here:
-user-libs =
-
-# To run the program, use "make run"; to give parameters to the program,
-# give the parameters to the following variable:
-run-parameters  = 
-
-# To execute additional action apart from running the program, fill
-# in this list:
-additional-run-action =
-
-# To specify which files are to be deleted by "make clean" (apart from
-# the usual ones: object files, executables, backups, etc), fill in the
-# following list
-delete-files = *gpl *inp *history
-
-
 
 
 ###############################################################################
@@ -42,77 +25,68 @@ D = ../../../..
 include $D/common/Make.global_options
 
 # get lists of files we need
-cc-files    = $(filter-out *%, $(shell echo *.cc))
-o-files     = $(cc-files:.cc=.o)
-go-files    = $(cc-files:.cc=.go)
-h-files     = $(filter-out *%, $(shell echo *.h))
-lib-h-files = $(filter-out *%, $(shell echo ../../include/*/*.h))
+
 
 # list of libraries needed to link with
-libs     = ./Obj.a   -ldeal_II_2d  -llac -lbase
-libs.g   = ./Obj.g.a -ldeal_II_3d.g -llac.g -lbase.g
+libs     = -ldeal_II_2d  -llac -lbase
+libs.g   = -ldeal_II_2d.g -llac.g -lbase.g
 
 
 # check whether we use debug mode or not
 ifeq ($(debug-mode),on)
-libraries = $(libs.g)
-flags     = $(CXXFLAGS.g)
-endif
-
-ifeq ($(debug-mode),off)
-libraries = $(libs)
-flags     = $(CXXFLAGS)
+  libraries = $(target).go $(libs.g)
+  flags     = $(CXXFLAGS.g)
+else
+  libraries = $(target).go $(libs)
+  flags     = $(CXXFLAGS.o)
 endif
 
 
 
-# make rule for the target
+# make rule for the target. $^ is the object file $(target).g?o
 $(target) : $(libraries)
        @echo ============================ Linking $@
-       @$(CXX) $(flags) -o $@ $^ $(user-libs)
+       @$(CXX) $(flags) -o $@ $^
 
 # rule how to run the program
 run: $(target)
-       $(target) $(run-parameters)
-       $(additional-run-action)
+       @echo ============================ Running $@
+       @./$(target)
 
 
 # rule to make object files
 %.go : %.cc
        @echo ============================ Compiling with debugging information:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS.g) -c $< -o $@
 %.o : %.cc
        @echo ============================ Compiling with optimization:   $<
-       @echo $(CXX) ... -c $< -o $@
        @$(CXX) $(CXXFLAGS) -c $< -o $@
 
 
-# rules which files the libraries depend upon
-Obj.a: ./Obj.a($(o-files))
-Obj.g.a: ./Obj.g.a($(go-files))
-
-
 clean:
-       -rm -f *.o *.go *~ Makefile.dep Obj.a Obj.g.a $(target) $(delete-files)
+       -rm -f *.o *.go *~ Makefile.dep $(target) *gmv *gnuplot *gpl *eps
 
 
 
 .PHONY: clean
 
 
-#Rule to generate the dependency file. This file is
-#automagically remade whenever needed, i.e. whenever
-#one of the cc-/h-files changed. Make detects whether
-#to remake this file upon inclusion at the bottom
-#of this file.
+# Rule to generate the dependency file. This file is
+# automagically remade whenever needed, i.e. whenever
+# one of the cc-/h-files changed. Make detects whether
+# to remake this file upon inclusion at the bottom
+# of this file.
 #
-#use perl to generate rules for the .go files as well
-#as to make rules not for tria.o and the like, but
-#rather for libnumerics.a(tria.o)
-Makefile.dep: $(cc-files) $(h-files) $(lib-h-files)
+# Since the script prefixes the output names by lib/g?o, we have to
+# strip that again (the script was written for the main libraries and
+# large projects where object files are put into subdirs)
+Makefile.dep: $(target).cc Makefile \
+              $(shell echo $D/base/include/base/*.h \
+                           $D/lac/include/lac/*.h  \
+                           $D/deal.II/include/*/*.h)
        @echo ============================ Remaking Makefile
-       @perl $D/common/scripts/Make_dep.pl ./Obj $(INCLUDE) $(cc-files) \
+       @perl $D/common/scripts/make_dependencies.pl  $(INCLUDE) $(target).cc \
+               | perl -pi -e 's!lib/g?o/!!g;' \
                > Makefile.dep
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.