Feature: Rewrite of GGI comms on AMG agglomeration
[foam-extend-4.0.git] / wmake / Makefile
blobd9b954786962b5aa0248c419d91febef48869cdd
1 #------------------------------------------------------------------------------
2 # ========= |
3 # \\ / F ield | foam-extend: Open Source CFD
4 # \\ / O peration | Version: 4.0
5 # \\ / A nd | Web: http://www.foam-extend.org
6 # \\/ M anipulation | For copyright notice see file Copyright
7 #------------------------------------------------------------------------------
8 # License
9 # This file is part of foam-extend.
11 # foam-extend is free software: you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by the
13 # Free Software Foundation, either version 3 of the License, or (at your
14 # option) any later version.
16 # foam-extend is distributed in the hope that it will be useful, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 # General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 # Script
25 # Makefile
27 # Description
28 # Generic Makefile used by wmake
30 #------------------------------------------------------------------------------
32 #------------------------------------------------------------------------------
33 # The Makefile use a POSIX shell
34 #------------------------------------------------------------------------------
36 SHELL = /bin/sh
39 #------------------------------------------------------------------------------
40 # Initialise suffices list
41 #------------------------------------------------------------------------------
43 .SUFFIXES:
44 .SUFFIXES: .o
47 #------------------------------------------------------------------------------
48 # Set the directory containing the wmake scripts
49 #------------------------------------------------------------------------------
51 WM_SCRIPTS = $(WM_DIR)/scripts
54 #------------------------------------------------------------------------------
55 # declare default paths
56 #------------------------------------------------------------------------------
58 LIB_SRC = $(WM_PROJECT_DIR)/src
59 LIB_DIR = $(WM_PROJECT_DIR)/lib
60 LIB_WM_OPTIONS_DIR = $(LIB_DIR)/$(WM_OPTIONS)
61 OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS)
62 CLASSES_DIR = $(MAKE_DIR)/classes
64 SYS_INC =
65 SYS_LIBS =
67 ifeq ($(WM_ARCH_BASE),mingw)
68 PROJECT_INC = -I$(FOAM_SRC) -I$(FOAM_APP) -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude -I$(LIB_SRC)/OSspecific/$(WM_OSTYPE)/lnInclude
69 else
70 PROJECT_INC = -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude -I$(LIB_SRC)/OSspecific/$(WM_OSTYPE)/lnInclude
71 endif
72 PROJECT_LIBS = -l$(WM_PROJECT)
73 PROJECT_VERSION = $(shell printf -- "-DPROJECT_VERSION=%d%03d%03d" $$(echo $(WM_PROJECT_VERSION) | sed -e 's/\./ /g'))
75 EXE_INC =
76 EXE_LIBS =
78 LIB_LIBS =
81 #------------------------------------------------------------------------------
82 # declare all .o files depend on $(OBJECTS_DIR)/options
83 #------------------------------------------------------------------------------
85 EXE_DEP = $(OBJECTS_DIR)/options
88 #------------------------------------------------------------------------------
89 # declare default name of libraries and executables
90 #------------------------------------------------------------------------------
92 # Library
93 LIB = libNULL
95 # Shared library extension
96 ifeq ($(WM_ARCH_BASE),darwin)
97 # Using Mac OSX
98 SO = dylib
99 else ifeq ($(WM_ARCH_BASE),mingw)
100 # Using MinGW-w64 compiler on Windows
101 SO = dll
102 else
103 SO = so
104 endif
106 # Project executable
107 EXE = $(WM_PROJECT).out
109 # Standalone executable
110 SEXE = a.out
113 #------------------------------------------------------------------------------
114 # set compilation and dependency building rules
115 #------------------------------------------------------------------------------
117 GENERAL_RULES = $(WM_DIR)/rules/General
118 RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER)
119 BIN = $(WM_DIR)/bin/$(WM_ARCH)$(WM_COMPILER)
121 include $(GENERAL_RULES)/general
122 include $(RULES)/general
123 include $(RULES)/$(WM_LINK_LANGUAGE)
125 MAKE_DEP = @$(MKDEP) $< | $(WM_SCRIPTS)/addCompile $<
128 #------------------------------------------------------------------------------
129 # Include PROJECT directory tree file and
130 # source, object and dependency list files.
131 # These are constructed by wmakeDerivedFiles
132 #------------------------------------------------------------------------------
134 include $(OBJECTS_DIR)/options
135 include $(OBJECTS_DIR)/filesMacros
136 include $(OBJECTS_DIR)/sourceFiles
137 include $(OBJECTS_DIR)/objectFiles
138 include $(OBJECTS_DIR)/localObjectFiles
139 include $(OBJECTS_DIR)/dependencyFiles
141 #------------------------------------------------------------------------------
142 # set header file include paths
143 #------------------------------------------------------------------------------
145 LIB_HEADER_DIRS = \
146 $(EXE_INC) \
147 -IlnInclude \
148 -I. \
149 $(PROJECT_INC) \
150 $(GINC) \
151 $(SYS_INC)
154 #------------------------------------------------------------------------------
155 # define link statements for executables
156 #------------------------------------------------------------------------------
158 $(EXE): $(OBJECTS)
159 @$(WM_SCRIPTS)/mkObjectDir $(EXE)
160 $(LINKEXE) $(OBJECTS) -L$(LIB_WM_OPTIONS_DIR) \
161 $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(EXE)
163 exe: $(SEXE)
164 @echo \'$(SEXE)\' is up to date.
166 $(SEXE): $(OBJECTS)
167 @$(WM_SCRIPTS)/mkObjectDir $(SEXE)
168 $(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
169 $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)
172 #------------------------------------------------------------------------------
173 # define link statements for libraries
174 #------------------------------------------------------------------------------
176 ifneq (,$(findstring libfoam,$(LIB)))
177 EXTRA_LIBS=
178 else
179 EXTRA_LIBS=-lfoam
180 endif
182 libso: $(LIB).$(SO)
183 @echo \'$(LIB).$(SO)\' is up to date.
185 $(LIB).$(SO): $(OBJECTS)
186 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
187 @rm -f so_locations
188 ifeq ($(WM_ARCH_BASE),darwin)
189 @cd $(OBJECTS_DIR) ; \
190 $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) -install_name $(LIB).$(SO) -o $(LIB).$(SO)
191 else ifeq ($(WM_ARCH_BASE),mingw)
192 @cd $(OBJECTS_DIR) ; \
193 $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) $(EXTRA_LIBS) -o $(LIB).$(SO) -Wl,--out-implib,$(LIB).a
194 else
195 @cd $(OBJECTS_DIR) ; \
196 $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
197 endif
199 lib: $(LIB).a
200 @echo \'$(LIB).a\' is up to date.
202 $(LIB).a: $(OBJECTS)
203 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
204 @rm -f $(LIB).a
205 $(AR) $(ARFLAGS) $(LIB).a $(OBJECTS)
206 $(RANLIB) $(LIB).a
208 libo: $(LIB).o
209 @echo \'$(LIB).o\' is up to date.
211 $(LIB).o: $(OBJECTS)
212 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
213 @rm -f $(LIB).o
214 $(LD) -r -o $(LIB).o $(OBJECTS)
216 jar: $(LIB).jar
217 @echo \'$(LIB).jar\' is up to date.
219 $(LIB).jar: $(OBJECTS)
220 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
221 jar cfm $(LIB).jar $(LIB_LIBS) -C $(CLASSES_DIR) .
223 #------------------------------------------------------------------------------
224 # Set rule to create the include directory for libraries
225 #------------------------------------------------------------------------------
227 lnInclude/uptodate: $(MAKE_DIR)/files $(MAKE_DIR)/options
228 @rm -rf lnInclude ; wmakeLnInclude . ; touch lnInclude/uptodate
231 #------------------------------------------------------------------------------
232 # Set depedency rule and include dependency lists
233 #------------------------------------------------------------------------------
235 $(OBJECTS_DIR)/dependencies: $(DEPENDENCIES)
236 @echo dependencies up to date > $(OBJECTS_DIR)/dependencies
238 include $(INCLUDE_DEPS)
241 #------------------------------------------------------------------------------