From b41e876f91823fd2adc1547eb6b9a31ae388be38 Mon Sep 17 00:00:00 2001 From: wolf Date: Sat, 20 Nov 1999 22:28:50 +0000 Subject: [PATCH] Great simplifications of the whole Makefile business. git-svn-id: https://svn.dealii.org/trunk@1912 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/Makefile | 20 +- deal.II/base/Makefile | 103 ++++++++++- deal.II/base/source/Makefile | 101 ----------- deal.II/common/Makefile | 20 +- deal.II/common/scripts/forward_declarations | 48 ++--- deal.II/common/scripts/make_dependencies.pl | 163 +++++++++++++++++ deal.II/deal.II/Makefile | 144 +++++++++++++-- deal.II/deal.II/source/Makefile | 191 -------------------- deal.II/lac/Makefile | 72 +++++++- deal.II/lac/source/Makefile | 66 ------- 10 files changed, 491 insertions(+), 437 deletions(-) delete mode 100644 deal.II/base/source/Makefile create mode 100644 deal.II/common/scripts/make_dependencies.pl delete mode 100644 deal.II/deal.II/source/Makefile delete mode 100644 deal.II/lac/source/Makefile diff --git a/deal.II/Makefile b/deal.II/Makefile index cacf3a64b4..095c5878f6 100644 --- a/deal.II/Makefile +++ b/deal.II/Makefile @@ -33,34 +33,34 @@ MAKEOPTIONS = $(PAR) baseg: - cd ../base/source ; $(MAKE) $(MAKEOPTIONS) libg + cd ../base ; $(MAKE) $(MAKEOPTIONS) libg base: baseg - cd ../base/source ; $(MAKE) $(MAKEOPTIONS) libg lib + cd ../base ; $(MAKE) $(MAKEOPTIONS) libg lib lacg: baseg - cd ../lac/source ; $(MAKE) $(MAKEOPTIONS) libg + cd ../lac ; $(MAKE) $(MAKEOPTIONS) libg lac: base lacg - cd ../lac/source ; $(MAKE) $(MAKEOPTIONS) libg lib + cd ../lac ; $(MAKE) $(MAKEOPTIONS) libg lib 1dg: baseg lacg - cd ../deal.II/source ; $(MAKE) $(MAKEOPTIONS) 1dg + cd ../deal.II ; $(MAKE) $(MAKEOPTIONS) 1dg 2dg: baseg lacg - cd ../deal.II/source ; $(MAKE) $(MAKEOPTIONS) 2dg + cd ../deal.II ; $(MAKE) $(MAKEOPTIONS) 2dg 3dg: baseg lacg - cd ../deal.II/source ; $(MAKE) $(MAKEOPTIONS) 3dg + cd ../deal.II ; $(MAKE) $(MAKEOPTIONS) 3dg 1d: baseg lacg base lac 1dg - cd ../deal.II/source ; $(MAKE) $(MAKEOPTIONS) 1d + cd ../deal.II ; $(MAKE) $(MAKEOPTIONS) 1d 2d: baseg lacg base lac 2dg - cd ../deal.II/source ; $(MAKE) $(MAKEOPTIONS) 2d + cd ../deal.II ; $(MAKE) $(MAKEOPTIONS) 2d 3d: baseg lacg base lac 3dg - cd ../deal.II/source ; $(MAKE) $(MAKEOPTIONS) 3d + cd ../deal.II ; $(MAKE) $(MAKEOPTIONS) 3d all: base lac 2d 1d 3d diff --git a/deal.II/base/Makefile b/deal.II/base/Makefile index 298de6ded2..1a36b052d6 100644 --- a/deal.II/base/Makefile +++ b/deal.II/base/Makefile @@ -1,17 +1,102 @@ # $Id$ +# Copyright W. Bangerth, University of Heidelberg, 1998, 1999 -all: lac -clean: source-clean - rm -f *~ include/*~ include/*/*~ lib/lib* lib/o/*.o lib/go/*.go include/base/forward-declarations.h* +# deal.II top level directory +D=.. -lac: - cd source ; $(MAKE) -source-clean: - cd source ; $(MAKE) clean +# create lists of file names. note that we need several output +# files for data_out_base.cc, which is why we use the several +# intermediate o-files-base* rules +cc-files = $(shell echo source/*.cc) +o-files-base1= $(addprefix lib/o/, $(patsubst source/%,%,$(cc-files:.cc=.o))) +o-files-base2= $(filter-out %data_out_base.o, $(o-files-base1)) \ + $(patsubst %.o,%_1d.o,$(filter %data_out_base.o, $(o-files-base1))) \ + $(patsubst %.o,%_2d.o,$(filter %data_out_base.o, $(o-files-base1))) \ + $(patsubst %.o,%_3d.o,$(filter %data_out_base.o, $(o-files-base1))) +o-files-base3= $(sort $(o-files-base2)) +o-files = $(o-files-base3) +go-files = $(patsubst lib/o/%,lib/go/%,$(o-files-base3:.o=.go)) +h-files = $(shell echo include/base/*.h) +forward-declarations = $D/base/include/base/forward-declarations.h -.PHONY: all -.PHONY: clean source-clean +# get options which hold for all files of the project +include $D/common/Make.global_options + + +# urgh, this is a weird hack, since this function uses the $@ variable +# which is only set in rules generating output files. +# +# the two variables here do the following: maybe-define-dimension1 +# filters out the 1, 2, or 3 if it is contained within some file +# name sufficed by _1d, _2d, or _3d. It contains three parts, +# but it is obvious that at most one branch will succeed. +# This variable will then contain several spaces and maybe one +# digit, which are removed by the 'strip' command +# +# maybe-define-dimension will substitute anything by +# -Ddata_out_dimension=anything, if there is an 'anything'. If not, +# i.e. if the filename contained no _*d, then nothing is +# substituted and the result of the variable is an empty string +maybe-define-dimension1 = $(strip $(findstring 1,$(findstring _1d.,$@)) \ + $(findstring 2,$(findstring _2d.,$@)) \ + $(findstring 3,$(findstring _3d.,$@))) +maybe-define-dimension = $(patsubst %,-Ddata_out_dimension=%,$(maybe-define-dimension1)) + +# production rules +lib/go/%.go : + @echo =================== Compiling with debugging information: $( lib/Makefile.dep + + +# include all the dependencies +include lib/Makefile.dep + +# include a rule which tells how to remake the forward declarations file +include $D/common/Makescripts/forward_declarations + + +.PHONY: clean +.PHONY: lib lib.a lib.g.a diff --git a/deal.II/base/source/Makefile b/deal.II/base/source/Makefile deleted file mode 100644 index 5d5d5b4dd3..0000000000 --- a/deal.II/base/source/Makefile +++ /dev/null @@ -1,101 +0,0 @@ -# $Id$ - -D=../.. - - -# create lists of file names. note that we need several output -# files for data_out_base.cc, which is why we use the several -# intermediate o-files-base* rules -cc-files = $(shell echo *.cc) -o-files-base1= $(addprefix ../lib/o/, $(cc-files:.cc=.o)) -o-files-base2= $(filter-out %data_out_base.o, $(o-files-base1)) \ - $(patsubst %.o,%_1d.o,$(filter %data_out_base.o, $(o-files-base1))) \ - $(patsubst %.o,%_2d.o,$(filter %data_out_base.o, $(o-files-base1))) \ - $(patsubst %.o,%_3d.o,$(filter %data_out_base.o, $(o-files-base1))) -o-files-base3= $(sort $(o-files-base2)) -o-files = $(o-files-base3) -go-files = $(patsubst ../lib/o/%,../lib/go/%,$(o-files-base3:.o=.go)) -h-files = $(shell echo ../include/*/*.h) - -forward-declarations = $D/base/include/base/forward-declarations.h - -include $D/common/Make.global_options - - -# urgh, this is a weird hack, since this function uses the $@ variable -# which is only set in rules generating output files. -# -# the two variables here do the following: maybe-define-dimension1 -# filters out the 1, 2, or 3 if it is contained within some file -# name sufficed by _1d, _2d, or _3d. It contains three parts, -# but it is obvious that at most one branch will succeed. -# This variable will then contain several spaces and maybe one -# digit, which are removed by the 'strip' command -# -# maybe-define-dimension will substitute anything by -# -Ddata_out_dimension=anything, if there is an 'anything'. If not, -# i.e. if the filename contained no _*d, then nothing is -# substituted and the result of the variable is an empty string -maybe-define-dimension1 = $(strip $(findstring 1,$(findstring _1d.,$@)) \ - $(findstring 2,$(findstring _2d.,$@)) \ - $(findstring 3,$(findstring _3d.,$@))) -maybe-define-dimension = $(patsubst %,-Ddata_out_dimension=%,$(maybe-define-dimension1)) - - - -../lib/go/%.go : - @echo =================== Compiling with debugging information: $< \ - " " $(patsubst -Ddata_out_dimension=%,dimension=%,$(maybe-define-dimension)) - @$(CXX) $(CXXFLAGS) $(CXXFLAGS.g) $(maybe-define-dimension) -c $< -o $@ -../lib/o/%.o : - @echo =================== Compiling with optimization: $< \ - " " $(patsubst -Ddata_out_dimension=%,dimension=%,$(maybe-define-dimension)) - @$(CXX) $(CXXFLAGS) $(CXXFLAGS.o) $(maybe-define-dimension) -c $< -o $@ - - -lib: ../lib/libbase.g.a ../lib/libbase.a -libg: ../lib/libbase.g.a - -../lib/libbase.a: $(forward-declarations) $(o-files) - @echo ======================================== Updating library: $@ - @ar ruv $@ $(o-files) - -../lib/libbase.g.a: $(forward-declarations) $(go-files) - @echo ======================================== Updating library: $@ - @ar ruv $@ $(go-files) - -clean: - rm -f ../lib/o/*.o ../lib/go/*.go *~ ../lib/Makefile.dep ../lib/lib* - - - -.PHONY: lib lib.a lib.g.a 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. -# -#see the Makefile of the deal.II directory for a thorough -#description of what happens here -# -#note that here we translate file names with data_out_base -#to three file names with the dimension for which we compile -#appended -../lib/Makefile.dep: $(cc-files) $(forward-declarations) $(h-files) Makefile -ifneq (1,${recursive-make-fwd-decl}) - @echo ============================ Remaking Makefile - @perl $D/common/scripts/Make_dep.pl ../lib/libbase $(INCLUDE) $(cc-files) \ - | perl -p -e 's!^.*\((.*\.(g?o))\):!../lib/$$2/$$1:!g;' \ - | perl -p -e 's!(.*data_out_base)(.g?o)!$$1_1d$$2 $$1_2d$$2 $$1_3d$$2!g;' \ - > ../lib/Makefile.dep -else - @echo ============================ Not remaking Makefile since in nested mode -endif - - -include ../lib/Makefile.dep - -include $D/common/Makescripts/forward_declarations diff --git a/deal.II/common/Makefile b/deal.II/common/Makefile index cacf3a64b4..095c5878f6 100644 --- a/deal.II/common/Makefile +++ b/deal.II/common/Makefile @@ -33,34 +33,34 @@ MAKEOPTIONS = $(PAR) baseg: - cd ../base/source ; $(MAKE) $(MAKEOPTIONS) libg + cd ../base ; $(MAKE) $(MAKEOPTIONS) libg base: baseg - cd ../base/source ; $(MAKE) $(MAKEOPTIONS) libg lib + cd ../base ; $(MAKE) $(MAKEOPTIONS) libg lib lacg: baseg - cd ../lac/source ; $(MAKE) $(MAKEOPTIONS) libg + cd ../lac ; $(MAKE) $(MAKEOPTIONS) libg lac: base lacg - cd ../lac/source ; $(MAKE) $(MAKEOPTIONS) libg lib + cd ../lac ; $(MAKE) $(MAKEOPTIONS) libg lib 1dg: baseg lacg - cd ../deal.II/source ; $(MAKE) $(MAKEOPTIONS) 1dg + cd ../deal.II ; $(MAKE) $(MAKEOPTIONS) 1dg 2dg: baseg lacg - cd ../deal.II/source ; $(MAKE) $(MAKEOPTIONS) 2dg + cd ../deal.II ; $(MAKE) $(MAKEOPTIONS) 2dg 3dg: baseg lacg - cd ../deal.II/source ; $(MAKE) $(MAKEOPTIONS) 3dg + cd ../deal.II ; $(MAKE) $(MAKEOPTIONS) 3dg 1d: baseg lacg base lac 1dg - cd ../deal.II/source ; $(MAKE) $(MAKEOPTIONS) 1d + cd ../deal.II ; $(MAKE) $(MAKEOPTIONS) 1d 2d: baseg lacg base lac 2dg - cd ../deal.II/source ; $(MAKE) $(MAKEOPTIONS) 2d + cd ../deal.II ; $(MAKE) $(MAKEOPTIONS) 2d 3d: baseg lacg base lac 3dg - cd ../deal.II/source ; $(MAKE) $(MAKEOPTIONS) 3d + cd ../deal.II ; $(MAKE) $(MAKEOPTIONS) 3d all: base lac 2d 1d 3d diff --git a/deal.II/common/scripts/forward_declarations b/deal.II/common/scripts/forward_declarations index 7ab7940174..85c719c600 100644 --- a/deal.II/common/scripts/forward_declarations +++ b/deal.II/common/scripts/forward_declarations @@ -1,43 +1,33 @@ # rule how to make the file containing all the forward declarations # taken from the deal.II Makefile # -# this rule is rather complicated, it works as follows: +# to explain what this rule does: # -# - if this is the outermost 'make', then create a file $@.old. +# - create a file $@.old. # if the forward declaration file $@ already exists, then copy # it over, otherwise leave it empty. this way, we always have # a file to run diff on. send the output of the copy command # (which may fail) to nirvana. # - write the forward declarations for the presently available # header files to $@.new -# - we would like to compare the output of the script generating -# the forward declarations with the old file, or the empty -# string if there is no such file; this is why we created $@.old -# - if the files differ, we would like to copy over the old file. -# - this can either be done using shell programming using 'if [...]' -# or using conditionals inside 'make'. the first way is not -# portable over different shells, however, and I also do not know -# how to write it. the second way has a problem also: conditionals -# are evaluated at the time the Makefile is read first, so we -# can't compare against $@.old, since this file does not exist at -# that time. -# - we therefore invoke a second 'make', which can compare the two -# files against each other in a preconditional clause and -# copy over the file if necessary. +# - compare old and new forward-declarations files. if they +# differ (i.e. the result of 'diff' is a nonzero string) copy +# the nes file over the old one and thus also change the time +# stamp of that file. if they don't differ, then do nothing +# and in particular don't touch the time stamp to avoid that +# 'make' thinks it has to remake all object files # - delete the two temporary files $(forward-declarations): $(filter-out %forward-declarations%,$(h-files)) -ifneq (1,${recursive-make-fwd-decl}) - @echo ============================ Checking $@ + @echo ============================ Remaking $@ @touch $@.old - -@cp $@ $@.old > /dev/null 2>&1 - @perl $D/common/scripts/Make_forward_declarations.pl $(filter-out %forward-declarations.h,$(h-files)) > $@.new - @$(MAKE) --silent recursive-make-fwd-decl=1 $@ + @-cp $@ $@.old > /dev/null 2>&1 + @perl $D/common/scripts/Make_forward_declarations.pl \ + $(filter-out %forward-declarations.h,$(h-files)) \ + > $@.new + @if test -n "`diff $(forward-declarations).old $(forward-declarations).new`" ; then \ + echo "============================ file remade" ; \ + cp $@.new $@ ; \ + else \ + echo "============================ file unchanged" ; \ + fi @rm $@.old $@.new -else - ifneq (,$(shell diff $(forward-declarations).old $(forward-declarations).new)) - @echo ============================ Generating $@ - @cp $@.new $@ - else - @echo "============================ $@ needs no change" - endif -endif diff --git a/deal.II/common/scripts/make_dependencies.pl b/deal.II/common/scripts/make_dependencies.pl new file mode 100644 index 0000000000..ae879bb793 --- /dev/null +++ b/deal.II/common/scripts/make_dependencies.pl @@ -0,0 +1,163 @@ +# $Id$ +# Copyright W. Bangerth, University of Heidelberg, 1998 + + +#Make a dependency file tree +#usage: make_dep -Iinc_path1 -Iinc_path2 ... files + +#This program makes for each of the given files a makefile dependency +#list, also considering nested includes. It only considers included +#files which are located in the given include pathes (you can give any +#number of pathes). The output looks like this: +# +#lib/o/.o-file: file included_files +#lib/go/.go-file: file included_files + +#Author: Wolfgang Bangerth, 1998, 1999 + + + + +# list of include pathes (from command line) +@include_path = (); +# list of files to be checked (from command line) +@input_files = (); +# associate list of files together with the files they include +%include_files = (); + + +# fill include pathes +while ($ARGV[0] =~ /^-I/) { + $_ = shift; + /^-I(.*)/; + $_ = $1; + if (m![^/]$!) { + @include_path = (@include_path, $_ . "/"); + } else { + @include_path = (@include_path, $_); + } +} + +#fill list of files to be processed +while ($ARGV[0]) { + @input_files = (@input_files, shift); +} + + +foreach $file (@input_files) { + make_include_tree ($file); +}; + + +foreach $file (keys %include_files) { + # complete list of included files by nested include files + foreach $include (split(' ',$include_files{$file})) { + complete ($file, $include); + } +} + +# print dependency list +foreach $file (@input_files) { + $file =~ /(.*)\.(cc)/; + + # get filename without path + $basename = $1; + $basename =~ s,^(.*/)?([^/]*),$2,g; + + # write rule for the .o file + print "lib/o/$basename.o:"; + print "\\\n $file"; + foreach $f (split (' ', $include_files{$file})) { + print "\\\n $f"; + } + print "\n"; + + # write rule for the .go file + print "lib/go/$basename.go:"; + print "\\\n $file"; + foreach $f (split (' ', $include_files{$file})) { + print "\\\n $f"; + } + print "\n"; +} + + + + + + + + +# complete the list of included files by the files +# included by a file included by the original one +sub complete { + local ($file, $include) = ($_[0], $_[1]); + foreach $second_include (split(' ',$include_files{$include})) { + if (! ($include_files{$file} =~ $second_include)) { + #second_include not yet in list of included files + $include_files{$file} = + join(' ', $second_include, $include_files{$file}); + complete ($file, $second_include); + } + } +} + + + + +# make the include tree for a file +sub make_include_tree { + local ($filename) = $_[0]; + + open (FILE, $filename); + while () { + # look out for include statements + if (/^#\s*include\s*(["<])([^">]*)[">]/) { + local($include) = $2; + if ($1 =~ /. Try to find real path + for $include_dir (@include_path) { + $if = $include_dir . $include; + if (-r $if) { + # file found; delete ./ at beginning + if ($if =~ m!^\./(.*)!) { + $if = $1; + } + $include_files{$filename} = + join (' ', $if, $include_files{$filename}); + } + } + } else { + # included by "..." + # only append file if it exists or can be found + + # first find out the path of the present file + # and then join the path to the included one + if ($filename =~ /\//){ + $path = $filename; + # strip filename, leave path + $path =~ s!/[^/]*$!/!g; + } + else + { + $path = "./"; + } + + $include = $path . $include; + + if (-r $include) { + $include_files{$filename} = + join (' ', $include, $include_files{$filename}); + } + } + } + } + + # for each file included here: make up include tree itself + for $if (split(/ /,$include_files{$filename})) { + # if include file list not yet made up + if (! defined ($include_files{$if})) { + make_include_tree($if); + } + } +} diff --git a/deal.II/deal.II/Makefile b/deal.II/deal.II/Makefile index 97a0eb3fb5..c5de7dd754 100644 --- a/deal.II/deal.II/Makefile +++ b/deal.II/deal.II/Makefile @@ -1,31 +1,151 @@ # $Id$ -# Copyright W. Bangerth, University of Heidelberg, 1998 +# Copyright W. Bangerth, University of Heidelberg, 1998, 1999 -all: deal.II examples +# deal.II top level directory +D=.. -clean: source-clean examples-clean lib-clean +# top level targets +default: 2dg 2d -deal.II: - cd source ; $(MAKE) +1dg: lib/libdeal_II_2d.g.a +1d :lib/libdeal_II_2d.a +2dg: lib/libdeal_II_2d.g.a +2d :lib/libdeal_II_2d.a +3dg: lib/libdeal_II_2d.g.a +3d :lib/libdeal_II_2d.a + + +# create lists of file names. note that we need several output +# files for data_out_base.cc, which is why we use the several +# intermediate o-files-base* rules +cc-files = $(shell echo source/*/*.cc) +h-files = $(shell echo include/*/*.h) + +forward-declarations = $D/deal.II/include/basic/forward-declarations.h + + +# strip subdirectories from cc file names, preprend a "lib/[g]o" +# and change the suffix. We place the object files with or without +# debug info in different directories, since we want to use the +# -frepo switch to gcc; this, however, creates a .rpo file which +# would be the same for both debug and non-debug versions, if we +# don't care about different directories +tmp1 = $(notdir $(cc-files)) +o-files-1d = $(addprefix lib/1d/o/, $(tmp1:.cc=_1d.o) ) +go-files-1d = $(addprefix lib/1d/go/, $(tmp1:.cc=_1d.go)) +o-files-2d = $(addprefix lib/2d/o/, $(tmp1:.cc=_2d.o) ) +go-files-2d = $(addprefix lib/2d/go/, $(tmp1:.cc=_2d.go)) +o-files-3d = $(addprefix lib/3d/o/, $(tmp1:.cc=_3d.o) ) +go-files-3d = $(addprefix lib/3d/go/, $(tmp1:.cc=_3d.go)) + +o-files = $(o-files-1d) $(o-files-2d) $(o-files-3d) +go-files = $(go-files-1d) $(go-files-2d) $(go-files-3d) + +# get options which hold for all files of the project +include $D/common/Make.global_options + + +# rules how to generate object files from source files. note that +# there are some files which needs exceptional rules; these are +# listed immediately below +lib/1d/go/%.go : + @echo ==============1d======debug============= $(<:source/%=%) + @$(CXX) $(CXXFLAGS) $(CXXFLAGS.g) -Ddeal_II_dimension=1 -c $< -o $@ +lib/1d/o/%.o : + @echo ==============1d======optimized========= $(<:source/%=%) + @$(CXX) $(CXXFLAGS) $(CXXFLAGS.o) -Ddeal_II_dimension=1 -c $< -o $@ + +lib/2d/go/%.go : + @echo ==============2d======debug============= $(<:source/%=%) + @$(CXX) $(CXXFLAGS) $(CXXFLAGS.g) -Ddeal_II_dimension=2 -c $< -o $@ +lib/2d/o/%.o : + @echo ==============2d======optimized========= $(<:source/%=%) + @$(CXX) $(CXXFLAGS) $(CXXFLAGS.o) -Ddeal_II_dimension=2 -c $< -o $@ + +lib/3d/go/%.go : + @echo ==============3d======debug============= $(<:source/%=%) + @$(CXX) $(CXXFLAGS) $(CXXFLAGS.g) -Ddeal_II_dimension=3 -c $< -o $@ +lib/3d/o/%.o : + @echo ==============3d======optimized========= $(<:source/%=%) + @$(CXX) $(CXXFLAGS) $(CXXFLAGS.o) -Ddeal_II_dimension=3 -c $< -o $@ + +# special rules for exceptional files +lib/3d/o/q1_mapping_jacobians_3d.o: + @echo "==============3d======opt==(special)====" $(<:source/%=%) + @$(CXX) $(CXXFLAGS) $(filter-out -O2 -Wuninitialized,$(CXXFLAGS.o)) -Ddeal_II_dimension=3 -c $< -o $@ + + +# rules how to make the libraries themselves +lib/libdeal_II_1d.g.a: $(go-files-1d) + @echo ======================================== Updating library: $(@F) + @ar ruv $@ $(go-files-1d) +lib/libdeal_II_1d.a: $(o-files-1d) + @echo ======================================== Updating library: $(@F) + @ar ruv $@ $(o-files-1d) + +lib/libdeal_II_2d.g.a: $(go-files-2d) + @echo ======================================== Updating library: $(@F) + @ar ruv $@ $(go-files-2d) +lib/libdeal_II_2d.a: $(o-files-2d) + @echo ======================================== Updating library: $(@F) + @ar ruv $@ $(o-files-2d) + +lib/libdeal_II_3d.g.a: $(go-files-3d) + @echo ======================================== Updating library: $(@F) + @ar ruv $@ $(go-files-3d) +lib/libdeal_II_3d.a: $(o-files-3d) + @echo ======================================== Updating library: $(@F) + @ar ruv $@ $(o-files-3d) + + + +#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. +lib/Makefile.dep: $(cc-files) $(forward-declarations) $(h-files) Makefile + @echo ============================ Remaking Makefile + @perl $D/common/scripts/Make_dep_2.pl $(INCLUDE) $(cc-files) \ + | perl -p -e 's!^lib/(g?o/.*):!lib/DIM_PLACEHOLDER/$$1:!g;' \ + | perl -pe 's!(\.g?o):!_DIM_PLACEHOLDER$$1:!g;' \ + | perl -pe 's!^lib/DIM_PLACEHOLDER/(.*):!lib/1d/$$1 lib/2d/$$1 lib/3d/$$1:!g;'\ + | perl -pe 's!(lib/1d/[^ ]+)_DIM_PLACEHOLDER!$$1_1d!g;' \ + | perl -pe 's!(lib/2d/[^ ]+)_DIM_PLACEHOLDER!$$1_2d!g;' \ + | perl -pe 's!(lib/3d/[^ ]+)_DIM_PLACEHOLDER!$$1_3d!g;' \ + > lib/Makefile.dep + +# include all the dependencies +include lib/Makefile.dep + +# include a rule which tells how to remake the forward declarations file +include $D/common/Makescripts/forward_declarations + + + + +################### an additional rule for the examples examples: cd examples ; $(MAKE) + + +################### some clean-up rules + +clean: examples-clean lib-clean + lib-clean: - -rm -f *~ include/*~ include/*/*~ include/basic/forward-declarations.h* + -rm -f *~ */*~ */*/*~ include/basic/forward-declarations.h* cd lib ; $(MAKE) clean examples-clean: cd examples ; $(MAKE) clean -source-clean: - cd source ; $(MAKE) clean - -TAGS: - etags include/*/*.h source/*/*.cc - +################### .PHONY: all deal.II examples TAGS .PHONY: clean lib-clean examples-clean source-clean +.PHONY: default 1d 2d 3d all clean diff --git a/deal.II/deal.II/source/Makefile b/deal.II/deal.II/source/Makefile deleted file mode 100644 index 7d90422931..0000000000 --- a/deal.II/deal.II/source/Makefile +++ /dev/null @@ -1,191 +0,0 @@ -# $Id$ -# Copyright W. Bangerth, University of Heidelberg, 1998 - -#this file uses many small rules to allow -# make -j -#on multiprocessor machines. Feel free to use this feature, -#it gives you quicker compile time and annoys those FEATFLOW -#people ;-) -# -#I think I have removed any non-supported cross-references, so you -#should be able to compile with an arbitrary number of processes. - -D=../.. - -cc-files = $(shell echo */*.cc) -h-files = $(shell echo ../include/*/*.h) - -forward-declarations = $D/deal.II/include/basic/forward-declarations.h - -include $D/common/Make.global_options - - - - -# strip subdirectories from cc file names, preprend a "../lib/[g]o" -# and change the suffix. We place the object files with or without -# debug info in different directories, since we want to use the -# -frepo switch to gcc; this, however, creates a .rpo file which -# would be the same for both debug and non-debug versions, if we -# don't care about different directories -tmp1 = $(notdir $(cc-files)) -o-files-1d = $(addprefix ../lib/1d/o/, $(tmp1:.cc=_1d.o) ) -go-files-1d = $(addprefix ../lib/1d/go/, $(tmp1:.cc=_1d.go)) -o-files-2d = $(addprefix ../lib/2d/o/, $(tmp1:.cc=_2d.o) ) -go-files-2d = $(addprefix ../lib/2d/go/, $(tmp1:.cc=_2d.go)) -o-files-3d = $(addprefix ../lib/3d/o/, $(tmp1:.cc=_3d.o) ) -go-files-3d = $(addprefix ../lib/3d/go/, $(tmp1:.cc=_3d.go)) - - - - - -default: 2d -all: 1d 2d 3d - -1d: ../lib/libdeal_II_1d.g.a ../lib/libdeal_II_1d.a - -2d: ../lib/libdeal_II_2d.g.a ../lib/libdeal_II_2d.a - -3d: ../lib/libdeal_II_3d.g.a ../lib/libdeal_II_3d.a - -# Debug version only - -debug: 2dg 1dg 3dg - -1dg: ../lib/libdeal_II_1d.g.a -2dg: ../lib/libdeal_II_2d.g.a -3dg: ../lib/libdeal_II_3d.g.a - - -# rules how to generate object files from source files. note that -# there are some files which needs exceptional rules; these are -# listed immediately below -../lib/1d/go/%.go : - @echo ==============1d======debug============= $< - @$(CXX) $(CXXFLAGS) $(CXXFLAGS.g) -Ddeal_II_dimension=1 -c $< -o $@ -../lib/1d/o/%.o : - @echo ==============1d======optimized========= $< - @$(CXX) $(CXXFLAGS) $(CXXFLAGS.o) -Ddeal_II_dimension=1 -c $< -o $@ - -../lib/2d/go/%.go : - @echo ==============2d======debug============= $< - @$(CXX) $(CXXFLAGS) $(CXXFLAGS.g) -Ddeal_II_dimension=2 -c $< -o $@ -../lib/2d/o/%.o : - @echo ==============2d======optimized========= $< - @$(CXX) $(CXXFLAGS) $(CXXFLAGS.o) -Ddeal_II_dimension=2 -c $< -o $@ - -../lib/3d/go/%.go : - @echo ==============3d======debug============= $< - @$(CXX) $(CXXFLAGS) $(CXXFLAGS.g) -Ddeal_II_dimension=3 -c $< -o $@ -../lib/3d/o/%.o : - @echo ==============3d======optimized========= $< - @$(CXX) $(CXXFLAGS) $(CXXFLAGS.o) -Ddeal_II_dimension=3 -c $< -o $@ - -# special rules for exceptional files -../lib/3d/o/q1_mapping_jacobians_3d.o: - @echo "==============3d======opt==(special)====" $< - @$(CXX) $(CXXFLAGS) $(filter-out -O2 -Wuninitialized,$(CXXFLAGS.o)) -Ddeal_II_dimension=3 -c $< -o $@ - - - -# rules how to make the libraries themselves -../lib/libdeal_II_1d.g.a: $(go-files-1d) - @echo ======================================== Updating library: $@ - @ar ruv $@ $(go-files-1d) -../lib/libdeal_II_1d.a: $(o-files-1d) - @echo ======================================== Updating library: $@ - @ar ruv $@ $(o-files-1d) - -../lib/libdeal_II_2d.g.a: $(go-files-2d) - @echo ======================================== Updating library: $@ - @ar ruv $@ $(go-files-2d) -../lib/libdeal_II_2d.a: $(o-files-2d) - @echo ======================================== Updating library: $@ - @ar ruv $@ $(o-files-2d) - -../lib/libdeal_II_3d.g.a: $(go-files-3d) - @echo ======================================== Updating library: $@ - @ar ruv $@ $(go-files-3d) -../lib/libdeal_II_3d.a: $(o-files-3d) - @echo ======================================== Updating library: $@ - @ar ruv $@ $(o-files-3d) - - -clean: - @cd basic ; rm -f *.o *.go *~ - @cd grid ; rm -f *.o *.go *~ - @cd fe ; rm -f *.o *.go *~ - @cd numerics; rm -f *.o *.go *~ - - - -.PHONY: default 1d 2d 3d all 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. -# -#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 libgrid.a(tria.o) -# -#Later addition: the perl script was made to compile -#right into a library. Since this is not what we want -#anymore, but since 1) I am too lazy to change the -#script and 2) others may use the script as it was, -#we don't change the script but rather pipe its -#result through another perl script to get what we -#want. -# -#Next addition: replace .g?o by _2d.g?o or whatever -#the dimension is, because we want to have unique -#object file names in the libraries in order to write -#programs which use the 2d *and* the 3d library; -#if the files within these libraries had the same names, -#we may get into trouble. -# -# -#additional clue: if the forward declarations file does -#not exist, then the script generating the dependencies -#will not find it and will not print it into the dependencies. -#but then also 'make' will not know that it needs to be -#generated before compilation of files start, which leads -#to a cpp error. we therefore have to make sure the forward -#declaration file exists before we even start to build the -#dependencies; since it will not be in the $(h-files) in the -#critical case, we need to add it by hand. next problem: -#the generation of the forward declarations requires a -#nested call to 'make', which would then rebuild the -#Makefile.dep, which this rule won't see, so we end up -#generating it twice. therefore: do nothing if in a nested -#make -../lib/Makefile.dep: $(cc-files) $(h-files) $(forward-declarations) Makefile ../../common/Make.global_options -ifneq (1,${recursive-make-fwd-decl}) - @echo ============================ Remaking Makefile - @echo "# This Makefile was automatically generated by ../source/Makefile" \ - > ../lib/Makefile.dep - @echo "# See there for more information." >> ../lib/Makefile.dep - @perl $D/common/scripts/Make_dep.pl ../lib/libgrid $(INCLUDE) $(cc-files) \ - | perl -p -e 's!^.*\(.*/(.*)\):!../lib/DIM_PLACEHOLDER/$$1:!g;' \ - | perl -pe 's!(/[^/]+\.(o|go)):!/$$2$$1:!g;' \ - | perl -pe 's!(\.g?o)!_DIM_PLACEHOLDER$$1!g;' \ - | perl -pe 's!^\.\./lib/DIM_PLACEHOLDER/(.*):!../lib/1d/$$1 ../lib/2d/$$1 ../lib/3d/$$1:!g;' \ - | perl -pe 's!(\.\./lib/1d/[^ ]+)_DIM_PLACEHOLDER!$$1_1d!g;' \ - | perl -pe 's!(\.\./lib/2d/[^ ]+)_DIM_PLACEHOLDER!$$1_2d!g;' \ - | perl -pe 's!(\.\./lib/3d/[^ ]+)_DIM_PLACEHOLDER!$$1_3d!g;' \ - >> ../lib/Makefile.dep - @echo ============================ Done -else - @echo ============================ Not remaking Makefile since in nested mode -endif - - -include ../lib/Makefile.dep - -include $D/common/Makescripts/forward_declarations - - diff --git a/deal.II/lac/Makefile b/deal.II/lac/Makefile index 49f8825621..db3a497da9 100644 --- a/deal.II/lac/Makefile +++ b/deal.II/lac/Makefile @@ -1,17 +1,71 @@ # $Id$ +# Copyright W. Bangerth, University of Heidelberg, 1998, 1999 -all: lac +# deal.II top level directory +D=.. -clean: source-clean - rm -f *~ include/*~ include/*/*~ lib/lib* lib/o/*.o lib/go/*.go lib/Makefile.dep include/lac/forward-declarations.h* -lac: - cd source ; $(MAKE) +# create lists of file names. note that we need several output +# files for data_out_base.cc, which is why we use the several +# intermediate o-files-base* rules +cc-files = $(shell echo source/*.cc) +o-files-base1= $(addprefix lib/o/, $(patsubst source/%,%,$(cc-files:.cc=.o))) +o-files-base2= $(filter-out %data_out_base.o, $(o-files-base1)) +o-files-base3= $(sort $(o-files-base2)) +o-files = $(o-files-base3) +go-files = $(patsubst lib/o/%,lib/go/%,$(o-files-base3:.o=.go)) +h-files = $(shell echo include/lac/*.h) -source-clean: - cd source ; $(MAKE) clean +forward-declarations = $D/lac/include/lac/forward-declarations.h +# get options which hold for all files of the project +include $D/common/Make.global_options -.PHONY: all -.PHONY: clean source-clean + +# production rules +lib/go/%.go : + @echo =================== Compiling with debugging information: $( lib/Makefile.dep + +# include all the dependencies +include lib/Makefile.dep + +# include a rule which tells how to remake the forward declarations file +include $D/common/Makescripts/forward_declarations + + +.PHONY: clean +.PHONY: lib lib.a lib.g.a diff --git a/deal.II/lac/source/Makefile b/deal.II/lac/source/Makefile deleted file mode 100644 index e2e965daf2..0000000000 --- a/deal.II/lac/source/Makefile +++ /dev/null @@ -1,66 +0,0 @@ -# $Id$ - -D=../.. - -cc-files = $(shell echo *.cc) -o-files = $(addprefix ../lib/o/, $(cc-files:.cc=.o)) -go-files = $(addprefix ../lib/go/, $(cc-files:.cc=.go)) -h-files = $(shell echo ../include/*/*.h) - -forward-declarations = $D/lac/include/lac/forward-declarations.h - -include $D/common/Make.global_options - - -../lib/go/%.go : - @echo ============================ Compiling with debugging information: $< - @$(CXX) $(CXXFLAGS) $(CXXFLAGS.g) -c $< -o $@ -../lib/o/%.o : - @echo ============================ Compiling with optimization: $< - @$(CXX) $(CXXFLAGS) $(CXXFLAGS.o) -c $< -o $@ - - -lib: ../lib/liblac.g.a ../lib/liblac.a -libg: ../lib/liblac.g.a - -../lib/liblac.a: $(forward-declarations) $(o-files) - @echo ======================================== Updating library: $@ - @ar ruv $@ $(o-files) - -../lib/liblac.g.a: $(forward-declarations) $(go-files) - @echo ======================================== Updating library: $@ - @ar ruv $@ $(go-files) - -clean: - rm -f ../lib/o/*.o ../lib/o/*.go *~ Makefile.dep ../lib/lib* - - - - - -.PHONY: lib lib.a lib.g.a 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. -# -#see the Makefile of the deal.II directory for a thorough -#description of what happens here -../lib/Makefile.dep: $(cc-files) $(forward-declarations) $(h-files) Makefile -ifneq (1,${recursive-make-fwd-decl}) - @echo ============================ Remaking Makefile - @perl $D/common/scripts/Make_dep.pl ../lib/liblac $(INCLUDE) $(cc-files) \ - | perl -p -e 's!^.*\((.*\.(g?o))\):!../lib/$$2/$$1:!g;' \ - > ../lib/Makefile.dep -else - @echo ============================ Not remaking Makefile since in nested mode -endif - - -include ../lib/Makefile.dep - -include $D/common/Makescripts/forward_declarations - -- 2.39.5