File: Makefile

package info (click to toggle)
deal.ii 6.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 130,276 kB
  • ctags: 254,694
  • sloc: cpp: 664,750; ansic: 30,376; sh: 3,290; makefile: 3,152; perl: 1,046; asm: 802; fortran: 801; lisp: 84; pascal: 71
file content (241 lines) | stat: -rw-r--r-- 9,115 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# $Id: Makefile 21470 2010-07-11 23:20:30Z bangerth $
# Copyright W. Bangerth, University of Heidelberg, 1998, 1999, 2000, 2001, 2002


# deal.II top level directory
D=..


# get options which hold for all files of the project
include $D/common/Make.global_options



# top level targets
default: 2dg 2d
all: 2dg 2d 3dg 3d 1dg 1d
debug: 2dg 3dg 1dg


1dg: $(LIBDIR)/libdeal_II_1d.g$(lib-suffix)
1d : $(LIBDIR)/libdeal_II_1d$(lib-suffix)
2dg: $(LIBDIR)/libdeal_II_2d.g$(lib-suffix)
2d : $(LIBDIR)/libdeal_II_2d$(lib-suffix)
3dg: $(LIBDIR)/libdeal_II_3d.g$(lib-suffix)
3d : $(LIBDIR)/libdeal_II_3d$(lib-suffix)

# create lists of file names. compile vectors.cc first because it is
# one of the files that takes the longest
cc-files     = $D/deal.II/source/numerics/vectors.cc \
               $(filter-out $D/deal.II/source/numerics/vectors.cc, $(shell echo $D/deal.II/source/*/*.cc))
h-files      = $(sort $(shell echo include/*/*.h))

inst-in-files= $(shell echo source/*/*.inst.in)
inst-files   = $(inst-in-files:%.in=%)


# replace subdirectories in cc file names by a prefix, preprend a "lib/[g]o"
# and change the suffix
tmp1        = $(shell echo $(cc-files) | $(PERL) -pi -e 's,$D/deal.II/source/,,g; s,/,_,g;')
o-files-1d  = $(addprefix $(LIBDIR)/1d/, $(tmp1:.cc=_1d.$(OBJEXT)) )
go-files-1d = $(addprefix $(LIBDIR)/1d/, $(tmp1:.cc=_1d.g.$(OBJEXT)))
o-files-2d  = $(addprefix $(LIBDIR)/2d/, $(tmp1:.cc=_2d.$(OBJEXT)) )
go-files-2d = $(addprefix $(LIBDIR)/2d/, $(tmp1:.cc=_2d.g.$(OBJEXT)))
o-files-3d  = $(addprefix $(LIBDIR)/3d/, $(tmp1:.cc=_3d.$(OBJEXT)) )
go-files-3d = $(addprefix $(LIBDIR)/3d/, $(tmp1:.cc=_3d.g.$(OBJEXT)))

o-files  = $(o-files-1d)  $(o-files-2d)  $(o-files-3d)
go-files = $(go-files-1d) $(go-files-2d) $(go-files-3d)


# rules how to generate object files from source files. note that
# there are some files which needs exceptional rules; these are
# listed immediately below
$(LIBDIR)/1d/%.g.$(OBJEXT) :
	@mkdir -p $(LIBDIR)/1d
	@echo "=====deal.II====1d====debug======$(MT)== $(<:$D/deal.II/source/%=%)"
	@$(CXX) $(CXXFLAGS.g) -Ddeal_II_dimension=1 -c $< -o $@
$(LIBDIR)/1d/%.$(OBJEXT) :
	@mkdir -p $(LIBDIR)/1d
	@echo "=====deal.II====1d====optimized==$(MT)== $(<:$D/deal.II/source/%=%)"
	@$(CXX) $(CXXFLAGS.o) -Ddeal_II_dimension=1 -c $< -o $@

$(LIBDIR)/2d/%.g.$(OBJEXT) :
	@mkdir -p $(LIBDIR)/2d
	@echo "=====deal.II====2d====debug======$(MT)== $(<:$D/deal.II/source/%=%)"
	@$(CXX) $(CXXFLAGS.g) -Ddeal_II_dimension=2 -c $< -o $@
$(LIBDIR)/2d/%.$(OBJEXT) :
	@mkdir -p $(LIBDIR)/2d
	@echo "=====deal.II====2d====optimized==$(MT)== $(<:$D/deal.II/source/%=%)"
	@$(CXX) $(CXXFLAGS.o) -Ddeal_II_dimension=2 -c $< -o $@

$(LIBDIR)/3d/%.g.$(OBJEXT) :
	@mkdir -p $(LIBDIR)/3d
	@echo "=====deal.II====3d====debug======$(MT)== $(<:$D/deal.II/source/%=%)"
	@$(CXX) $(CXXFLAGS.g) -Ddeal_II_dimension=3 -c $< -o $@
$(LIBDIR)/3d/%.$(OBJEXT) :
	@mkdir -p $(LIBDIR)/3d
	@echo "=====deal.II====3d====optimized==$(MT)== $(<:$D/deal.II/source/%=%)"
	@$(CXX) $(CXXFLAGS.o) -Ddeal_II_dimension=3 -c $< -o $@

source/%.inst : source/%.inst.in $D/common/template-arguments
	@echo "=====deal.II========================= $(@F)"
	@$D/common/scripts/expand_instantiations $D/common/template-arguments < $< > $@



# in general, when linking shared libraries, we will want to link with
# the underlying libs as well. AIX even requires this. on the other
# hand, on DEC OSF with CXX this will fail with duplicate symbols, so
# make sure that it doesn't happen on that system and that compiler
ifneq ($(GXX-VERSION),compaq_cxx)
  deplibs.g = $(lib-lac.g) $(lib-base.g)
  deplibs.o = $(lib-lac.o) $(lib-base.o)

  # if we use HSL, then we need to link against libhsl.so.
  ifeq ($(USE_CONTRIB_HSL),yes)
    deplibs.g += $(lib-contrib-hsl)
    deplibs.o += $(lib-contrib-hsl)
  endif

  # same with PETSC
  ifeq ($(USE_CONTRIB_PETSC),yes)
    deplibs.g += $(lib-contrib-petsc.g)
    deplibs.o += $(lib-contrib-petsc.o)
  endif

  # same with SLEPC
  ifeq ($(USE_CONTRIB_SLEPC),yes)
    deplibs.g += $(lib-contrib-slepc)
    deplibs.o += $(lib-contrib-slepc)
  endif

  # same with MUMPS
  ifeq ($(USE_CONTRIB_MUMPS),yes)
    deplibs.g += $(lib-contrib-mumps)
    deplibs.o += $(lib-contrib-mumps)
  endif

  # and METIS
  ifeq ($(USE_CONTRIB_METIS),yes)
    deplibs.g += $(lib-contrib-metis)
    deplibs.o += $(lib-contrib-metis)
  endif

  # for cygwin and darwin, also llapack and such are necessary
  # we better link all libraries mentioned in $(LIBS)
  ifneq ($(findstring cygwin,$(TARGET))$(findstring darwin,$(TARGET)),)
    deplibs.g += $(LIBS)
    deplibs.o += $(LIBS)
  endif

else
  deplibs.g =
  deplibs.o =
endif



# rules how to make the libraries themselves
$(LIBDIR)/libdeal_II_1d.g$(static-lib-suffix): $(go-files-1d)
	@echo "=====deal.II====1d====debug======$(MT)== Linking library:   $(@F)"
	@$(AR) ru $@ $(go-files-1d)
	@$(RANLIB) $@
$(LIBDIR)/libdeal_II_1d$(static-lib-suffix): $(o-files-1d)
	@echo "=====deal.II====1d====optimized==$(MT)== Linking library:   $(@F)"
	@$(AR) ru $@ $(o-files-1d)
	@$(RANLIB) $@


$(LIBDIR)/libdeal_II_2d.g$(static-lib-suffix): $(go-files-2d)
	@echo "=====deal.II====2d====debug======$(MT)== Linking library:   $(@F)"
	@$(AR) ru $@ $(go-files-2d)
	@$(RANLIB) $@
$(LIBDIR)/libdeal_II_2d$(static-lib-suffix): $(o-files-2d)
	@echo "=====deal.II====2d====optimized==$(MT)== Linking library:   $(@F)"
	@$(AR) ru $@ $(o-files-2d)
	@$(RANLIB) $@


$(LIBDIR)/libdeal_II_3d.g$(static-lib-suffix): $(go-files-3d)
	@echo "=====deal.II====3d====debug======$(MT)== Linking library:   $(@F)"
	@$(AR) ru $@ $(go-files-3d)
	@$(RANLIB) $@
$(LIBDIR)/libdeal_II_3d$(static-lib-suffix): $(o-files-3d)
	@echo "=====deal.II====3d====optimized==$(MT)== Linking library:   $(@F)"
	@$(AR) ru $@ $(o-files-3d)
	@$(RANLIB) $@


$(LIBDIR)/libdeal_II_1d.g$(shared-lib-suffix): $(go-files-1d)
	@echo "=====deal.II====1d====debug======$(MT)== Linking library:   $(@F)"
	@$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $(LIBDIR)/$(call DEAL_II_SHLIB_NAME,deal_II_1d.g) $(call DEAL_II_ADD_SONAME,deal_II_1d.g) $(go-files-1d) $(deplibs.g)
	@ln -f -s $(call DEAL_II_SHLIB_NAME,deal_II_1d.g) $@

$(LIBDIR)/libdeal_II_1d$(shared-lib-suffix): $(o-files-1d)
	@echo "=====deal.II====1d====optimized==$(MT)== Linking library:   $(@F)"
	@$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $(LIBDIR)/$(call DEAL_II_SHLIB_NAME,deal_II_1d) $(call DEAL_II_ADD_SONAME,deal_II_1d) $(o-files-1d) $(deplibs.o)
	@ln -f -s $(call DEAL_II_SHLIB_NAME,deal_II_1d) $@


$(LIBDIR)/libdeal_II_2d.g$(shared-lib-suffix): $(go-files-2d)
	@echo "=====deal.II====2d====debug======$(MT)== Linking library:   $(@F)"
	@$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $(LIBDIR)/$(call DEAL_II_SHLIB_NAME,deal_II_2d.g) $(call DEAL_II_ADD_SONAME,deal_II_2d.g) $(go-files-2d) $(deplibs.g)
	@ln -f -s $(call DEAL_II_SHLIB_NAME,deal_II_2d.g) $@

$(LIBDIR)/libdeal_II_2d$(shared-lib-suffix): $(o-files-2d)
	@echo "=====deal.II====2d====optimized==$(MT)== Linking library:   $(@F)"
	@$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $(LIBDIR)/$(call DEAL_II_SHLIB_NAME,deal_II_2d) $(call DEAL_II_ADD_SONAME,deal_II_2d) $(o-files-2d) $(deplibs.o)
	@ln -f -s $(call DEAL_II_SHLIB_NAME,deal_II_2d) $@


$(LIBDIR)/libdeal_II_3d.g$(shared-lib-suffix): $(go-files-3d)
	@echo "=====deal.II====3d====debug======$(MT)== Linking library:   $(@F)"
	@$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $(LIBDIR)/$(call DEAL_II_SHLIB_NAME,deal_II_3d.g) $(call DEAL_II_ADD_SONAME,deal_II_3d.g) $(go-files-3d) $(deplibs.g)
	@ln -f -s $(call DEAL_II_SHLIB_NAME,deal_II_3d.g) $@

$(LIBDIR)/libdeal_II_3d$(shared-lib-suffix): $(o-files-3d)
	@echo "=====deal.II====3d====optimized==$(MT)== Linking library:   $(@F)"
	@$(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $(LIBDIR)/$(call DEAL_II_SHLIB_NAME,deal_II_3d) $(call DEAL_II_ADD_SONAME,deal_II_3d) $(o-files-3d) $(deplibs.o)
	@ln -f -s $(call DEAL_II_SHLIB_NAME,deal_II_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.
#
# If the command fails, then remove Makefile.dep again and fail
Makefile.dep: $(cc-files) $(h-files) \
		$(inst-files) \
		Makefile $D/common/Make.global_options
	@echo "===================================== Remaking deal.II/Makefile"
	@(for dir in dofs fe grid hp multigrid numerics ; do \
		$D/common/scripts/make_dependencies $(INCLUDE) "-B\$$(LIBDIR)" `echo $D/deal.II/source/$$dir/*cc` \
		| $(PERL) -p -e 's!LIBDIR\)/(.*):!LIBDIR)/DIM_PLACEHOLDER/$$1:!g;' \
		| $(PERL) -pe 's!((\.g)?.$(OBJEXT)):!_DIM_PLACEHOLDER$$1:!g;' \
	        | $(PERL) -pe 's!^(.*)/DIM_PLACEHOLDER/(.*)_DIM_PLACEHOLDER(\..*):!$$1/1d/DIRPLACEHOLDER_$$2_1d$$3 $$1/2d/DIRPLACEHOLDER_$$2_2d$$3 $$1/3d/DIRPLACEHOLDER_$$2_3d$$3:!g;'\
		| $(PERL) -pe "s/DIRPLACEHOLDER/$$dir/g;" \
		; done ) > $@ \
	 || (rm -f $@ ; false)


# include all the dependencies
include Makefile.dep




################### some clean-up rules

clean:
	-rm -f *~ */*~ */*/*~ Makefile.dep source/*/*.inst


###################

.PHONY: all deal.II TAGS
.PHONY: clean
.PHONY: default 1d 2d 3d all