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 (124 lines) | stat: -rw-r--r-- 4,132 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
# $Id: Makefile 20992 2010-04-15 15:21:15Z bangerth $
# Copyright W. Bangerth, University of Heidelberg, 1998, 1999, 2000, 2001, 2002



# deal.II top level directory
D=..


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

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


# there's an extra .o file for the function parser that we need to link into
# libbase. do similarly for the threading building block things if threading
# is enabled
ifeq ($(enable-parser),yes)
  extra-o-files  = $(LIBDIR)/contrib/functionparser/fparser.$(OBJEXT)
  extra-g.o-files = $(LIBDIR)/contrib/functionparser/fparser.$(OBJEXT)
endif

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


# 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
#
# for the current directory, this is only the PETSc libraries since we
# reference them in base/source/utilities
ifneq ($(GXX-VERSION),compaq_cxx)
  deplibs.g =
  deplibs.o =

  ifeq ($(USE_CONTRIB_PETSC),yes)
    deplibs.g += $(lib-contrib-petsc.g) $(DEAL_II_PETSC_MPIUNI_LIB)
    deplibs.o += $(lib-contrib-petsc.o) $(DEAL_II_PETSC_MPIUNI_LIB)
  endif

  ifeq ($(USE_CONTRIB_TRILINOS),yes)
    deplibs.g += $(lib-contrib-trilinos)
    deplibs.o += $(lib-contrib-trilinos)
  endif

  ifeq ($(enable-threads),yes)
    deplibs.g += $(lib-contrib-tbb.g)
    deplibs.o += $(lib-contrib-tbb.o)
  endif

else
  deplibs.g =
  deplibs.o =
endif


# rules for libraries
lib: $(LIBDIR)/libbase.g$(lib-suffix) $(LIBDIR)/libbase$(lib-suffix)
libg: $(LIBDIR)/libbase.g$(lib-suffix)
libo: $(LIBDIR)/libbase$(lib-suffix)

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

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


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

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




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: $(cc-files) $(h-files) Makefile $D/common/Make.global_options
	@echo ============================ Remaking base/Makefile
	@$D/common/scripts/make_dependencies $(INCLUDE) "-B$(LIBDIR)/base" $(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)