1 #------------------------------------------------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright held by original author
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
)
70 PROJECT_VERSION
= $(shell printf
-- "-DPROJECT_VERSION=%d%03d%03d" $$(echo
$(WM_PROJECT_VERSION
) | sed
-e
's/\./ /g'))
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 #------------------------------------------------------------------------------
92 # Shared library extension
93 ifeq ($(WM_ARCH_BASE
),darwin
)
101 EXE
= $(WM_PROJECT
).out
103 # Standalone executable
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 #------------------------------------------------------------------------------
148 #------------------------------------------------------------------------------
149 # define link statements for executables
150 #------------------------------------------------------------------------------
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
)
158 @echo
\'$(SEXE
)\' is up to date.
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 #------------------------------------------------------------------------------
171 @echo
\'$(LIB
).
$(SO
)\' is up to date.
173 $(LIB
).
$(SO
): $(OBJECTS
)
174 @
$(WM_SCRIPTS
)/mkObjectDir
$(LIB
)
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
)
180 @cd
$(OBJECTS_DIR
) ; \
181 $(LINKLIBSO
) $(LOCAL_OBJECTS
) -L
$(LIB_WM_OPTIONS_DIR
) $(LIB_LIBS
) $(GLIB_LIBS
) -o
$(LIB
).
$(SO
)
185 @echo
\'$(LIB
).a
\' is up to date.
188 @
$(WM_SCRIPTS
)/mkObjectDir
$(LIB
)
190 $(AR
) $(ARFLAGS
) $(LIB
).a
$(OBJECTS
)
194 @echo
\'$(LIB
).o
\' is up to date.
197 @
$(WM_SCRIPTS
)/mkObjectDir
$(LIB
)
199 $(LD
) -r
-o
$(LIB
).o
$(OBJECTS
)
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 #------------------------------------------------------------------------------