1 |
# |
2 |
# common.make |
3 |
# |
4 |
# Set all of the common environment variables. |
5 |
# |
6 |
# Copyright (C) 1997, 2001 Free Software Foundation, Inc. |
7 |
# |
8 |
# Author: Scott Christley <scottc@net-community.com> |
9 |
# Author: Ovidiu Predescu <ovidiu@net-community.com> |
10 |
# Author: Nicola Pero <n.pero@mi.flashnet.it> |
11 |
# |
12 |
# This file is part of the GNUstep Makefile Package. |
13 |
# |
14 |
# This library is free software; you can redistribute it and/or |
15 |
# modify it under the terms of the GNU General Public License |
16 |
# as published by the Free Software Foundation; either version 2 |
17 |
# of the License, or (at your option) any later version. |
18 |
# |
19 |
# You should have received a copy of the GNU General Public |
20 |
# License along with this library; see the file COPYING.LIB. |
21 |
# If not, write to the Free Software Foundation, |
22 |
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 |
|
24 |
ifeq ($(COMMON_MAKE_LOADED),) |
25 |
COMMON_MAKE_LOADED = yes |
26 |
|
27 |
SHELL = /bin/sh |
28 |
|
29 |
# Default version |
30 |
MAJOR_VERSION = 1 |
31 |
MINOR_VERSION = 0 |
32 |
SUBMINOR_VERSION = 0 |
33 |
VERSION = ${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION} |
34 |
|
35 |
# GNUSTEP_BASE_INSTALL by default is `' - this is correct |
36 |
|
37 |
# |
38 |
# Scripts to run for parsing canonical names |
39 |
# |
40 |
CONFIG_GUESS_SCRIPT = $(GNUSTEP_MAKEFILES)/config.guess |
41 |
CONFIG_SUB_SCRIPT = $(GNUSTEP_MAKEFILES)/config.sub |
42 |
CONFIG_CPU_SCRIPT = $(GNUSTEP_MAKEFILES)/cpu.sh |
43 |
CONFIG_VENDOR_SCRIPT = $(GNUSTEP_MAKEFILES)/vendor.sh |
44 |
CONFIG_OS_SCRIPT = $(GNUSTEP_MAKEFILES)/os.sh |
45 |
CLEAN_CPU_SCRIPT = $(GNUSTEP_MAKEFILES)/clean_cpu.sh |
46 |
CLEAN_VENDOR_SCRIPT = $(GNUSTEP_MAKEFILES)/clean_vendor.sh |
47 |
CLEAN_OS_SCRIPT = $(GNUSTEP_MAKEFILES)/clean_os.sh |
48 |
ifeq ($(GNUSTEP_FLATTENED),) |
49 |
WHICH_LIB_SCRIPT \ |
50 |
= $(GNUSTEP_MAKEFILES)/$(GNUSTEP_HOST_CPU)/$(GNUSTEP_HOST_OS)/which_lib |
51 |
else |
52 |
WHICH_LIB_SCRIPT = $(GNUSTEP_MAKEFILES)/which_lib |
53 |
endif |
54 |
LD_LIB_PATH_SCRIPT = $(GNUSTEP_MAKEFILES)/ld_lib_path.sh |
55 |
TRANSFORM_PATHS_SCRIPT = $(GNUSTEP_MAKEFILES)/transform_paths.sh |
56 |
REL_PATH_SCRIPT = $(GNUSTEP_MAKEFILES)/relative_path.sh |
57 |
|
58 |
# Take the makefiles from the system root |
59 |
ifeq ($(GNUSTEP_MAKEFILES),) |
60 |
GNUSTEP_MAKEFILES = $(GNUSTEP_SYSTEM_ROOT)/Library/Makefiles |
61 |
endif |
62 |
|
63 |
# |
64 |
# Determine the compilation host and target |
65 |
# |
66 |
include $(GNUSTEP_MAKEFILES)/names.make |
67 |
|
68 |
ifeq ($(GNUSTEP_FLATTENED),) |
69 |
GNUSTEP_HOST_DIR = $(GNUSTEP_HOST_CPU)/$(GNUSTEP_HOST_OS) |
70 |
GNUSTEP_TARGET_DIR = $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS) |
71 |
GNUSTEP_HOST_LDIR = $(GNUSTEP_HOST_DIR)/$(LIBRARY_COMBO) |
72 |
GNUSTEP_TARGET_LDIR = $(GNUSTEP_TARGET_DIR)/$(LIBRARY_COMBO) |
73 |
else |
74 |
GNUSTEP_HOST_DIR = . |
75 |
GNUSTEP_TARGET_DIR = . |
76 |
GNUSTEP_HOST_LDIR = . |
77 |
GNUSTEP_TARGET_LDIR = . |
78 |
endif |
79 |
|
80 |
# |
81 |
# Get the config information |
82 |
# |
83 |
include $(GNUSTEP_MAKEFILES)/$(GNUSTEP_TARGET_DIR)/config.make |
84 |
|
85 |
# |
86 |
# Sanity checks - only performed at the first make invocation |
87 |
# |
88 |
ifeq ($(MAKELEVEL),0) |
89 |
|
90 |
# Sanity check on GNUSTEP_*_ROOT. We want them all to be non-empty. |
91 |
GNUSTEP_ERROR = |
92 |
|
93 |
ifeq ($(GNUSTEP_USER_ROOT),) |
94 |
GNUSTEP_ERROR=GNUSTEP_USER_ROOT |
95 |
endif |
96 |
ifeq ($(GNUSTEP_LOCAL_ROOT),) |
97 |
GNUSTEP_ERROR=GNUSTEP_LOCAL_ROOT |
98 |
endif |
99 |
ifeq ($(GNUSTEP_NETWORK_ROOT),) |
100 |
GNUSTEP_ERROR=GNUSTEP_NETWORK_ROOT |
101 |
endif |
102 |
ifeq ($(GNUSTEP_SYSTEM_ROOT),) |
103 |
GNUSTEP_ERROR=GNUSTEP_SYSTEM_ROOT |
104 |
endif |
105 |
|
106 |
ifneq ($(GNUSTEP_ERROR),) |
107 |
$(warning ERROR: Your $(GNUSTEP_ERROR) environment variable is empty !) |
108 |
$(error Please try again after running ". $(GNUSTEP_MAKEFILES)/GNUstep.sh") |
109 |
endif |
110 |
|
111 |
# Sanity check on $PATH - NB: if PATH is wrong, we can't do certain things |
112 |
# because we can't run the tools (not even using opentool as we can't even |
113 |
# run opentool if PATH is wrong) - this is particularly bad for gui stuff |
114 |
|
115 |
# Skip the check if we are on an Apple system. I was told that you can't |
116 |
# source GNUstep.sh before running Apple's PB and that the only |
117 |
# friendly solution is to disable the check. |
118 |
ifneq ($(FOUNDATION_LIB), apple) |
119 |
|
120 |
# NB - we can't trust PATH here because it's what we are trying to |
121 |
# check ... but hopefully if we (common.make) have been found, we |
122 |
# can trust that at least $(GNUSTEP_MAKEFILES) is set up correctly :-) |
123 |
|
124 |
# We want to check that this path is in the PATH |
125 |
SYS_TOOLS_PATH = $(GNUSTEP_SYSTEM_ROOT)/Tools |
126 |
|
127 |
# But on cygwin we might need to first fix it up ... |
128 |
ifeq ($(findstring cygwin, $(GNUSTEP_HOST_OS)), cygwin) |
129 |
ifeq ($(shell echo "$(SYS_TOOLS_PATH)" | sed 's/^\([a-zA-Z]:.*\)//'),) |
130 |
SYS_TOOLS_PATH := $(shell $(GNUSTEP_MAKEFILES)/fixpath.sh -u $(SYS_TOOLS_PATH)) |
131 |
endif |
132 |
endif |
133 |
|
134 |
# Under mingw paths are so confused this warning is not worthwhile |
135 |
ifneq ($(findstring mingw, $(GNUSTEP_HOST_OS)), mingw) |
136 |
ifeq ($(findstring $(SYS_TOOLS_PATH),$(PATH)),) |
137 |
$(warning WARNING: Your PATH may not be set up correctly !) |
138 |
$(warning Please try again after running ". $(GNUSTEP_MAKEFILES)/GNUstep.sh") |
139 |
endif |
140 |
endif |
141 |
|
142 |
endif # code used when FOUNDATION_LIB != apple |
143 |
|
144 |
endif # End of sanity checks run only at makelevel 0 |
145 |
|
146 |
# |
147 |
# Get standard messages |
148 |
# |
149 |
include $(GNUSTEP_MAKEFILES)/messages.make |
150 |
|
151 |
# |
152 |
# Get flags/config options for core libraries |
153 |
# |
154 |
|
155 |
# First, work out precisely library combos etc |
156 |
include $(GNUSTEP_MAKEFILES)/library-combo.make |
157 |
# Then include custom makefiles with flags/config options |
158 |
# This is meant to be used by the core libraries to override loading |
159 |
# of the system makefiles from $(GNUSTEP_MAKEFILES)/Additional/*.make |
160 |
# with their local copy (presumably more up-to-date) |
161 |
ifneq ($(GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES),) |
162 |
include $(GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES) |
163 |
endif |
164 |
# Then include makefiles with flags/config options installed by the |
165 |
# libraries themselves |
166 |
-include $(GNUSTEP_MAKEFILES)/Additional/*.make |
167 |
|
168 |
# |
169 |
# Determine target specific settings |
170 |
# |
171 |
include $(GNUSTEP_MAKEFILES)/target.make |
172 |
|
173 |
# |
174 |
# GNUSTEP_INSTALLATION_DIR is the directory where all the things go. If you |
175 |
# don't specify it defaults to GNUSTEP_LOCAL_ROOT. |
176 |
# |
177 |
ifeq ($(GNUSTEP_INSTALLATION_DIR),) |
178 |
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_LOCAL_ROOT) |
179 |
endif |
180 |
|
181 |
# Make it public and available to all submakes invocations |
182 |
export GNUSTEP_INSTALLATION_DIR |
183 |
|
184 |
# |
185 |
# Variables specifying the installation directory paths |
186 |
# |
187 |
GNUSTEP_APPS = $(GNUSTEP_INSTALLATION_DIR)/Applications |
188 |
GNUSTEP_TOOLS = $(GNUSTEP_INSTALLATION_DIR)/Tools |
189 |
GNUSTEP_LIBRARY = $(GNUSTEP_INSTALLATION_DIR)/Library |
190 |
GNUSTEP_SERVICES = $(GNUSTEP_INSTALLATION_DIR)/Library/Services |
191 |
ifeq ($(GNUSTEP_FLATTENED),yes) |
192 |
GNUSTEP_HEADERS = $(GNUSTEP_INSTALLATION_DIR)/Library/Headers |
193 |
else |
194 |
GNUSTEP_HEADERS = $(GNUSTEP_INSTALLATION_DIR)/Library/Headers/$(LIBRARY_COMBO) |
195 |
endif |
196 |
GNUSTEP_APPLICATION_SUPPORT = $(GNUSTEP_INSTALLATION_DIR)/Library/ApplicationSupport |
197 |
GNUSTEP_BUNDLES = $(GNUSTEP_INSTALLATION_DIR)/Library/Bundles |
198 |
GNUSTEP_FRAMEWORKS = $(GNUSTEP_INSTALLATION_DIR)/Library/Frameworks |
199 |
GNUSTEP_PALETTES = $(GNUSTEP_LIBRARY)/ApplicationSupport/Palettes |
200 |
GNUSTEP_LIBRARIES = $(GNUSTEP_INSTALLATION_DIR)/Library/Libraries |
201 |
GNUSTEP_RESOURCES = $(GNUSTEP_INSTALLATION_DIR)/Library/Libraries/Resources |
202 |
GNUSTEP_JAVA = $(GNUSTEP_INSTALLATION_DIR)/Library/Libraries/Java |
203 |
GNUSTEP_DOCUMENTATION = $(GNUSTEP_INSTALLATION_DIR)/Library/Documentation |
204 |
GNUSTEP_DOCUMENTATION_MAN = $(GNUSTEP_DOCUMENTATION)/man |
205 |
GNUSTEP_DOCUMENTATION_INFO = $(GNUSTEP_DOCUMENTATION)/info |
206 |
|
207 |
# The default name of the makefile to be used in recursive invocations of make |
208 |
ifeq ($(MAKEFILE_NAME),) |
209 |
MAKEFILE_NAME = GNUmakefile |
210 |
endif |
211 |
|
212 |
# Now prepare the library and header flags - we first prepare the list |
213 |
# of directories, then optionally remove the empty ones, then prepend |
214 |
# -I / -L to them. |
215 |
ifeq ($(GNUSTEP_FLATTENED),) |
216 |
|
217 |
GNUSTEP_HEADERS_DIRS = \ |
218 |
$(GNUSTEP_USER_ROOT)/Library/Headers/$(LIBRARY_COMBO)/$(GNUSTEP_TARGET_DIR) \ |
219 |
$(GNUSTEP_USER_ROOT)/Library/Headers/$(LIBRARY_COMBO) \ |
220 |
$(GNUSTEP_LOCAL_ROOT)/Library/Headers/$(LIBRARY_COMBO)/$(GNUSTEP_TARGET_DIR)\ |
221 |
$(GNUSTEP_LOCAL_ROOT)/Library/Headers/$(LIBRARY_COMBO) \ |
222 |
$(GNUSTEP_NETWORK_ROOT)/Library/Headers/$(LIBRARY_COMBO)/$(GNUSTEP_TARGET_DIR)\ |
223 |
$(GNUSTEP_NETWORK_ROOT)/Library/Headers/$(LIBRARY_COMBO) \ |
224 |
$(GNUSTEP_SYSTEM_ROOT)/Library/Headers/$(LIBRARY_COMBO)/$(GNUSTEP_TARGET_DIR)\ |
225 |
$(GNUSTEP_SYSTEM_ROOT)/Library/Headers/$(LIBRARY_COMBO) |
226 |
|
227 |
GNUSTEP_LIBRARIES_DIRS = \ |
228 |
$(GNUSTEP_USER_ROOT)/Library/Libraries/$(GNUSTEP_TARGET_LDIR) \ |
229 |
$(GNUSTEP_USER_ROOT)/Library/Libraries/$(GNUSTEP_TARGET_DIR) \ |
230 |
$(GNUSTEP_LOCAL_ROOT)/Library/Libraries/$(GNUSTEP_TARGET_LDIR) \ |
231 |
$(GNUSTEP_LOCAL_ROOT)/Library/Libraries/$(GNUSTEP_TARGET_DIR) \ |
232 |
$(GNUSTEP_NETWORK_ROOT)/Library/Libraries/$(GNUSTEP_TARGET_LDIR) \ |
233 |
$(GNUSTEP_NETWORK_ROOT)/Library/Libraries/$(GNUSTEP_TARGET_DIR) \ |
234 |
$(GNUSTEP_SYSTEM_ROOT)/Library/Libraries/$(GNUSTEP_TARGET_LDIR) \ |
235 |
$(GNUSTEP_SYSTEM_ROOT)/Library/Libraries/$(GNUSTEP_TARGET_DIR) |
236 |
|
237 |
else # GNUSTEP_FLATTENED |
238 |
|
239 |
GNUSTEP_HEADERS_DIRS = \ |
240 |
$(GNUSTEP_USER_ROOT)/Library/Headers \ |
241 |
$(GNUSTEP_LOCAL_ROOT)/Library/Headers \ |
242 |
$(GNUSTEP_NETWORK_ROOT)/Library/Headers \ |
243 |
$(GNUSTEP_SYSTEM_ROOT)/Library/Headers |
244 |
|
245 |
GNUSTEP_LIBRARIES_DIRS = \ |
246 |
$(GNUSTEP_USER_ROOT)/Library/Libraries \ |
247 |
$(GNUSTEP_LOCAL_ROOT)/Library/Libraries \ |
248 |
$(GNUSTEP_NETWORK_ROOT)/Library/Libraries \ |
249 |
$(GNUSTEP_SYSTEM_ROOT)/Library/Libraries |
250 |
|
251 |
endif # GNUSTEP_FLATTENED |
252 |
|
253 |
|
254 |
$(shell echo "$(GNUSTEP_LIBRARIES_FLAGS)") |
255 |
|
256 |
ifeq ($(REMOVE_EMPTY_DIRS),yes) |
257 |
# This variable, when evaluated, gives $(dir) if dir is non-empty, and |
258 |
# nothing if dir is empty. |
259 |
remove_if_empty = $(dir $(word 1,$(wildcard $(dir)/*))) |
260 |
|
261 |
# Build the GNUSTEP_HEADER_FLAGS by removing the empty dirs from |
262 |
# GNUSTEP_HEADER_DIRS, then prepending -I to each of them |
263 |
# |
264 |
# Important - because this variable is defined with = and not :=, it |
265 |
# is only evaluated when it is used. Which is good - it means we don't |
266 |
# scan the directories and try to remove the empty one on each make |
267 |
# invocation (eg, on 'make clean') - we only scan the dirs when we are using |
268 |
# GNUSTEP_HEADERS_FLAGS to compile. Please make sure to keep this |
269 |
# behaviour otherwise scanning the directories each time a makefile is |
270 |
# read might slow down the package unnecessarily for operations like |
271 |
# make clean, make distclean etc. |
272 |
# |
273 |
# Doing this filtering still gives a 5% to 10% slowdown in compilation times |
274 |
# due to directory scanning, which is why is normally turned off by |
275 |
# default - by default we put all directories in compilation commands. |
276 |
GNUSTEP_HEADERS_FLAGS = \ |
277 |
$(addprefix -I,$(foreach dir,$(GNUSTEP_HEADERS_DIRS),$(remove_if_empty))) |
278 |
GNUSTEP_LIBRARIES_FLAGS = \ |
279 |
$(addprefix -L,$(foreach dir,$(GNUSTEP_LIBRARIES_DIRS),$(remove_if_empty))) |
280 |
else |
281 |
# Default case, just add -I / -L |
282 |
GNUSTEP_HEADERS_FLAGS = $(addprefix -I,$(GNUSTEP_HEADERS_DIRS)) |
283 |
GNUSTEP_LIBRARIES_FLAGS = $(addprefix -L,$(GNUSTEP_LIBRARIES_DIRS)) |
284 |
endif |
285 |
|
286 |
# |
287 |
# Determine Foundation header subdirectory based upon library combo |
288 |
# |
289 |
# TODO: remove those as now all headers are in a LIBRARY_COMBO |
290 |
# directory if the system is not flattened; and if the system is |
291 |
# flattened, support for multiple foundation libs is simply not built |
292 |
# in. |
293 |
ifeq ($(GNUSTEP_FLATTENED),yes) |
294 |
GNUSTEP_HEADERS_FND_DIRS = \ |
295 |
$(GNUSTEP_USER_ROOT)/Library/Headers/$(GNUSTEP_FND_DIR) \ |
296 |
$(GNUSTEP_LOCAL_ROOT)/Library/Headers/$(GNUSTEP_FND_DIR) \ |
297 |
$(GNUSTEP_NETWORK_ROOT)/Library/Headers/$(GNUSTEP_FND_DIR) \ |
298 |
$(GNUSTEP_SYSTEM_ROOT)/Library/Headers/$(GNUSTEP_FND_DIR) |
299 |
else |
300 |
GNUSTEP_HEADERS_FND_DIRS = \ |
301 |
$(GNUSTEP_USER_ROOT)/Library/Headers/$(LIBRARY_COMBO)/$(GNUSTEP_FND_DIR) \ |
302 |
$(GNUSTEP_LOCAL_ROOT)/Library/Headers/$(LIBRARY_COMBO)/$(GNUSTEP_FND_DIR) \ |
303 |
$(GNUSTEP_NETWORK_ROOT)/Library/Headers/$(LIBRARY_COMBO)/$(GNUSTEP_FND_DIR) \ |
304 |
$(GNUSTEP_SYSTEM_ROOT)/Library/Headers/$(LIBRARY_COMBO)/$(GNUSTEP_FND_DIR) |
305 |
endif |
306 |
|
307 |
ifeq ($(FOUNDATION_LIB), fd) |
308 |
|
309 |
# Map OBJC_RUNTIME_LIB values to OBJC_RUNTIME values as used by |
310 |
# libFoundation. TODO/FIXME: Drop all this stuff and have |
311 |
# libFoundation use OBJC_RUNTIME_LIB directly. |
312 |
|
313 |
# TODO: Remove all this cruft. Standardize. |
314 |
ifeq ($(OBJC_RUNTIME_LIB), nx) |
315 |
OBJC_RUNTIME = NeXT |
316 |
endif |
317 |
ifeq ($(OBJC_RUNTIME_LIB), sun) |
318 |
OBJC_RUNTIME = Sun |
319 |
endif |
320 |
ifeq ($(OBJC_RUNTIME_LIB), apple) |
321 |
OBJC_RUNTIME = apple |
322 |
endif |
323 |
ifeq ($(OBJC_RUNTIME_LIB), gnu) |
324 |
OBJC_RUNTIME = GNU |
325 |
endif |
326 |
ifeq ($(OBJC_RUNTIME_LIB), gnugc) |
327 |
OBJC_RUNTIME = GNU |
328 |
endif |
329 |
GNUSTEP_HEADERS_FND_DIRS += \ |
330 |
$(GNUSTEP_USER_ROOT)/Library/Headers/$(GNUSTEP_FND_DIR)/$(GNUSTEP_TARGET_DIR)/$(OBJC_RUNTIME) \ |
331 |
$(GNUSTEP_LOCAL_ROOT)/Library/Headers/$(GNUSTEP_FND_DIR)/$(GNUSTEP_TARGET_DIR)/$(OBJC_RUNTIME) \ |
332 |
$(GNUSTEP_NETWORK_ROOT)/Library/Headers/$(GNUSTEP_FND_DIR)/$(GNUSTEP_TARGET_DIR)/$(OBJC_RUNTIME) \ |
333 |
$(GNUSTEP_SYSTEM_ROOT)/Library/Headers/$(GNUSTEP_FND_DIR)/$(GNUSTEP_TARGET_DIR)/$(OBJC_RUNTIME) |
334 |
endif |
335 |
|
336 |
ifeq ($(REMOVE_EMPTY_DIRS), yes) |
337 |
# Build the GNUSTEP_HEADERS_FND_FLAG by removing the empty dirs |
338 |
# from GNUSTEP_HEADERS_FND_DIRS, then prepending -I to each of them |
339 |
GNUSTEP_HEADERS_FND_FLAG = \ |
340 |
$(addprefix -I,$(foreach dir,$(GNUSTEP_HEADERS_FND_DIRS),$(remove_if_empty))) |
341 |
else |
342 |
# default case - simply prepend -I |
343 |
GNUSTEP_HEADERS_FND_FLAG = $(addprefix -I,$(GNUSTEP_HEADERS_FND_DIRS)) |
344 |
endif |
345 |
|
346 |
# |
347 |
# Overridable compilation flags |
348 |
# |
349 |
# FIXME: We use -fno-strict-aliasing to prevent annoying gcc3.3 |
350 |
# compiler warnings. But we really need to investigate why the |
351 |
# warning appear in the first place, if they are serious or not, and |
352 |
# what can be done about it. |
353 |
OBJCFLAGS = $(OBJC_NO_IMPORT_FLAGS) -fno-strict-aliasing |
354 |
CFLAGS = |
355 |
OBJ_DIR_PREFIX = |
356 |
|
357 |
# |
358 |
# Now decide whether to build shared objects or not. Nothing depending |
359 |
# on the value of the shared variable is allowed before this point! |
360 |
# |
361 |
|
362 |
# |
363 |
# Fixup bundles to be always built as shared even when shared=no is given |
364 |
# |
365 |
ifeq ($(shared), no) |
366 |
ifeq ($(GNUSTEP_TYPE), bundle) |
367 |
$(warning "Static bundles are meaningless! I am using shared=yes!") |
368 |
override shared = yes |
369 |
export shared |
370 |
endif |
371 |
endif |
372 |
|
373 |
# Enable building shared libraries by default. If the user wants to build a |
374 |
# static library, he/she has to specify shared=no explicitly. |
375 |
ifeq ($(HAVE_SHARED_LIBS), yes) |
376 |
# Unless shared=no has been purposedly set ... |
377 |
ifneq ($(shared), no) |
378 |
# ... set shared = yes |
379 |
shared = yes |
380 |
endif |
381 |
endif |
382 |
|
383 |
ifeq ($(shared), yes) |
384 |
LIB_LINK_CMD = $(SHARED_LIB_LINK_CMD) |
385 |
OBJ_DIR_PREFIX += shared_ |
386 |
INTERNAL_OBJCFLAGS += $(SHARED_CFLAGS) |
387 |
INTERNAL_CFLAGS += $(SHARED_CFLAGS) |
388 |
AFTER_INSTALL_LIBRARY_CMD = $(AFTER_INSTALL_SHARED_LIB_CMD) |
389 |
else |
390 |
LIB_LINK_CMD = $(STATIC_LIB_LINK_CMD) |
391 |
OBJ_DIR_PREFIX += static_ |
392 |
AFTER_INSTALL_LIBRARY_CMD = $(AFTER_INSTALL_STATIC_LIB_CMD) |
393 |
LIBRARY_NAME_SUFFIX := s$(LIBRARY_NAME_SUFFIX) |
394 |
endif |
395 |
|
396 |
ifeq ($(profile), yes) |
397 |
ADDITIONAL_FLAGS += -pg |
398 |
ifeq ($(LD), $(CC)) |
399 |
LDFLAGS += -pg |
400 |
endif |
401 |
OBJ_DIR_PREFIX += profile_ |
402 |
LIBRARY_NAME_SUFFIX := p$(LIBRARY_NAME_SUFFIX) |
403 |
endif |
404 |
|
405 |
ifeq ($(debug), yes) |
406 |
OPTFLAG := $(filter-out -O%, $(OPTFLAG)) |
407 |
ADDITIONAL_FLAGS += -g -Wall -DDEBUG -fno-omit-frame-pointer |
408 |
INTERNAL_JAVACFLAGS += -g -deprecation |
409 |
OBJ_DIR_PREFIX += debug_ |
410 |
LIBRARY_NAME_SUFFIX := d$(LIBRARY_NAME_SUFFIX) |
411 |
else |
412 |
INTERNAL_JAVACFLAGS += -O |
413 |
endif |
414 |
|
415 |
OBJ_DIR_PREFIX += obj |
416 |
|
417 |
ifeq ($(warn), no) |
418 |
ADDITIONAL_FLAGS += -UGSWARN |
419 |
else |
420 |
ADDITIONAL_FLAGS += -DGSWARN |
421 |
endif |
422 |
|
423 |
ifeq ($(diagnose), no) |
424 |
ADDITIONAL_FLAGS += -UGSDIAGNOSE |
425 |
else |
426 |
ADDITIONAL_FLAGS += -DGSDIAGNOSE |
427 |
endif |
428 |
|
429 |
ifneq ($(LIBRARY_NAME_SUFFIX),) |
430 |
LIBRARY_NAME_SUFFIX := _$(LIBRARY_NAME_SUFFIX) |
431 |
endif |
432 |
|
433 |
AUXILIARY_CPPFLAGS += $(GNUSTEP_DEFINE) \ |
434 |
$(FND_DEFINE) $(GUI_DEFINE) $(BACKEND_DEFINE) \ |
435 |
$(RUNTIME_DEFINE) $(FOUNDATION_LIBRARY_DEFINE) |
436 |
|
437 |
INTERNAL_OBJCFLAGS += $(ADDITIONAL_FLAGS) $(OPTFLAG) $(OBJCFLAGS) \ |
438 |
$(RUNTIME_FLAG) |
439 |
INTERNAL_CFLAGS += $(ADDITIONAL_FLAGS) $(CFLAGS) $(OPTFLAG) |
440 |
INTERNAL_LDFLAGS += $(LDFLAGS) |
441 |
|
442 |
# trick needed to replace a space with nothing |
443 |
empty:= |
444 |
space:= $(empty) $(empty) |
445 |
GNUSTEP_OBJ_PREFIX = $(subst $(space),,$(OBJ_DIR_PREFIX)) |
446 |
|
447 |
# |
448 |
# Support building of Multiple Architecture Binaries (MAB). The object files |
449 |
# directory will be something like shared_obj/ix86_m68k_sun/ |
450 |
# |
451 |
ifeq ($(arch),) |
452 |
ARCH_OBJ_DIR = $(GNUSTEP_TARGET_DIR) |
453 |
else |
454 |
ARCH_OBJ_DIR = \ |
455 |
$(shell echo $(CLEANED_ARCH) | sed -e 's/ /_/g')/$(GNUSTEP_TARGET_OS) |
456 |
endif |
457 |
|
458 |
ifeq ($(GNUSTEP_FLATTENED),) |
459 |
GNUSTEP_OBJ_DIR = $(GNUSTEP_OBJ_PREFIX)/$(ARCH_OBJ_DIR)/$(LIBRARY_COMBO) |
460 |
else |
461 |
GNUSTEP_OBJ_DIR = $(GNUSTEP_OBJ_PREFIX) |
462 |
endif |
463 |
|
464 |
# |
465 |
# Common variables for subprojects |
466 |
# |
467 |
SUBPROJECT_PRODUCT = subproject$(OEXT) |
468 |
|
469 |
# |
470 |
# Set JAVA_HOME if not set. |
471 |
# |
472 |
ifeq ($(JAVA_HOME),) |
473 |
# Else, try JDK_HOME |
474 |
ifeq ($(JDK_HOME),) |
475 |
# Else, try by finding the path of javac and removing 'bin/javac' from it |
476 |
ifeq ($(JAVAC),) |
477 |
JAVA_HOME = $(shell which javac | sed "s/bin\/javac//g") |
478 |
else # $(JAVAC) != "" |
479 |
JAVA_HOME = $(shell which $(JAVAC) | sed "s/bin\/javac//g") |
480 |
endif |
481 |
else # $(JDK_HOME) != "" |
482 |
JAVA_HOME = $(JDK_HOME) |
483 |
endif |
484 |
endif |
485 |
|
486 |
# |
487 |
# The java compiler. |
488 |
# |
489 |
ifeq ($(JAVAC),) |
490 |
JAVAC = $(JAVA_HOME)/bin/javac |
491 |
endif |
492 |
|
493 |
# |
494 |
# The java header compiler. |
495 |
# |
496 |
ifeq ($(JAVAH),) |
497 |
JAVAH = $(JAVA_HOME)/bin/javah |
498 |
endif |
499 |
|
500 |
# |
501 |
# Common variables - default values |
502 |
# |
503 |
# Because this file is included at the beginning of the user's |
504 |
# GNUmakefile, the user can override these variables by setting them |
505 |
# in the GNUmakefile. |
506 |
BUNDLE_EXTENSION = .bundle |
507 |
ifeq ($(profile), yes) |
508 |
APP_EXTENSION = profile |
509 |
else |
510 |
ifeq ($(debug), yes) |
511 |
APP_EXTENSION = debug |
512 |
else |
513 |
APP_EXTENSION = app |
514 |
endif |
515 |
endif |
516 |
|
517 |
|
518 |
|
519 |
# We want total control over GNUSTEP_INSTANCE. |
520 |
# GNUSTEP_INSTANCE determines wheter it's a Master or an Instance |
521 |
# invocation. Whenever we run a submake, we want it to be a Master |
522 |
# invocation, unless we specifically set it to run as an Instance |
523 |
# invocation by adding the GNUSTEP_INSTANCE=xxx flag. Tell make not |
524 |
# to mess with our games by passing this variable to submakes himself |
525 |
unexport GNUSTEP_INSTANCE |
526 |
unexport GNUSTEP_TYPE |
527 |
|
528 |
endif # COMMON_MAKE_LOADED |
529 |
|
530 |
## Local variables: |
531 |
## mode: makefile |
532 |
## End: |