1 #------------------------------------------------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 #------------------------------------------------------------------------------
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
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
29 # Generic Makefile used by wmake
31 #------------------------------------------------------------------------------
33 #------------------------------------------------------------------------------
34 # The Makefile use a POSIX shell
35 #------------------------------------------------------------------------------
40 #------------------------------------------------------------------------------
41 # Initialise suffices list
42 #------------------------------------------------------------------------------
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
68 PROJECT_INC
= -I
$(LIB_SRC
)/$(WM_PROJECT
)/lnInclude
-I
$(LIB_SRC
)/OSspecific
/$(WM_OSTYPE
)/lnInclude
69 PROJECT_LIBS
= -l
$(WM_PROJECT
)
72 ## PROJECT_VERSION = $(shell printf -- "-DPROJECT_VERSION=%d%03d%03d" $$(echo $(WM_PROJECT_VERSION) | sed -e 's/\./ /g'))
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 #------------------------------------------------------------------------------
95 # Shared library extension
99 EXE
= $(WM_PROJECT
).out
101 # Standalone executable
105 #------------------------------------------------------------------------------
106 # set compilation and dependency building rules
107 #------------------------------------------------------------------------------
109 GENERAL_RULES
= $(WM_DIR
)/rules
/General
110 RULES
= $(WM_DIR
)/rules
/$(WM_ARCH
)$(WM_COMPILER
)
111 BIN
= $(WM_DIR
)/bin
/$(WM_ARCH
)$(WM_COMPILER
)
113 include $(GENERAL_RULES
)/general
114 include $(RULES
)/general
115 include $(RULES
)/$(WM_LINK_LANGUAGE
)
117 MAKE_DEP
= @
$(MKDEP
) $< |
$(WM_SCRIPTS
)/addCompile
$<
120 #------------------------------------------------------------------------------
121 # Include PROJECT directory tree file and
122 # source, object and dependency list files.
123 # These are constructed by wmakeDerivedFiles
124 #------------------------------------------------------------------------------
126 include $(OBJECTS_DIR
)/options
127 include $(OBJECTS_DIR
)/filesMacros
128 include $(OBJECTS_DIR
)/sourceFiles
129 include $(OBJECTS_DIR
)/objectFiles
130 include $(OBJECTS_DIR
)/localObjectFiles
131 include $(OBJECTS_DIR
)/dependencyFiles
133 #------------------------------------------------------------------------------
134 # set header file include paths
135 #------------------------------------------------------------------------------
146 #------------------------------------------------------------------------------
147 # define link statements for executables
148 #------------------------------------------------------------------------------
151 @
$(WM_SCRIPTS
)/mkObjectDir
$(EXE
)
152 $(LINKEXE
) $(OBJECTS
) -L
$(LIB_WM_OPTIONS_DIR
) \
153 $(EXE_LIBS
) $(PROJECT_LIBS
) $(SYS_LIBS
) $(LINK_LIBS
) $(GLIBS
) -o
$(EXE
)
156 @echo
\'$(SEXE
)\' is up to date.
159 @
$(WM_SCRIPTS
)/mkObjectDir
$(SEXE
)
160 $(LINKEXE
) $(OBJECTS
) $(EXE_LIBS
) \
161 $(SYS_LIBS
) $(LINK_LIBS
) $(GLIBS
) -o
$(SEXE
)
164 #------------------------------------------------------------------------------
165 # define link statements for libraries
166 #------------------------------------------------------------------------------
169 @echo
\'$(LIB
).
$(SO
)\' is up to date.
171 $(LIB
).
$(SO
): $(OBJECTS
)
172 @
$(WM_SCRIPTS
)/mkObjectDir
$(LIB
)
174 @cd
$(OBJECTS_DIR
) ; \
175 $(LINKLIBSO
) $(LOCAL_OBJECTS
) -L
$(LIB_WM_OPTIONS_DIR
) $(LIB_LIBS
) $(GLIB_LIBS
) -o
$(LIB
).
$(SO
)
178 @echo
\'$(LIB
).a
\' is up to date.
181 @
$(WM_SCRIPTS
)/mkObjectDir
$(LIB
)
183 $(AR
) $(ARFLAGS
) $(LIB
).a
$(OBJECTS
)
187 @echo
\'$(LIB
).o
\' is up to date.
190 @
$(WM_SCRIPTS
)/mkObjectDir
$(LIB
)
192 $(LD
) -r
-o
$(LIB
).o
$(OBJECTS
)
195 @echo
\'$(LIB
).jar
\' is up to date.
197 $(LIB
).jar
: $(OBJECTS
)
198 @
$(WM_SCRIPTS
)/mkObjectDir
$(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 #------------------------------------------------------------------------------