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 (160 lines) | stat: -rw-r--r-- 5,310 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
# $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


# create lists of file names
cc-files     = $(shell echo $D/lac/source/*.cc)
o-files-base = $(sort $(addprefix $(LIBDIR)/lac/, $(patsubst $D/lac/source/%,%,$(cc-files:.cc=.$(OBJEXT)))))
o-files      = $(o-files-base)
go-files     = $(o-files-base:.$(OBJEXT)=.g.$(OBJEXT))
h-files      = $(sort $(shell echo include/lac/*.h))

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

# if umfpack was configured, simply link all the umfpack files into liblac.
# these object files should have been generated before we got to the present
# directory
ifeq ($(USE_CONTRIB_UMFPACK),yes)
  umfpack-files = $(sort $(shell echo $(LIBDIR)/contrib/umfpack/*.$(OBJEXT)))
  o-files += $(umfpack-files)
  go-files += $(umfpack-files)
endif


# production rules
$(LIBDIR)/lac/%.g.$(OBJEXT) :
	@mkdir -p $(LIBDIR)/lac
	@echo "=====lac==============debug======$(MT)== $(<F)"
	@$(CXX) $(CXXFLAGS.g) -c $< -o $@
$(LIBDIR)/lac/%.$(OBJEXT) :
	@mkdir -p $(LIBDIR)/lac
	@echo "=====lac==============optimized==$(MT)== $(<F)"
	@$(CXX) $(CXXFLAGS.o) -c $< -o $@

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

# rules
lib: $(LIBDIR)/liblac.g$(lib-suffix) $(LIBDIR)/liblac$(lib-suffix)
libg: $(LIBDIR)/liblac.g$(lib-suffix)
libo: $(LIBDIR)/liblac$(lib-suffix)

# 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-base.g)
  deplibs.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 TRILINOS
  ifeq ($(USE_CONTRIB_TRILINOS),yes)
    deplibs.g += $(lib-contrib-trilinos)
    deplibs.o += $(lib-contrib-trilinos)
  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


$(LIBDIR)/liblac$(static-lib-suffix): $(o-files)
	@echo "=====lac==============optimized==$(MT)== Linking library:   $(@F)"
	@$(AR) ru $@ $(o-files)
	@$(RANLIB) $@

$(LIBDIR)/liblac.g$(static-lib-suffix): $(go-files)
	@echo "=====lac==============debug======$(MT)== Linking library:   $(@F)"
	@$(AR) ru $@ $(go-files)
	@$(RANLIB) $@


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

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


# generate a file that contains prototypes for BLAS and LAPACK functions
include/lac/lapack_templates.h: include/lac/lapack_templates.h.in $D/common/scripts/lapack_templates.pl
	@echo ===================================== Remaking $@
	@$(PERL) $D/common/scripts/lapack_templates.pl include/lac/lapack_templates.h.in > $@


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


# 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: include/lac/lapack_templates.h \
	      $(cc-files) $(h-files) $(inst-files) \
		Makefile $D/common/Make.global_options
	@echo ===================================== Remaking lac/Makefile
	@$D/common/scripts/make_dependencies $(INCLUDE) "-B$(LIBDIR)/lac" $(cc-files) \
		> $@ \
	 || (rm -f $@ ; false)


# include all the dependencies
include Makefile.dep

.PHONY: clean
.PHONY: lib lib$(static-lib-suffix) lib.g$(static-lib-suffix)