Merge /u/hjasak/foam-extend-3.1/ branch HrvojeJasak into nextRelease
[foam-extend-3.2.git] / wmake / Makefile
blob37eff0c448f2bef244daf16c8569d4c5eda986f0
1 #------------------------------------------------------------------------------
2 # ========= |
3 # \\ / F ield | foam-extend: Open Source CFD
4 # \\ / O peration | Version: 3.2
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 PROJECT_INC = -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude -I$(LIB_SRC)/OSspecific/$(WM_OSTYPE)/lnInclude
68 PROJECT_LIBS = -l$(WM_PROJECT)
69 PROJECT_VERSION = $(shell printf -- "-DPROJECT_VERSION=%d%03d%03d" $$(echo $(WM_PROJECT_VERSION) | sed -e 's/\./ /g'))
71 EXE_INC =
72 EXE_LIBS =
74 LIB_LIBS =
77 #------------------------------------------------------------------------------
78 # declare all .o files depend on $(OBJECTS_DIR)/options
79 #------------------------------------------------------------------------------
81 EXE_DEP = $(OBJECTS_DIR)/options
84 #------------------------------------------------------------------------------
85 # declare default name of libraries and executables
86 #------------------------------------------------------------------------------
88 # Library
89 LIB = libNULL
91 # Shared library extension
92 ifeq ($(WM_ARCH_BASE),darwin)
93 # Using Mac OSX
94 SO = dylib
95 else ifeq ($(WM_ARCH_BASE),mingw)
96 # Using MinGW-w64 compiler on Windows
97 SO = dll
98 else
99 SO = so
100 endif
102 # Project executable
103 EXE = $(WM_PROJECT).out
105 # Standalone executable
106 SEXE = a.out
109 #------------------------------------------------------------------------------
110 # set compilation and dependency building rules
111 #------------------------------------------------------------------------------
113 GENERAL_RULES = $(WM_DIR)/rules/General
114 RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER)
115 BIN = $(WM_DIR)/bin/$(WM_ARCH)$(WM_COMPILER)
117 include $(GENERAL_RULES)/general
118 include $(RULES)/general
119 include $(RULES)/$(WM_LINK_LANGUAGE)
121 MAKE_DEP = @$(MKDEP) $< | $(WM_SCRIPTS)/addCompile $<
124 #------------------------------------------------------------------------------
125 # Include PROJECT directory tree file and
126 # source, object and dependency list files.
127 # These are constructed by wmakeDerivedFiles
128 #------------------------------------------------------------------------------
130 include $(OBJECTS_DIR)/options
131 include $(OBJECTS_DIR)/filesMacros
132 include $(OBJECTS_DIR)/sourceFiles
133 include $(OBJECTS_DIR)/objectFiles
134 include $(OBJECTS_DIR)/localObjectFiles
135 include $(OBJECTS_DIR)/dependencyFiles
137 #------------------------------------------------------------------------------
138 # set header file include paths
139 #------------------------------------------------------------------------------
141 LIB_HEADER_DIRS = \
142 $(EXE_INC) \
143 -IlnInclude \
144 -I. \
145 $(PROJECT_INC) \
146 $(GINC) \
147 $(SYS_INC)
150 #------------------------------------------------------------------------------
151 # define link statements for executables
152 #------------------------------------------------------------------------------
154 $(EXE): $(OBJECTS)
155 @$(WM_SCRIPTS)/mkObjectDir $(EXE)
156 $(LINKEXE) $(OBJECTS) -L$(LIB_WM_OPTIONS_DIR) \
157 $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(EXE)
159 exe: $(SEXE)
160 @echo \'$(SEXE)\' is up to date.
162 $(SEXE): $(OBJECTS)
163 @$(WM_SCRIPTS)/mkObjectDir $(SEXE)
164 $(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
165 $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)
168 #------------------------------------------------------------------------------
169 # define link statements for libraries
170 #------------------------------------------------------------------------------
172 ifneq (,$(findstring libfoam,$(LIB)))
173 EXTRA_LIBS=
174 else
175 EXTRA_LIBS=-lfoam
176 endif
178 libso: $(LIB).$(SO)
179 @echo \'$(LIB).$(SO)\' is up to date.
181 $(LIB).$(SO): $(OBJECTS)
182 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
183 @rm -f so_locations
184 ifeq ($(WM_ARCH_BASE),darwin)
185 @cd $(OBJECTS_DIR) ; \
186 $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) -install_name $(notdir $(LIB)).$(SO) -o $(LIB).$(SO)
187 else ifeq ($(WM_ARCH_BASE),mingw)
188 @cd $(OBJECTS_DIR) ; \
189 $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) $(EXTRA_LIBS) -o $(LIB).$(SO) -Wl,--out-implib,$(LIB).a
190 else
191 @cd $(OBJECTS_DIR) ; \
192 $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
193 endif
195 lib: $(LIB).a
196 @echo \'$(LIB).a\' is up to date.
198 $(LIB).a: $(OBJECTS)
199 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
200 @rm -f $(LIB).a
201 $(AR) $(ARFLAGS) $(LIB).a $(OBJECTS)
202 $(RANLIB) $(LIB).a
204 libo: $(LIB).o
205 @echo \'$(LIB).o\' is up to date.
207 $(LIB).o: $(OBJECTS)
208 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
209 @rm -f $(LIB).o
210 $(LD) -r -o $(LIB).o $(OBJECTS)
212 jar: $(LIB).jar
213 @echo \'$(LIB).jar\' is up to date.
215 $(LIB).jar: $(OBJECTS)
216 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
217 jar cfm $(LIB).jar $(LIB_LIBS) -C $(CLASSES_DIR) .
219 #------------------------------------------------------------------------------
220 # Set rule to create the include directory for libraries
221 #------------------------------------------------------------------------------
223 lnInclude/uptodate: $(MAKE_DIR)/files $(MAKE_DIR)/options
224 @rm -rf lnInclude ; wmakeLnInclude . ; touch lnInclude/uptodate
227 #------------------------------------------------------------------------------
228 # Set depedency rule and include dependency lists
229 #------------------------------------------------------------------------------
231 $(OBJECTS_DIR)/dependencies: $(DEPENDENCIES)
232 @echo dependencies up to date > $(OBJECTS_DIR)/dependencies
234 include $(INCLUDE_DEPS)
237 #------------------------------------------------------------------------------