/
Make.common.in
192 lines (153 loc) · 6 KB
/
Make.common.in
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
###############################################################################
## Please note:
## The ./configure script generates this Make.common from
## contrib/utils/Make.common.in, so if you want to change something,
## then do it in the latter file (here!) and re-run
## ./configure in the top level directory
###############################################################################
###############################################################################
#
# The Make.common file defines the build environment for libMesh
# and all its helper applications. For backwards-compatible builds (before v0.8.0)
# you can include this Make.common file in your project. Note this is not the
# preferred method for using libMesh -- we provide libmesh-config as a better
# solution.
#
###############################################################################
default: all
# Where libMesh is installed.
prefix := @prefix@
exec_prefix := @exec_prefix@
libmesh_install_dir := $(prefix)
# the libtool to use in these defined rules.
libmesh_LIBTOOL ?= @prefix@/contrib/bin/libtool
###############################################################################
# the following lines will be replaced by the output
# of ./configure
hosttype := @host@
hostos := @host_os@
# Perl for making .depend
perl := @PERL@
###############################################################################
###############################################################################
#
# Figure out the compilation mode based on the
# environment variable METHOD.
opt-mode := off
debug-mode := off
prof-mode := off
oprof-mode := off
syn-mode := off
devel-mode := off
# Unless we find a valid or an unset METHOD
# variable, there's something wrong.
mode := "INVALID"
# If the user has no environment variable
# called METHOD, he gets optimized mode.
ifeq (x$(METHOD),x)
METHOD := opt
endif
# If METHOD=opt, compile in optimized mode.
ifeq ($(METHOD),optimized)
METHOD := opt
endif
ifeq ($(METHOD),opt)
opt-mode := on
mode := "optimized"
endif
#
# If METHOD=devel, compile in development mode.
ifeq ($(METHOD),development)
METHOD := devel
endif
ifeq ($(METHOD),devel)
devel-mode := on
mode := "development"
endif
#
# If METHOD=dbg, compile in debug mode.
ifeq ($(METHOD),debug)
METHOD := dbg
endif
ifeq ($(METHOD),dbg)
debug-mode := on
mode := "debug"
endif
#
# If METHOD=oprof, compile in oprofile (also useful for perf) mode.
ifeq ($(METHOD),oprofile)
METHOD := oprof
endif
ifeq ($(METHOD),oprof)
oprof-mode := on
mode := "oprofile"
endif
# If the user had a METHOD variable we didn't
# recognize, there's been some mistake. Let's
# yell at them.
ifeq ($(mode),"INVALID")
$(error Invalid environment variable METHOD=$(METHOD) specified)
endif
# The file extension for object files.
# foo.C is compiled to foo.$(obj-suffix)
# We don't use this in the libMesh build system, but old application codes do.
obj-suffix := @host@.$(METHOD).o
libtool-suffix := @host@.$(METHOD).lo
# use libmesh-config to get configuration details
libmesh_CXX := $(shell @exec_prefix@/bin/libmesh-config --cxx)
libmesh_CC := $(shell @exec_prefix@/bin/libmesh-config --cc)
libmesh_F77 := $(shell @exec_prefix@/bin/libmesh-config --fc)
libmesh_F90 := $(shell @exec_prefix@/bin/libmesh-config --fc)
libmesh_INCLUDE := $(shell @exec_prefix@/bin/libmesh-config --include)
libmesh_CPPFLAGS := $(shell @exec_prefix@/bin/libmesh-config --cppflags)
libmesh_CXXFLAGS := $(shell @exec_prefix@/bin/libmesh-config --cxxflags)
libmesh_CFLAGS := $(shell @exec_prefix@/bin/libmesh-config --cflags)
libmesh_FFLAGS := $(shell @exec_prefix@/bin/libmesh-config --fflags)
libmesh_LIBS := $(shell @exec_prefix@/bin/libmesh-config --libs)
libmesh_shared := $(shell $(libmesh_LIBTOOL) --config | grep build_libtool_libs | cut -d'=' -f2)
libmesh_static := $(shell $(libmesh_LIBTOOL) --config | grep build_old_libs | cut -d'=' -f2)
###############################################################################
# Build rules
##################################
# C++ rules #
##################################
%.$(libtool-suffix) : %.C
@echo "Compiling C++ (in "$(mode)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=CXX $(LIBTOOLFLAGS) --mode=compile --quiet \
$(libmesh_CXX) $(libmesh_CPPFLAGS) $(libmesh_CXXFLAGS) $(libmesh_INCLUDE) -c $< -o $@
%.$(obj-suffix) : %.C
@echo "Compiling C++ (in "$(mode)" mode) "$<"..."
$(libmesh_CXX) $(libmesh_CPPFLAGS) $(libmesh_CXXFLAGS) $(libmesh_INCLUDE) -c $< -o $@
##################################
# C rules #
##################################
%.$(libtool-suffix) : %.c
@echo "Compiling C (in "$(mode)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=compile --quiet \
$(libmesh_CC) $(libmesh_CPPFLAGS) $(libmesh_CFLAGS) $(libmesh_INCLUDE) -c $< -o $@
%.$(obj-suffix) : %.c
@echo "Compiling C (in "$(mode)" mode) "$<"..."
$(libmesh_CC) $(libmesh_CPPFLAGS) $(libmesh_CFLAGS) $(libmesh_INCLUDE) -c $< -o $@
##################################
# Fortran rules #
##################################
%.$(libtool-suffix) : %.f
@echo "Compiling Fortran (in "$(mode)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=F77 $(LIBTOOLFLAGS) --mode=compile --quiet \
$(libmesh_F77) $(libmesh_FFLAGS) $(libmesh_INCLUDE) -c $< -o $@
%.$(obj-suffix) : %.f
@echo "Compiling Fortran (in "$(mode)" mode) "$<"..."
$(libmesh_F77) $(libmesh_FFLAGS) $(libmesh_INCLUDE) -c $< -o $@
%.$(libtool-suffix) : %.f90
@echo "Compiling Fortan90 (in "$(mode)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=FC $(LIBTOOLFLAGS) --mode=compile --quiet \
$(libmesh_F90) $(libmesh_FFLAGS) $(libmesh_INCLUDE) -c $< -o $@
%.$(obj-suffix) : %.f90
@echo "Compiling Fortan90 (in "$(mode)" mode) "$<"..."
$(libmesh_F90) $(libmesh_FFLAGS) $(libmesh_INCLUDE) -c $< -o $@
echo_libmode:
echo "libmesh_shared=$(libmesh_shared)"
echo "libmesh_static=$(libmesh_static)"
# Local Variables:
# mode: makefile
# End: