From 7db5d4ec165f75f63db196e5249da3240c7c5398 Mon Sep 17 00:00:00 2001 From: wolf Date: Wed, 22 Dec 1999 22:46:14 +0000 Subject: [PATCH] Simplify makefiles and unify them. git-svn-id: https://svn.dealii.org/trunk@2113 0785d39b-7218-0410-832d-ea1e28bc413d --- .../Attic/examples/step-by-step/Makefile | 41 ++++++--- .../examples/step-by-step/step-1/Makefile | 88 +++++++------------ .../examples/step-by-step/step-2/Makefile | 88 +++++++------------ .../examples/step-by-step/step-3/Makefile | 88 +++++++------------ .../examples/step-by-step/step-4/Makefile | 88 +++++++------------ deal.II/examples/Makefile | 41 ++++++--- deal.II/examples/step-1/Makefile | 88 +++++++------------ deal.II/examples/step-2/Makefile | 88 +++++++------------ deal.II/examples/step-3/Makefile | 88 +++++++------------ deal.II/examples/step-4/Makefile | 88 +++++++------------ 10 files changed, 306 insertions(+), 480 deletions(-) diff --git a/deal.II/deal.II/Attic/examples/step-by-step/Makefile b/deal.II/deal.II/Attic/examples/step-by-step/Makefile index 1085751083..6cf1272375 100644 --- a/deal.II/deal.II/Attic/examples/step-by-step/Makefile +++ b/deal.II/deal.II/Attic/examples/step-by-step/Makefile @@ -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)) diff --git a/deal.II/deal.II/Attic/examples/step-by-step/step-1/Makefile b/deal.II/deal.II/Attic/examples/step-by-step/step-1/Makefile index 467a0580b7..dc2798f839 100644 --- a/deal.II/deal.II/Attic/examples/step-by-step/step-1/Makefile +++ b/deal.II/deal.II/Attic/examples/step-by-step/step-1/Makefile @@ -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 diff --git a/deal.II/deal.II/Attic/examples/step-by-step/step-2/Makefile b/deal.II/deal.II/Attic/examples/step-by-step/step-2/Makefile index 8fb10b1fec..dc2798f839 100644 --- a/deal.II/deal.II/Attic/examples/step-by-step/step-2/Makefile +++ b/deal.II/deal.II/Attic/examples/step-by-step/step-2/Makefile @@ -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 diff --git a/deal.II/deal.II/Attic/examples/step-by-step/step-3/Makefile b/deal.II/deal.II/Attic/examples/step-by-step/step-3/Makefile index 0e96bf3a5b..dc2798f839 100644 --- a/deal.II/deal.II/Attic/examples/step-by-step/step-3/Makefile +++ b/deal.II/deal.II/Attic/examples/step-by-step/step-3/Makefile @@ -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 diff --git a/deal.II/deal.II/Attic/examples/step-by-step/step-4/Makefile b/deal.II/deal.II/Attic/examples/step-by-step/step-4/Makefile index 9212069420..dc2798f839 100644 --- a/deal.II/deal.II/Attic/examples/step-by-step/step-4/Makefile +++ b/deal.II/deal.II/Attic/examples/step-by-step/step-4/Makefile @@ -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 diff --git a/deal.II/examples/Makefile b/deal.II/examples/Makefile index 1085751083..6cf1272375 100644 --- a/deal.II/examples/Makefile +++ b/deal.II/examples/Makefile @@ -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)) diff --git a/deal.II/examples/step-1/Makefile b/deal.II/examples/step-1/Makefile index 467a0580b7..dc2798f839 100644 --- a/deal.II/examples/step-1/Makefile +++ b/deal.II/examples/step-1/Makefile @@ -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 diff --git a/deal.II/examples/step-2/Makefile b/deal.II/examples/step-2/Makefile index 8fb10b1fec..dc2798f839 100644 --- a/deal.II/examples/step-2/Makefile +++ b/deal.II/examples/step-2/Makefile @@ -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 diff --git a/deal.II/examples/step-3/Makefile b/deal.II/examples/step-3/Makefile index 0e96bf3a5b..dc2798f839 100644 --- a/deal.II/examples/step-3/Makefile +++ b/deal.II/examples/step-3/Makefile @@ -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 diff --git a/deal.II/examples/step-4/Makefile b/deal.II/examples/step-4/Makefile index 9212069420..dc2798f839 100644 --- a/deal.II/examples/step-4/Makefile +++ b/deal.II/examples/step-4/Makefile @@ -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 -- 2.39.5