ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / wmake / Makefile
blob96e188530f632503c3d4902747fbd48a555072b6
1 #-------------------------------*- makefile -*---------------------------------
2 # ========= |
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 # \\ / O peration |
5 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your 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, see <http://www.gnu.org/licenses/>.
24 # File
25 # Makefile
27 # Description
28 # A generic Makefile, used by wmake
30 #------------------------------------------------------------------------------
32 #------------------------------------------------------------------------------
33 # The Makefile uses 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_PLATFORMS = $(WM_PROJECT_DIR)/platforms/$(WM_OPTIONS)/lib
60 OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS)
61 CLASSES_DIR = $(MAKE_DIR)/classes
63 SYS_INC =
64 SYS_LIBS =
66 PROJECT_INC = -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude -I$(LIB_SRC)/OSspecific/$(WM_OSTYPE)/lnInclude
67 PROJECT_LIBS = -l$(WM_PROJECT)
69 ## unused:
70 ## PROJECT_VERSION = $(shell printf -- "-DPROJECT_VERSION=%d%03d%03d" $$(echo $(WM_PROJECT_VERSION) | sed -e 's/\./ /g'))
73 EXE_INC =
74 EXE_LIBS =
76 LIB_LIBS =
79 #------------------------------------------------------------------------------
80 # declare all .o files depend on $(OBJECTS_DIR)/options
81 #------------------------------------------------------------------------------
83 EXE_DEP = $(OBJECTS_DIR)/options
86 #------------------------------------------------------------------------------
87 # declare default name of libraries and executables
88 #------------------------------------------------------------------------------
90 # Library
91 LIB = libNULL
93 # Shared library extension
94 SO = so
96 # Project executable
97 EXE = $(WM_PROJECT).out
99 # Standalone executable
100 SEXE = a.out
103 #------------------------------------------------------------------------------
104 # set compilation and dependency building rules
105 #------------------------------------------------------------------------------
107 GENERAL_RULES = $(WM_DIR)/rules/General
108 RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER)
109 WMAKE_BIN = $(WM_DIR)/platforms/$(WM_ARCH)$(WM_COMPILER)
111 include $(GENERAL_RULES)/general
112 include $(RULES)/general
113 include $(RULES)/$(WM_LINK_LANGUAGE)
115 MAKE_DEP = @$(MKDEP) $< | $(WM_SCRIPTS)/addCompile $<
118 #------------------------------------------------------------------------------
119 # Include PROJECT directory tree file and
120 # source, object and dependency list files.
121 # These are constructed by scripts/makeDerivedFiles
122 #------------------------------------------------------------------------------
124 include $(OBJECTS_DIR)/options
125 include $(OBJECTS_DIR)/filesMacros
126 include $(OBJECTS_DIR)/sourceFiles
127 include $(OBJECTS_DIR)/objectFiles
128 include $(OBJECTS_DIR)/localObjectFiles
129 include $(OBJECTS_DIR)/dependencyFiles
131 #------------------------------------------------------------------------------
132 # set header file include paths
133 #------------------------------------------------------------------------------
135 LIB_HEADER_DIRS = \
136 $(EXE_INC) \
137 -IlnInclude \
138 -I. \
139 $(PROJECT_INC) \
140 $(GINC) \
141 $(SYS_INC)
144 #------------------------------------------------------------------------------
145 # define link statements for executables
146 #------------------------------------------------------------------------------
148 $(EXE): $(OBJECTS)
149 @$(WM_SCRIPTS)/makeTargetDir $(EXE)
150 $(LINKEXE) $(OBJECTS) -L$(LIB_PLATFORMS) \
151 $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(EXE)
153 exe: $(SEXE)
154 @echo \'$(SEXE)\' is up to date.
156 $(SEXE): $(OBJECTS)
157 @$(WM_SCRIPTS)/makeTargetDir $(SEXE)
158 $(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
159 $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)
162 #------------------------------------------------------------------------------
163 # define link statements for libraries
164 #------------------------------------------------------------------------------
166 objects: $(OBJECTS)
168 libso: $(LIB).$(SO)
169 @echo \'$(LIB).$(SO)\' is up to date.
171 $(LIB).$(SO): $(OBJECTS)
172 @$(WM_SCRIPTS)/makeTargetDir $(LIB)
173 @rm -f so_locations
174 @cd $(OBJECTS_DIR) ; \
175 $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_PLATFORMS) $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
177 lib: $(LIB).a
178 @echo \'$(LIB).a\' is up to date.
180 $(LIB).a: $(OBJECTS)
181 @$(WM_SCRIPTS)/makeTargetDir $(LIB)
182 @rm -f $(LIB).a
183 $(AR) $(ARFLAGS) $(LIB).a $(OBJECTS)
184 $(RANLIB) $(LIB).a
186 libo: $(LIB).o
187 @echo \'$(LIB).o\' is up to date.
189 $(LIB).o: $(OBJECTS)
190 @$(WM_SCRIPTS)/makeTargetDir $(LIB)
191 @rm -f $(LIB).o
192 $(LD) -r -o $(LIB).o $(OBJECTS)
194 jar: $(LIB).jar
195 @echo \'$(LIB).jar\' is up to date.
197 $(LIB).jar: $(OBJECTS)
198 @$(WM_SCRIPTS)/makeTargetDir $(LIB)
199 jar cfm $(LIB).jar $(LIB_LIBS) -C $(CLASSES_DIR) .
201 #------------------------------------------------------------------------------
202 # Set rule to create the include directory for libraries
203 #------------------------------------------------------------------------------
205 lnInclude/uptodate: $(MAKE_DIR)/files $(MAKE_DIR)/options
206 @rm -rf lnInclude ; wmakeLnInclude . ; touch lnInclude/uptodate
209 #------------------------------------------------------------------------------
210 # Set depedency rule and include dependency lists
211 #------------------------------------------------------------------------------
213 $(OBJECTS_DIR)/dependencies: $(DEPENDENCIES)
214 @echo dependencies up to date > $(OBJECTS_DIR)/dependencies
216 include $(INCLUDE_DEPS)
219 #------------------------------------------------------------------------------