Merge branch 'master' of ssh://opencfd@repo.or.cz/srv/git/OpenFOAM-1.5.x
[OpenFOAM-1.5.x.git] / wmake / Makefile
blob157e9c993a4f94eec9160c42332bcf5e5d27ccd4
1 #------------------------------------------------------------------------------
2 # ========= |
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 # \\ / O peration |
5 # \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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 #------------------------------------------------------------------------------
32 # Set shell the Makefile uses to the Bourne shell
33 #------------------------------------------------------------------------------
35 SHELL = /bin/sh
38 #------------------------------------------------------------------------------
39 # Initialise suffices list
40 #------------------------------------------------------------------------------
42 .SUFFIXES:
43 .SUFFIXES: .o
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
63 SYS_INC =
64 SYS_LIBS =
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'))
70 EXE_INC =
71 EXE_LIBS =
73 LIB_LIBS =
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 #------------------------------------------------------------------------------
87 # Library
88 LIB = libNULL
90 # Shared library extension
91 SO = so
93 # Project executable
94 EXE = $(WM_PROJECT).out
96 # Standalone executable
97 SEXE = a.out
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 #------------------------------------------------------------------------------
131 LIB_HEADER_DIRS = \
132 $(EXE_INC) \
133 -IlnInclude \
134 -I. \
135 $(PROJECT_INC) \
136 $(GINC) \
137 $(SYS_INC)
140 #------------------------------------------------------------------------------
141 # define link statements for executables
142 #------------------------------------------------------------------------------
144 $(EXE): $(OBJECTS)
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)
149 exe: $(SEXE)
150 @echo \'$(SEXE)\' is up to date.
152 $(SEXE): $(OBJECTS)
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 #------------------------------------------------------------------------------
162 libso: $(LIB).$(SO)
163 @echo \'$(LIB).$(SO)\' is up to date.
165 $(LIB).$(SO): $(OBJECTS)
166 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
167 @rm -f so_locations
168 @cd $(OBJECTS_DIR) ; \
169 $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
171 lib: $(LIB).a
172 @echo \'$(LIB).a\' is up to date.
174 $(LIB).a: $(OBJECTS)
175 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
176 @rm -f $(LIB).a
177 $(AR) $(ARFLAGS) $(LIB).a $(OBJECTS)
178 $(RANLIB) $(LIB).a
180 libo: $(LIB).o
181 @echo \'$(LIB).o\' is up to date.
183 $(LIB).o: $(OBJECTS)
184 @$(WM_SCRIPTS)/mkObjectDir $(LIB)
185 @rm -f $(LIB).o
186 $(LD) -r -o $(LIB).o $(OBJECTS)
188 jar: $(LIB).jar
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 #------------------------------------------------------------------------------