ThirdParty packages: switch to cmake 2.8.5
[foam-extend-3.2.git] / wmake / Makefile
blobb4b90e091d0b530e8a642cb432f066292c6bc3ed
1 #------------------------------------------------------------------------------
2 # ========= |
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 # \\ / O peration |
5 # \\ / A nd | Copyright held by original author
6 # \\/ M anipulation |
7 #------------------------------------------------------------------------------
8 # License
9 # This file is part of OpenFOAM.
11 # OpenFOAM 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 2 of the License, or (at your
14 # option) any later version.
16 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 # for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with OpenFOAM; if not, write to the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 # Script
26 # Makefile
28 # Description
29 # Generic Makefile used by wmake
31 #------------------------------------------------------------------------------
33 #------------------------------------------------------------------------------
34 # The Makefile use a POSIX shell
35 #------------------------------------------------------------------------------
37 SHELL = /bin/sh
40 #------------------------------------------------------------------------------
41 # Initialise suffices list
42 #------------------------------------------------------------------------------
44 .SUFFIXES:
45 .SUFFIXES: .o
48 #------------------------------------------------------------------------------
49 # Set the directory containing the wmake scripts
50 #------------------------------------------------------------------------------
52 WM_SCRIPTS = $(WM_DIR)/scripts
55 #------------------------------------------------------------------------------
56 # declare default paths
57 #------------------------------------------------------------------------------
59 LIB_SRC = $(WM_PROJECT_DIR)/src
60 LIB_DIR = $(WM_PROJECT_DIR)/lib
61 LIB_WM_OPTIONS_DIR = $(LIB_DIR)/$(WM_OPTIONS)
62 OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS)
63 CLASSES_DIR = $(MAKE_DIR)/classes
65 SYS_INC =
66 SYS_LIBS =
68 PROJECT_INC = -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude -I$(LIB_SRC)/OSspecific/$(WM_OSTYPE)/lnInclude
69 PROJECT_LIBS = -l$(WM_PROJECT)
70 PROJECT_VERSION = $(shell printf -- "-DPROJECT_VERSION=%d%03d%03d" $$(echo $(WM_PROJECT_VERSION) | sed -e 's/\./ /g'))
72 EXE_INC =
73 EXE_LIBS =
75 LIB_LIBS =
78 #------------------------------------------------------------------------------
79 # declare all .o files depend on $(OBJECTS_DIR)/options
80 #------------------------------------------------------------------------------
82 EXE_DEP = $(OBJECTS_DIR)/options
85 #------------------------------------------------------------------------------
86 # declare default name of libraries and executables
87 #------------------------------------------------------------------------------
89 # Library
90 LIB = libNULL
92 # Shared library extension
93 ifeq ($(WM_ARCH_BASE),darwin)
94 # Using Mac OSX
95 SO = dylib
96 else
97 SO = so
98 endif
100 # Project executable
101 EXE = $(WM_PROJECT).out
103 # Standalone executable
104 SEXE = a.out
107 #------------------------------------------------------------------------------
108 # set compilation and dependency building rules
109 #------------------------------------------------------------------------------
111 GENERAL_RULES = $(WM_DIR)/rules/General
112 RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER)
113 BIN = $(WM_DIR)/bin/$(WM_ARCH)$(WM_COMPILER)
115 include $(GENERAL_RULES)/general
116 include $(RULES)/general
117 include $(RULES)/$(WM_LINK_LANGUAGE)
119 MAKE_DEP = @$(MKDEP) $< | $(WM_SCRIPTS)/addCompile $<
122 #------------------------------------------------------------------------------
123 # Include PROJECT directory tree file and
124 # source, object and dependency list files.
125 # These are constructed by wmakeDerivedFiles
126 #------------------------------------------------------------------------------
128 include $(OBJECTS_DIR)/options
129 include $(OBJECTS_DIR)/filesMacros
130 include $(OBJECTS_DIR)/sourceFiles
131 include $(OBJECTS_DIR)/objectFiles
132 include $(OBJECTS_DIR)/localObjectFiles
133 include $(OBJECTS_DIR)/dependencyFiles
135 #------------------------------------------------------------------------------
136 # set header file include paths
137 #------------------------------------------------------------------------------
139 LIB_HEADER_DIRS = \
140 $(EXE_INC) \
141 -IlnInclude \
142 -I. \
143 $(PROJECT_INC) \
144 $(GINC) \
145 $(SYS_INC)
148 #------------------------------------------------------------------------------
149 # define link statements for executables
150 #------------------------------------------------------------------------------
152 $(EXE): $(OBJECTS)
153 @$(WM_SCRIPTS)/mkObjectDir $(EXE)
154 $(LINKEXE) $(OBJECTS) -L$(LIB_WM_OPTIONS_DIR) \
155 $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(EXE)
157 exe: $(SEXE)
158 @echo \'$(SEXE)\' is up to date.
160 $(SEXE): $(OBJECTS)
161 @$(WM_SCRIPTS)/mkObjectDir $(SEXE)
162 $(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
163 $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)
166 #------------------------------------------------------------------------------
167 # define link statements for libraries
168 #------------------------------------------------------------------------------
170 libso: $(LIB).$(SO)
171 @echo \'$(LIB).$(SO)\' is up to date.
173 $(LIB).$(SO): $(OBJECTS)
174 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
175 @rm -f so_locations
176 ifeq ($(WM_ARCH_BASE),darwin)
177 @cd $(OBJECTS_DIR) ; \
178 $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) -install_name $(notdir $(LIB)).$(SO) -o $(LIB).$(SO)
179 else
180 @cd $(OBJECTS_DIR) ; \
181 $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
182 endif
184 lib: $(LIB).a
185 @echo \'$(LIB).a\' is up to date.
187 $(LIB).a: $(OBJECTS)
188 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
189 @rm -f $(LIB).a
190 $(AR) $(ARFLAGS) $(LIB).a $(OBJECTS)
191 $(RANLIB) $(LIB).a
193 libo: $(LIB).o
194 @echo \'$(LIB).o\' is up to date.
196 $(LIB).o: $(OBJECTS)
197 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
198 @rm -f $(LIB).o
199 $(LD) -r -o $(LIB).o $(OBJECTS)
201 jar: $(LIB).jar
202 @echo \'$(LIB).jar\' is up to date.
204 $(LIB).jar: $(OBJECTS)
205 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
206 jar cfm $(LIB).jar $(LIB_LIBS) -C $(CLASSES_DIR) .
208 #------------------------------------------------------------------------------
209 # Set rule to create the include directory for libraries
210 #------------------------------------------------------------------------------
212 lnInclude/uptodate: $(MAKE_DIR)/files $(MAKE_DIR)/options
213 @rm -rf lnInclude ; wmakeLnInclude . ; touch lnInclude/uptodate
216 #------------------------------------------------------------------------------
217 # Set depedency rule and include dependency lists
218 #------------------------------------------------------------------------------
220 $(OBJECTS_DIR)/dependencies: $(DEPENDENCIES)
221 @echo dependencies up to date > $(OBJECTS_DIR)/dependencies
223 include $(INCLUDE_DEPS)
226 #------------------------------------------------------------------------------