1 #------------------------------------------------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright (C) 1991-2008 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 #------------------------------------------------------------------------------
32 # Set shell the Makefile uses to the Bourne shell
33 #------------------------------------------------------------------------------
38 #------------------------------------------------------------------------------
39 # Initialise suffices list
40 #------------------------------------------------------------------------------
46 #------------------------------------------------------------------------------
47 # Set the directory containing the wmake scripts
48 #------------------------------------------------------------------------------
50 WM_SCRIPTS
= $(WM_DIR
)/scripts
53 #------------------------------------------------------------------------------
54 # declare default paths
55 #------------------------------------------------------------------------------
57 LIB_SRC
= $(WM_PROJECT_DIR
)/src
58 LIB_DIR
= $(WM_PROJECT_DIR
)/lib
59 LIB_WM_OPTIONS_DIR
= $(LIB_DIR
)/$(WM_OPTIONS
)
60 OBJECTS_DIR
= $(MAKE_DIR
)/$(WM_OPTIONS
)
61 CLASSES_DIR
= $(MAKE_DIR
)/classes
66 PROJECT_INC
= -I
$(LIB_SRC
)/$(WM_PROJECT
)/lnInclude
-I
$(LIB_SRC
)/OSspecific
/$(WM_OS
)/lnInclude
67 PROJECT_LIBS
= -l
$(WM_PROJECT
)
68 PROJECT_VERSION
= $(shell printf
-- "-DPROJECT_VERSION=%d%03d%03d" $$(echo
$(WM_PROJECT_VERSION
) | sed
-e
's/\./ /g'))
76 #------------------------------------------------------------------------------
77 # declare all .o files depend on $(OBJECTS_DIR)/options
78 #------------------------------------------------------------------------------
80 EXE_DEP
= $(OBJECTS_DIR
)/options
83 #------------------------------------------------------------------------------
84 # declare default name of libraries and executables
85 #------------------------------------------------------------------------------
90 # Shared library extension
94 EXE
= $(WM_PROJECT
).out
96 # Standalone executable
100 #------------------------------------------------------------------------------
101 # set compilation and dependency building rules
102 #------------------------------------------------------------------------------
104 GENERAL_RULES
= $(WM_DIR
)/rules
/General
105 RULES
= $(WM_DIR
)/rules
/$(WM_ARCH
)$(WM_COMPILER
)
107 include $(GENERAL_RULES
)/general
108 include $(RULES
)/general
109 include $(RULES
)/$(WM_LINK_LANGUAGE
)
111 MAKE_DEP
= @
$(MKDEP
) $< |
$(WM_SCRIPTS
)/addCompile
$<
114 #------------------------------------------------------------------------------
115 # Include PROJECT directory tree file and
116 # source, object and dependency list files.
117 # These are constructed by wmakeDerivedFiles
118 #------------------------------------------------------------------------------
120 include $(OBJECTS_DIR
)/options
121 include $(OBJECTS_DIR
)/filesMacros
122 include $(OBJECTS_DIR
)/sourceFiles
123 include $(OBJECTS_DIR
)/objectFiles
124 include $(OBJECTS_DIR
)/localObjectFiles
125 include $(OBJECTS_DIR
)/dependencyFiles
127 #------------------------------------------------------------------------------
128 # set header file include paths
129 #------------------------------------------------------------------------------
140 #------------------------------------------------------------------------------
141 # define link statements for executables
142 #------------------------------------------------------------------------------
145 @
$(WM_SCRIPTS
)/mkObjectDir
$(EXE
)
146 $(LINKEXE
) $(OBJECTS
) -L
$(LIB_WM_OPTIONS_DIR
) \
147 $(EXE_LIBS
) $(PROJECT_LIBS
) $(SYS_LIBS
) $(LINK_LIBS
) $(GLIBS
) -o
$(EXE
)
150 @echo
\'$(SEXE
)\' is up to date.
153 @
$(WM_SCRIPTS
)/mkObjectDir
$(SEXE
)
154 $(LINKEXE
) $(OBJECTS
) $(EXE_LIBS
) \
155 $(SYS_LIBS
) $(LINK_LIBS
) $(GLIBS
) -o
$(SEXE
)
158 #------------------------------------------------------------------------------
159 # define link statements for libraries
160 #------------------------------------------------------------------------------
163 @echo
\'$(LIB
).
$(SO
)\' is up to date.
165 $(LIB
).
$(SO
): $(OBJECTS
)
166 @
$(WM_SCRIPTS
)/mkObjectDir
$(LIB
)
168 @cd
$(OBJECTS_DIR
) ; \
169 $(LINKLIBSO
) $(LOCAL_OBJECTS
) -L
$(LIB_WM_OPTIONS_DIR
) $(LIB_LIBS
) $(GLIB_LIBS
) -o
$(LIB
).
$(SO
)
172 @echo
\'$(LIB
).a
\' is up to date.
175 @
$(WM_SCRIPTS
)/mkObjectDir
$(LIB
)
177 $(AR
) $(ARFLAGS
) $(LIB
).a
$(OBJECTS
)
181 @echo
\'$(LIB
).o
\' is up to date.
184 @
$(WM_SCRIPTS
)/mkObjectDir
$(LIB
)
186 $(LD
) -r
-o
$(LIB
).o
$(OBJECTS
)
189 @echo
\'$(LIB
).jar
\' is up to date.
191 $(LIB
).jar
: $(OBJECTS
)
192 @
$(WM_SCRIPTS
)/mkObjectDir
$(LIB
)
193 jar cfm
$(LIB
).jar
$(LIB_LIBS
) -C
$(CLASSES_DIR
) .
195 #------------------------------------------------------------------------------
196 # Set rule to create the include directory for libraries
197 #------------------------------------------------------------------------------
199 lnInclude
/uptodate
: $(MAKE_DIR
)/files
$(MAKE_DIR
)/options
200 @
rm -rf lnInclude
; wmakeLnInclude
`pwd` ; touch lnInclude
/uptodate
203 #------------------------------------------------------------------------------
204 # Set depedency rule and include dependency lists
205 #------------------------------------------------------------------------------
207 $(OBJECTS_DIR
)/dependencies
: $(DEPENDENCIES
)
208 @echo dependencies up to date
> $(OBJECTS_DIR
)/dependencies
210 include $(INCLUDE_DEPS
)
213 #------------------------------------------------------------------------------