#I think I have removed any non-supported cross-references, so you
#should be able to compile with an arbitrary number of processes.
-deal_II_dimension=2
cc-files = $(wildcard */*.cc)
# -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 = $(addprefix ../lib/$(deal_II_dimension)d/o/, $(tmp1:.cc=_$(deal_II_dimension)d.o) )
-go-files = $(addprefix ../lib/$(deal_II_dimension)d/go/, $(tmp1:.cc=_$(deal_II_dimension)d.go))
+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))
CXX = c++
-I../../base/include -I../../mia/include
CXXFLAGS.g= -DDEBUG -g -Wall -W -pedantic -Wconversion \
-Winline -Woverloaded-virtual \
- $(INCLUDE) -Ddeal_II_dimension=$(deal_II_dimension)
+ $(INCLUDE)
CXXFLAGS =-O3 -Wuninitialized -finline-functions -ffast-math \
-felide-constructors -fnonnull-objects \
- $(INCLUDE) \
- -Ddeal_II_dimension=$(deal_II_dimension)
+ $(INCLUDE)
-%.go :
- @echo ==============$(deal_II_dimension)d======debug============= $<
- @$(CXX) $(CXXFLAGS.g) -c $< -o $@
-%.o :
- @echo ==============$(deal_II_dimension)d======optimized========= $<
- @$(CXX) $(CXXFLAGS) -c $< -o $@
+../lib/1d/go/%.go :
+ @echo ==============1d======debug============= $<
+ @$(CXX) $(CXXFLAGS.g) -Ddeal_II_dimension=1 -c $< -o $@
+../lib/1d/o/%.o :
+ @echo ==============1d======optimized========= $<
+ @$(CXX) $(CXXFLAGS) -Ddeal_II_dimension=1 -c $< -o $@
+../lib/2d/go/%.go :
+ @echo ==============2d======debug============= $<
+ @$(CXX) $(CXXFLAGS.g) -Ddeal_II_dimension=2 -c $< -o $@
+../lib/2d/o/%.o :
+ @echo ==============2d======optimized========= $<
+ @$(CXX) $(CXXFLAGS) -Ddeal_II_dimension=2 -c $< -o $@
+../lib/3d/go/%.go :
+ @echo ==============3d======debug============= $<
+ @$(CXX) $(CXXFLAGS.g) -Ddeal_II_dimension=3 -c $< -o $@
+../lib/3d/o/%.o :
+ @echo ==============3d======optimized========= $<
+ @$(CXX) $(CXXFLAGS) -Ddeal_II_dimension=3 -c $< -o $@
-all: ../lib/libdeal_II.g.a ../lib/libdeal_II.a
+default: 2d
+all: 1d 2d 3d
-../lib/libdeal_II.g.a: $(go-files)
- @echo ============================ Updating library: $@
- @ar ruv $@ $(go-files)
+1d: ../lib/libdeal_II_1d.g.a ../lib/libdeal_II_1d.a
-../lib/libdeal_II.a: $(o-files)
- @echo ============================ Updating library: $@
- @ar ruv $@ $(o-files)
+2d: ../lib/libdeal_II_2d.g.a ../lib/libdeal_II_2d.a
+
+3d: ../lib/libdeal_II_3d.g.a ../lib/libdeal_II_3d.a
+
+
+
+../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:
-.PHONY: all clean
+.PHONY: default 1d 2d 3d all clean
#Rule to generate the dependency file. This file is
#programs which use the 2d *and* the 3d library;
#if the files within these libraries had the same names,
#we may get into trouble.
-../lib/Makefile_$(deal_II_dimension)d.dep: $(cc-files) $(h-files) Makefile ../Make.global_options
+../lib/Makefile.dep: $(cc-files) $(h-files) Makefile ../Make.global_options
@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 ../Make_dep.pl ../lib/libgrid $(INCLUDE) $(cc-files) \
- | perl -p -e 's!^.*\(.*/(.*)\):!../lib/$(deal_II_dimension)d/$$1:!g;' \
+ | perl -p -e 's!^.*\(.*/(.*)\):!../lib/DIM_PLACEHOLDER/$$1:!g;' \
| perl -pe 's!(/[^/]+\.(o|go)):!/$$2$$1:!g;' \
- | perl -pe 's!(\.g?o)!_$(deal_II_dimension)d$$1!g;' \
- >> ../lib/Makefile_$(deal_II_dimension)d.dep
+ | 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 the dependency file if a dimension was specified. If not, we
-#don't start a compiler run, so we need not include dependencies anyway.
-ifneq "$(deal_II_dimension)" ""
-include ../lib/Makefile_$(deal_II_dimension)d.dep
-endif
+include ../lib/Makefile.dep