bzr branch
http://suren.me/webbzr/ani/mrses
1
by Suren A. Chilingaryan
Initial import |
1 |
# --------------------------------------------------------------
|
2 |
# (C)Copyright 2001,2008,
|
|
3 |
# International Business Machines Corporation,
|
|
4 |
# Sony Computer Entertainment, Incorporated,
|
|
5 |
# Toshiba Corporation,
|
|
6 |
#
|
|
7 |
# All Rights Reserved.
|
|
8 |
# --------------------------------------------------------------
|
|
9 |
# PROLOG END TAG zYx
|
|
10 |
||
11 |
ifndef __MAKE_FOOTER__
|
|
12 |
__MAKE_FOOTER__ := 1 |
|
13 |
||
14 |
ifeq "$(MAKEFILE_LIST)" ""
|
|
15 |
||
16 |
########################################################################
|
|
17 |
# Makefile Version < 3.80
|
|
18 |
########################################################################
|
|
19 |
||
20 |
USR_LOCAL ?= /usr/local
|
|
21 |
MAKE_3_80 ?= $(firstword $(wildcard \ |
|
22 |
$(USR_LOCAL)/sti/bin/make \ |
|
23 |
$(USR_LOCAL)/sti/latest-sdk/bin/make \ |
|
24 |
$(USR_LOCAL)/sti/*/bin/make)) |
|
25 |
_MAKECMDGOALS := $(MAKECMDGOALS) |
|
26 |
||
27 |
$(warning $(MAKE) (v$(MAKE_VERSION)) is too old -- looking for v3.80) |
|
28 |
||
29 |
ifeq "$(MAKE_3_80)" ""
|
|
30 |
$(error "make" v3.80 not found) |
|
31 |
else
|
|
32 |
||
33 |
rerun_make $(_MAKECMDGOALS): |
|
34 |
@echo "Found $(MAKE_3_80)" |
|
35 |
@echo |
|
36 |
@echo "Automatically restarting make:"
|
|
37 |
@echo " $(MAKE_3_80) $(MAKECMDGOALS)" |
|
38 |
@echo |
|
39 |
@ $(MAKE_3_80) $(MAKECMDGOALS) |
|
40 |
endif
|
|
41 |
||
42 |
else
|
|
43 |
||
44 |
# At this point, make.footer is always the last one in MAKEFILE_LIST
|
|
45 |
make_footer := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) |
|
46 |
||
47 |
ifndef CELL_TOP
|
|
48 |
CELL_TOP_buildutils = $(dir $(make_footer)) |
|
49 |
export CELL_TOP = $(shell cd $(CELL_TOP_buildutils)/.. && pwd) |
|
50 |
endif
|
|
51 |
||
52 |
ifndef __MAKE_HEADER__
|
|
53 |
ifneq "$(MAKEFILE_LIST)" ""
|
|
54 |
include $(CELL_TOP)/buildutils/make.header
|
|
55 |
endif
|
|
56 |
endif
|
|
57 |
||
58 |
HOST_PROCESSOR := $(shell uname -m) |
|
59 |
||
60 |
PPU64_PROCESSOR_TYPE := $(shell grep "^cpu" /proc/cpuinfo | grep "Cell Broadband Engine" > /dev/null; if [ $$? = 0 ]; then echo "Cell"; fi) |
|
61 |
||
62 |
||
63 |
########################################################################
|
|
64 |
# Default Targets
|
|
65 |
########################################################################
|
|
66 |
||
67 |
all: dirs libraries programs misc_ install |
|
68 |
||
69 |
||
70 |
########################################################################
|
|
71 |
# Systemsim Hardware Simulator Defines
|
|
72 |
########################################################################
|
|
73 |
||
74 |
# The systemsim hardware simulator can be installed anywhere, but the default
|
|
75 |
# is to expect it with everything else.
|
|
76 |
||
77 |
ifndef SYSTEMSIM_TOP
|
|
78 |
SYSTEMSIM_TOP = /opt/ibm/systemsim-cell |
|
79 |
endif
|
|
80 |
||
81 |
SYSTEMSIM_INCLUDE_spu = $(SYSTEMSIM_TOP)/include/callthru/spu |
|
82 |
SYSTEMSIM_INCLUDE_ppu = $(SYSTEMSIM_TOP)/include/callthru |
|
83 |
SYSTEMSIM_INCLUDE_ppu64 = $(SYSTEMSIM_TOP)/include/callthru |
|
84 |
SYSTEMSIM_INCLUDE = $(SYSTEMSIM_INCLUDE_$(__tp__)) |
|
85 |
||
86 |
SYSTEMSIM_LINUX = $(SYSTEMSIM_TOP)/run/cell/linux |
|
87 |
||
88 |
||
89 |
########################################################################
|
|
90 |
# Common GNU Defines (Host, PPU32, PPU64, SPU)
|
|
91 |
########################################################################
|
|
92 |
||
93 |
PPU_PREFIX = ppu- |
|
94 |
PPU32_PREFIX = ppu32- |
|
95 |
||
96 |
PPU_TOOL_PREFIX = $(PPU_PREFIX) |
|
97 |
PPU32_TOOL_PREFIX = $(PPU32_PREFIX) |
|
98 |
||
99 |
ifeq "$(HOST_PROCESSOR)" "ppc64"
|
|
100 |
GNU_ROOT = |
|
101 |
GNU_SYSROOT = |
|
102 |
GNU_PPU_BINDIR = /usr/bin |
|
103 |
GNU_SPU_BINDIR = /usr/bin |
|
104 |
else
|
|
105 |
GNU_ROOT = /opt/cell/toolchain |
|
106 |
GNU_SYSROOT = /opt/cell/sysroot |
|
107 |
GNU_PPU_BINDIR = $(GNU_ROOT)/bin |
|
108 |
GNU_SPU_BINDIR = $(GNU_ROOT)/bin |
|
109 |
endif
|
|
110 |
||
111 |
SPU_TOOL_PREFIX = spu- |
|
112 |
||
113 |
PPU32_BINDIR = $(GNU_PPU_BINDIR) |
|
114 |
PPU64_BINDIR = $(GNU_PPU_BINDIR) |
|
115 |
SPU_BINDIR = $(GNU_SPU_BINDIR) |
|
116 |
||
117 |
ifndef CCACHE
|
|
118 |
export CCACHE := $(shell which ccache 2>/dev/null) |
|
119 |
endif
|
|
120 |
||
121 |
########################################################################
|
|
122 |
# Common Fortran Defines
|
|
123 |
########################################################################
|
|
124 |
||
125 |
FTN_SPU_BINDIR_xlf=/opt/cell/toolchain/bin |
|
126 |
FTN_PPU_BINDIR_xlf=/opt/cell/toolchain/bin |
|
127 |
FTN_BINDIR_gfortran=/usr/bin |
|
128 |
||
129 |
########################################################################
|
|
130 |
# Processor Targets
|
|
131 |
########################################################################
|
|
132 |
||
133 |
# Set what to build, and what processor to target
|
|
134 |
# Cross-Compile targets are ppu, ppu64, spu.
|
|
135 |
# Native targets include i686, ppc64.
|
|
136 |
||
137 |
||
138 |
#********************
|
|
139 |
# SPU Targets
|
|
140 |
#********************
|
|
141 |
||
142 |
SPU_TARGETS := $(strip $(PROGRAM_spu) \ |
|
143 |
$(PROGRAMS_spu) \ |
|
144 |
$(LIBRARY_spu) \ |
|
145 |
$(LIBRARY_embed) \ |
|
146 |
$(LIBRARY_embed64) \ |
|
147 |
$(SHARED_LIBRARY_embed) \ |
|
148 |
$(SHARED_LIBRARY_embed64)) |
|
149 |
||
150 |
ifdef SPU_TARGETS
|
|
151 |
TARGET_PROCESSOR := spu
|
|
152 |
endif
|
|
153 |
||
154 |
||
155 |
#********************
|
|
156 |
# 32-bit PPU Targets
|
|
157 |
#********************
|
|
158 |
||
159 |
PPU_TARGETS := $(strip $(PROGRAM_ppu) \ |
|
160 |
$(PROGRAMS_ppu) \ |
|
161 |
$(LIBRARY_ppu) \ |
|
162 |
$(SHARED_LIBRARY_ppu)) |
|
163 |
||
164 |
ifdef PPU_TARGETS
|
|
165 |
TARGET_PROCESSOR := ppu
|
|
166 |
endif
|
|
167 |
||
168 |
||
169 |
#********************
|
|
170 |
# 64-bit PPU Targets
|
|
171 |
#********************
|
|
172 |
||
173 |
PPU64_TARGETS := $(strip $(PROGRAM_ppu64) \ |
|
174 |
$(PROGRAMS_ppu64) \ |
|
175 |
$(LIBRARY_ppu64) \ |
|
176 |
$(SHARED_LIBRARY_ppu64)) |
|
177 |
||
178 |
ifdef PPU64_TARGETS
|
|
179 |
TARGET_PROCESSOR := ppu64
|
|
180 |
endif
|
|
181 |
||
182 |
||
183 |
#####################
|
|
184 |
# Host Targets
|
|
185 |
#####################
|
|
186 |
||
187 |
||
188 |
ifndef TARGET_PROCESSOR
|
|
189 |
TARGET_PROCESSOR := $(HOST_PROCESSOR) |
|
190 |
endif
|
|
191 |
||
192 |
ifeq "$(TARGET_PROCESSOR)" "host"
|
|
193 |
TARGET_PROCESSOR := $(HOST_PROCESSOR) |
|
194 |
endif
|
|
195 |
||
196 |
ifeq "$(TARGET_PROCESSOR)" "$(HOST_PROCESSOR)"
|
|
197 |
__host__ = 1 |
|
198 |
endif
|
|
199 |
||
200 |
||
201 |
##########################################################
|
|
202 |
# SPU Programs and Plugins Embedded in 32-bit PPU Objects
|
|
203 |
##########################################################
|
|
204 |
||
205 |
ifdef LIBRARY_embed
|
|
206 |
_EMBED = 1 |
|
207 |
endif
|
|
208 |
||
209 |
ifdef SHARED_LIBRARY_embed
|
|
210 |
_EMBED = 1 |
|
211 |
endif
|
|
212 |
||
213 |
||
214 |
##########################################################
|
|
215 |
# SPU Programs and Plugins Embedded in 64-bit PPU Objects
|
|
216 |
##########################################################
|
|
217 |
||
218 |
ifdef LIBRARY_embed64
|
|
219 |
_EMBED64 = 1 |
|
220 |
endif
|
|
221 |
||
222 |
ifdef SHARED_LIBRARY_embed64
|
|
223 |
_EMBED64 = 1 |
|
224 |
endif
|
|
225 |
||
226 |
||
227 |
#####################
|
|
228 |
# Generic Targets
|
|
229 |
#####################
|
|
230 |
||
231 |
__tp__ = $(TARGET_PROCESSOR) |
|
232 |
__$(__tp__)__ = 1 |
|
233 |
||
234 |
# __ppu__ means ppu32 and __ppu64__ means ppu64
|
|
235 |
# we want a generic 'ppu either 32 or 64' since make doesn't do
|
|
236 |
# ifdef __ppu__ or __ppu64__
|
|
237 |
ifdef __ppu__
|
|
238 |
__ppu3264__ = 1 |
|
239 |
endif
|
|
240 |
ifdef __ppu64__
|
|
241 |
__ppu3264__ = 1 |
|
242 |
endif
|
|
243 |
||
244 |
PROGRAM += $(PROGRAM_$(__tp__)) |
|
245 |
PROGRAMS += $(PROGRAMS_$(__tp__)) |
|
246 |
LIBRARY += $(LIBRARY_$(__tp__)) |
|
247 |
SHARED_LIBRARY += $(SHARED_LIBRARY_$(__tp__)) |
|
248 |
||
249 |
||
250 |
#*****************************
|
|
251 |
# Split the target name from
|
|
252 |
# its install directory
|
|
253 |
#*****************************
|
|
254 |
||
255 |
get_dir = $(strip $(subst ./,,$(dir $(1)))) |
|
256 |
get_name = $(notdir $(1)) |
|
257 |
||
258 |
ifneq "$(PROGRAM)" ""
|
|
259 |
_PROGRAM_dir := $(call get_dir, $(PROGRAM)) |
|
260 |
_PROGRAM := $(call get_name,$(PROGRAM)) |
|
261 |
endif
|
|
262 |
||
263 |
ifneq "$(PROGRAMS)" ""
|
|
264 |
_PROGRAMS_dirs := $(call get_dir, $(PROGRAMS)) |
|
265 |
_PROGRAMS := $(call get_name,$(PROGRAMS)) |
|
266 |
endif
|
|
267 |
||
268 |
ifneq "$(LIBRARY)" ""
|
|
269 |
_LIBRARY_dir := $(call get_dir, $(LIBRARY)) |
|
270 |
_LIBRARY := $(call get_name,$(LIBRARY)) |
|
271 |
endif
|
|
272 |
||
273 |
ifneq "$(LIBRARY_embed)" ""
|
|
274 |
_LIBRARY_embed_dir := $(call get_dir, $(LIBRARY_embed)) |
|
275 |
_LIBRARY_embed := $(call get_name,$(LIBRARY_embed)) |
|
276 |
endif
|
|
277 |
||
278 |
ifneq "$(LIBRARY_embed64)" ""
|
|
279 |
_LIBRARY_embed64_dir := $(call get_dir, $(LIBRARY_embed64)) |
|
280 |
_LIBRARY_embed64 := $(call get_name,$(LIBRARY_embed64)) |
|
281 |
endif
|
|
282 |
||
283 |
ifneq "$(SHARED_LIBRARY)" ""
|
|
284 |
_SHARED_LIBRARY_dir := $(call get_dir, $(SHARED_LIBRARY)) |
|
285 |
_SHARED_LIBRARY := $(call get_name,$(SHARED_LIBRARY)) |
|
286 |
endif
|
|
287 |
||
288 |
ifneq "$(SHARED_LIBRARY_embed)" ""
|
|
289 |
_SHARED_LIBRARY_embed_dir := $(call get_dir, $(SHARED_LIBRARY_embed)) |
|
290 |
_SHARED_LIBRARY_embed := $(call get_name,$(SHARED_LIBRARY_embed)) |
|
291 |
endif
|
|
292 |
||
293 |
ifneq "$(SHARED_LIBRARY_embed64)" ""
|
|
294 |
_SHARED_LIBRARY_embed64_dir := $(call get_dir, $(SHARED_LIBRARY_embed64)) |
|
295 |
_SHARED_LIBRARY_embed64 := $(call get_name,$(SHARED_LIBRARY_embed64)) |
|
296 |
endif
|
|
297 |
||
298 |
||
299 |
########################################################################
|
|
300 |
# SDK Defines
|
|
301 |
########################################################################
|
|
302 |
||
303 |
ROOT_SYSROOT ?= $(GNU_SYSROOT) |
|
304 |
||
305 |
ifeq "$(abspath $(CELL_TOP))" "/opt/cell/sdk"
|
|
306 |
# if this is the default case - building from/into /opt/cell/sdk
|
|
307 |
# (gotta be root, and not really recommended, since you will be
|
|
308 |
# overwriting files that were actually installed..)
|
|
309 |
CBE_SYSROOT =$(GNU_SYSROOT) |
|
310 |
else
|
|
311 |
# private sandbox build environment
|
|
312 |
# slighty different that the base case -- base/old has sysroot and sdk as
|
|
313 |
# directories at the same level. but that doesn't allow for having multiple
|
|
314 |
# different sandboxes. this does.
|
|
315 |
CBE_SYSROOT ?= $(CELL_TOP)/sysroot |
|
316 |
endif
|
|
317 |
||
318 |
OPTDIR = /opt/cell/sdk |
|
319 |
SDK_OPTDIR = $(CBE_SYSROOT)$(OPTDIR) |
|
320 |
||
321 |
# used for 'input/import' of the 'public' official stuff - simdmath, numa, etc
|
|
322 |
SDKBIN_spu = $(SDK_OPTDIR)/usr/spu/bin |
|
323 |
SDKBIN_ppu = $(SDK_OPTDIR)/usr/bin |
|
324 |
SDKBIN_ppu64 = $(SDK_OPTDIR)/usr/bin |
|
325 |
||
326 |
SDKINC_spu = $(ROOT_SYSROOT)/usr/spu/include |
|
327 |
SDKINC_ppu = $(ROOT_SYSROOT)/usr/include |
|
328 |
SDKINC_ppu64 = $(ROOT_SYSROOT)/usr/include |
|
329 |
||
330 |
SDKLIB_spu = $(ROOT_SYSROOT)/usr/spu/lib |
|
331 |
SDKLIB_ppu = $(ROOT_SYSROOT)/usr/lib |
|
332 |
SDKLIB_ppu64 = $(ROOT_SYSROOT)/usr/lib64 |
|
333 |
||
334 |
SDKBIN_host = $(CELL_TOP)/host/bin |
|
335 |
SDKINC_host = $(CELL_TOP)/host/include |
|
336 |
SDKLIB_host = $(CELL_TOP)/host/lib |
|
337 |
||
338 |
SDKBIN_$(HOST_PROCESSOR) = $(SDKBIN_host) |
|
339 |
SDKINC_$(HOST_PROCESSOR) = $(SDKINC_host) |
|
340 |
SDKLIB_$(HOST_PROCESSOR) = $(SDKLIB_host) |
|
341 |
||
342 |
SDKBIN = $(SDKBIN_$(__tp__)) |
|
343 |
SDKINC = $(SDKINC_$(__tp__)) |
|
344 |
SDKLIB = $(SDKLIB_$(__tp__)) |
|
345 |
SDKRPATH = $(subst $(ROOT_SYSROOT),,$(SDKLIB)) |
|
346 |
||
347 |
# used for 'input/import' of the 'example' stuff - libfft, libgmath, etc
|
|
348 |
SDKEXBIN_spu = $(SDK_OPTDIR)/usr/spu/bin |
|
349 |
SDKEXBIN_ppu = $(SDK_OPTDIR)/usr/bin |
|
350 |
SDKEXBIN_ppu64 = $(SDK_OPTDIR)/usr/bin |
|
351 |
||
352 |
SDKEXINC_spu = $(SDK_OPTDIR)/usr/spu/include |
|
353 |
SDKEXINC_ppu = $(SDK_OPTDIR)/usr/include |
|
354 |
SDKEXINC_ppu64 = $(SDK_OPTDIR)/usr/include |
|
355 |
||
356 |
SDKEXLIB_spu = $(SDK_OPTDIR)/usr/spu/lib |
|
357 |
SDKEXLIB_ppu = $(SDK_OPTDIR)/usr/lib |
|
358 |
SDKEXLIB_ppu64 = $(SDK_OPTDIR)/usr/lib64 |
|
359 |
||
360 |
SDKEXBIN_host = $(CELL_TOP)/host/bin |
|
361 |
SDKEXINC_host = $(CELL_TOP)/host/include |
|
362 |
SDKEXLIB_host = $(CELL_TOP)/host/lib |
|
363 |
SDKEXBIN_$(HOST_PROCESSOR) = $(SDKEXBIN_host) |
|
364 |
SDKEXINC_$(HOST_PROCESSOR) = $(SDKEXINC_host) |
|
365 |
SDKEXLIB_$(HOST_PROCESSOR) = $(SDKEXLIB_host) |
|
366 |
||
367 |
SDKEXBIN = $(SDKEXBIN_$(__tp__)) |
|
368 |
SDKEXINC = $(SDKEXINC_$(__tp__)) |
|
369 |
SDKEXLIB = $(SDKEXLIB_$(__tp__)) |
|
370 |
SDKEXRPATH = $(subst $(CBE_SYSROOT),,$(SDKEXLIB)) |
|
371 |
||
372 |
# used for 'input/import' of the 'prototype' stuff
|
|
373 |
PROTDIR = /opt/cell/sdk/prototype |
|
374 |
SDK_PROTDIR = $(CBE_SYSROOT)$(PROTDIR) |
|
375 |
||
376 |
SDKPRBIN_spu = $(SDK_PROTDIR)/usr/spu/bin |
|
377 |
SDKPRBIN_ppu = $(SDK_PROTDIR)/usr/bin |
|
378 |
SDKPRBIN_ppu64 = $(SDK_PROTDIR)/usr/bin |
|
379 |
||
380 |
SDKPRINC_spu = $(SDK_PROTDIR)/usr/spu/include |
|
381 |
SDKPRINC_ppu = $(SDK_PROTDIR)/usr/include |
|
382 |
SDKPRINC_ppu64 = $(SDK_PROTDIR)/usr/include |
|
383 |
||
384 |
SDKPRLIB_spu = $(SDK_PROTDIR)/usr/spu/lib |
|
385 |
SDKPRLIB_ppu = $(SDK_PROTDIR)/usr/lib |
|
386 |
SDKPRLIB_ppu64 = $(SDK_PROTDIR)/usr/lib64 |
|
387 |
||
388 |
SDKPRBIN_host = $(CELL_TOP)/host/bin |
|
389 |
SDKPRINC_host = $(CELL_TOP)/host/include |
|
390 |
SDKPRLIB_host = $(CELL_TOP)/host/lib |
|
391 |
SDKPRBIN_$(HOST_PROCESSOR) = $(SDKPRBIN_host) |
|
392 |
SDKPRINC_$(HOST_PROCESSOR) = $(SDKPRINC_host) |
|
393 |
SDKPRLIB_$(HOST_PROCESSOR) = $(SDKPRLIB_host) |
|
394 |
||
395 |
SDKPRBIN = $(SDKPRBIN_$(__tp__)) |
|
396 |
SDKPRINC = $(SDKPRINC_$(__tp__)) |
|
397 |
SDKPRLIB = $(SDKPRLIB_$(__tp__)) |
|
398 |
SDKPRRPATH = $(subst $(CBE_SYSROOT),,$(SDKPRLIB)) |
|
399 |
||
400 |
# used for build targets for examples, demos, libs
|
|
401 |
ifeq "$(abspath $(CELL_TOP))" "/opt/cell/sdk"
|
|
402 |
# if this is the default case - building from/into /opt/cell/sdk
|
|
403 |
# (gotta be root, and not really recommended, since you will be
|
|
404 |
# overwriting files that were actually installed..)
|
|
405 |
EXP_SYSROOT ?= $(GNU_SYSROOT) |
|
406 |
else
|
|
407 |
# private sandbox build environment
|
|
408 |
# slighty different that the base case -- base/old has sysroot and sdk as
|
|
409 |
# directories at the same level. but that doesn't allow for having multiple
|
|
410 |
# different sandboxes. this does.
|
|
411 |
EXP_SYSROOT ?= $(CELL_TOP)/sysroot |
|
412 |
endif
|
|
413 |
||
414 |
EXP_SDK_OPTDIR = $(EXP_SYSROOT)$(OPTDIR) |
|
415 |
||
416 |
EXP_SDKBIN_spu = $(EXP_SDK_OPTDIR)/usr/spu/bin |
|
417 |
EXP_SDKBIN_ppu = $(EXP_SDK_OPTDIR)/usr/bin |
|
418 |
EXP_SDKBIN_ppu64 = $(EXP_SDK_OPTDIR)/usr/bin |
|
419 |
||
420 |
EXP_SDKINC_spu = $(EXP_SDK_OPTDIR)/usr/spu/include |
|
421 |
EXP_SDKINC_ppu = $(EXP_SDK_OPTDIR)/usr/include |
|
422 |
EXP_SDKINC_ppu64 = $(EXP_SDK_OPTDIR)/usr/include |
|
423 |
||
424 |
EXP_SDKLIB_spu = $(EXP_SDK_OPTDIR)/usr/spu/lib |
|
425 |
EXP_SDKLIB_ppu = $(EXP_SDK_OPTDIR)/usr/lib |
|
426 |
EXP_SDKLIB_ppu64 = $(EXP_SDK_OPTDIR)/usr/lib64 |
|
427 |
||
428 |
EXP_SDKBIN_host = $(EXP_SYSROOT)/host/bin |
|
429 |
EXP_SDKINC_host = $(EXP_SYSROOT)/host/include |
|
430 |
EXP_SDKLIB_host = $(EXP_SYSROOT)/host/lib |
|
431 |
||
432 |
EXP_SDKBIN_$(HOST_PROCESSOR) = $(EXP_SDKBIN_host) |
|
433 |
EXP_SDKINC_$(HOST_PROCESSOR) = $(EXP_SDKINC_host) |
|
434 |
EXP_SDKLIB_$(HOST_PROCESSOR) = $(EXP_SDKLIB_host) |
|
435 |
||
436 |
EXP_SDKBIN = $(EXP_SDKBIN_$(__tp__)) |
|
437 |
EXP_SDKINC = $(EXP_SDKINC_$(__tp__)) |
|
438 |
EXP_SDKLIB = $(EXP_SDKLIB_$(__tp__)) |
|
439 |
||
440 |
# where prototype stuff ships
|
|
441 |
EXP_SDKPRBIN_spu = $(EXP_SDK_OPTDIR)/prototype/usr/spu/bin |
|
442 |
EXP_SDKPRBIN_ppu = $(EXP_SDK_OPTDIR)/prototype/usr/bin |
|
443 |
EXP_SDKPRBIN_ppu64 = $(EXP_SDK_OPTDIR)/prototype/usr/bin |
|
444 |
||
445 |
EXP_SDKPRINC_spu = $(EXP_SDK_OPTDIR)/prototype/usr/spu/include |
|
446 |
EXP_SDKPRINC_ppu = $(EXP_SDK_OPTDIR)/prototype/usr/include |
|
447 |
EXP_SDKPRINC_ppu64 = $(EXP_SDK_OPTDIR)/prototype/usr/include |
|
448 |
||
449 |
EXP_SDKPRLIB_spu = $(EXP_SDK_OPTDIR)/prototype/usr/spu/lib |
|
450 |
EXP_SDKPRLIB_ppu = $(EXP_SDK_OPTDIR)/prototype/usr/lib |
|
451 |
EXP_SDKPRLIB_ppu64 = $(EXP_SDK_OPTDIR)/prototype/usr/lib64 |
|
452 |
||
453 |
EXP_SDKPRBIN = $(EXP_SDKPRBIN_$(__tp__)) |
|
454 |
EXP_SDKPRINC = $(EXP_SDKPRINC_$(__tp__)) |
|
455 |
EXP_SDKPRLIB = $(EXP_SDKPRLIB_$(__tp__)) |
|
456 |
||
457 |
########################################################################
|
|
458 |
# Export Defines
|
|
459 |
########################################################################
|
|
460 |
||
461 |
# The absolute base to place built files in
|
|
462 |
#
|
|
463 |
BUILD_ROOT ?= $(CELL_TOP) |
|
464 |
||
465 |
# The directory to create the "export" directory in.
|
|
466 |
# This value defaults to BUILD_ROOT unless overridden by the
|
|
467 |
# user.
|
|
468 |
#
|
|
469 |
EXPORT_ROOT ?= $(BUILD_ROOT) |
|
470 |
||
471 |
# Base directories files are "exported" to:
|
|
472 |
#
|
|
473 |
EXPTOP := $(EXPORT_ROOT)/export |
|
474 |
EXPTOP_spu := $(EXPTOP)/cell/usr/spu |
|
475 |
EXPTOP_ppu := $(EXPTOP)/cell |
|
476 |
EXPTOP_ppu64 := $(EXPTOP)/cell |
|
477 |
EXPTOP_x86_64 := $(EXPTOP)/x86_64 |
|
478 |
EXPTOP_common := $(EXPTOP)/common |
|
479 |
||
480 |
# Locations of exported libraries:
|
|
481 |
#
|
|
482 |
EXPLIB_spu := $(EXPTOP_spu)/lib |
|
483 |
EXPLIB_ppu := $(EXPTOP_ppu)/usr/lib |
|
484 |
EXPLIB_ppu64 := $(EXPTOP_ppu64)/usr/lib64 |
|
485 |
EXPLIB_x86_64 := $(EXPTOP_x86_64)/usr/lib64 |
|
486 |
||
487 |
# Locations of exported include files:
|
|
488 |
#
|
|
489 |
EXPINC_spu := $(EXPTOP_spu)/include |
|
490 |
EXPINC_ppu := $(EXPTOP_ppu)/usr/include |
|
491 |
EXPINC_ppu64 := $(EXPTOP_ppu64)/usr/include |
|
492 |
EXPINC_x86_64 := $(EXPTOP_x86_64)/usr/include |
|
493 |
EXPINC_common := $(EXPTOP_common)/usr/include |
|
494 |
||
495 |
TEST_ROOT := $(EXPORT_ROOT)/tests |
|
496 |
||
497 |
# Locations of exported executables:
|
|
498 |
#
|
|
499 |
EXPBIN_spu := $(EXPTOP_spu)/bin |
|
500 |
EXPBIN_ppu := $(EXPTOP_ppu)/usr/bin |
|
501 |
EXPBIN_ppu64 := $(EXPTOP_ppu64)/usr/bin64 |
|
502 |
EXPBIN_x86_64 := $(EXPTOP_x86_64)/usr/bin64 |
|
503 |
||
504 |
||
505 |
########################################################################
|
|
506 |
# Targets
|
|
507 |
########################################################################
|
|
508 |
||
509 |
.PHONY: all dirs libraries programs misc_ install clean |
|
510 |
||
511 |
dirs: $(GNU_DIRS) $(DIRS) |
|
512 |
programs: $(PROGRAM) $(PROGRAMS) |
|
513 |
libraries: $(LIBRARY) $(SHARED_LIBRARY) \ |
|
514 |
$(LIBRARY_embed) $(SHARED_LIBRARY_embed) \ |
|
515 |
$(LIBRARY_embed64) $(SHARED_LIBRARY_embed64) |
|
516 |
misc_: $(OBJS_ONLY) $(HEADERS_ONLY) $(CONFIG_LOG) $(OTHER_TARGETS) |
|
517 |
||
518 |
TARGETS = $(PROGRAM) $(PROGRAMS) \ |
|
519 |
$(LIBRARY) $(SHARED_LIBRARY) \ |
|
520 |
$(LIBRARY_embed) $(SHARED_LIBRARY_embed) \ |
|
521 |
$(LIBRARY_embed64) $(SHARED_LIBRARY_embed64) \ |
|
522 |
$(OBJS_ONLY) $(HEADERS_ONLY) $(CONFIG_LOG) $(OTHER_TARGETS) |
|
523 |
||
524 |
LOCAL_TARGETS = $(_PROGRAM) $(_PROGRAMS) \ |
|
525 |
$(_LIBRARY) $(_SHARED_LIBRARY) \ |
|
526 |
$(_LIBRARY_embed) $(_SHARED_LIBRARY_embed) \ |
|
527 |
$(_LIBRARY_embed64) $(_SHARED_LIBRARY_embed64) \ |
|
528 |
$(_SHARED_LIBRARY_SONAME) $(_SHARED_LIBRARY_BASENAME) |
|
529 |
||
530 |
||
531 |
########################################################################
|
|
532 |
# Compilers
|
|
533 |
########################################################################
|
|
534 |
||
535 |
#################
|
|
536 |
# HOST Compiler
|
|
537 |
#################
|
|
538 |
||
539 |
||
540 |
ifdef __host__
|
|
541 |
ifeq "$(HOST_COMPILER)" "local"
|
|
542 |
TOOL_BINDIR = /usr/bin |
|
543 |
endif
|
|
544 |
||
545 |
TOOL_PREFIX = |
|
546 |
PATH := $(TOOL_BINDIR):$(SDKBIN_host):$(PATH) |
|
547 |
||
548 |
ifeq "$(CC)" "cc"
|
|
549 |
CC := $(CCACHE) $(TOOL_BINDIR)/gcc |
|
550 |
CXX := $(CCACHE) $(TOOL_BINDIR)/g++ |
|
551 |
endif
|
|
552 |
endif
|
|
553 |
||
554 |
||
555 |
#################
|
|
556 |
# SPU Compiler
|
|
557 |
#################
|
|
558 |
||
559 |
ifdef __spu__
|
|
560 |
TOOL_BINDIR = $(SPU_BINDIR) |
|
561 |
TOOL_PREFIX = $(SPU_TOOL_PREFIX) |
|
562 |
PATH := $(TOOL_BINDIR):$(PATH) |
|
563 |
||
564 |
ifeq "$(SPU_COMPILER)" "spuxlc"
|
|
565 |
SPU_COMPILER := xlc
|
|
566 |
endif
|
|
567 |
||
568 |
ifeq "$(SPU_COMPILER)" "xlc"
|
|
569 |
||
570 |
_XLC_VERSIONS := $(XLC_VERSION) |
|
571 |
_USING_XLC := 1 |
|
572 |
||
573 |
else
|
|
574 |
||
575 |
CC := $(CCACHE) $(TOOL_BINDIR)/$(TOOL_PREFIX)gcc |
|
576 |
CXX := $(CCACHE) $(TOOL_BINDIR)/$(TOOL_PREFIX)g++ |
|
577 |
||
578 |
ifeq "$(wildcard $(CC))" ""
|
|
579 |
$(warning $(CC) not found) |
|
580 |
endif
|
|
581 |
||
582 |
endif
|
|
583 |
||
584 |
XLC_PREFIX := spu
|
|
585 |
||
586 |
endif
|
|
587 |
||
588 |
||
589 |
#################
|
|
590 |
# PPU C Compiler
|
|
591 |
#################
|
|
592 |
||
593 |
ifdef __ppu__
|
|
594 |
TOOL_BINDIR = $(PPU32_BINDIR) |
|
595 |
TOOL_PREFIX = $(PPU32_TOOL_PREFIX) |
|
596 |
PATH := $(TOOL_BINDIR):$(PATH) |
|
597 |
||
598 |
ifeq "$(PPU32_COMPILER)" "ppuxlc"
|
|
599 |
PPU32_COMPILER := xlc
|
|
600 |
endif
|
|
601 |
||
602 |
ifeq "$(PPU32_COMPILER)" "xlc"
|
|
603 |
_XLC_VERSIONS := $(XLC_VERSION) |
|
604 |
_USING_XLC := 1 |
|
605 |
||
606 |
# xlc will get CC and CXX later
|
|
607 |
else
|
|
608 |
CC := $(CCACHE) $(TOOL_BINDIR)/$(PPU32_PREFIX)gcc |
|
609 |
CXX := $(CCACHE) $(TOOL_BINDIR)/$(PPU32_PREFIX)g++ |
|
610 |
||
611 |
ifeq "$(wildcard $(CC))" ""
|
|
612 |
$(warning $(CC) not found) |
|
613 |
endif
|
|
614 |
||
615 |
CPPFLAGS_gcc += -m32 |
|
616 |
||
617 |
ifeq "$(SYSTEMSIM_STANDALONE)" "1"
|
|
618 |
_INCLUDE += -I $(SYSTEMSIM_TOP)/include |
|
619 |
endif
|
|
620 |
endif
|
|
621 |
||
622 |
XLC_PREFIX := ppu
|
|
623 |
endif
|
|
624 |
||
625 |
||
626 |
###################
|
|
627 |
# PPU64 C Compiler
|
|
628 |
###################
|
|
629 |
||
630 |
ifdef __ppu64__
|
|
631 |
TOOL_BINDIR = $(PPU64_BINDIR) |
|
632 |
TOOL_PREFIX = $(PPU_TOOL_PREFIX) |
|
633 |
PATH := $(TOOL_BINDIR):$(PATH) |
|
634 |
||
635 |
ifeq "$(PPU64_COMPILER)" "xlc"
|
|
636 |
_XLC_VERSIONS := $(XLC_VERSION) |
|
637 |
_USING_XLC := 1 |
|
638 |
CPPFLAGS_xlc += -q64 |
|
639 |
||
640 |
# xlc will get CC and CXX later
|
|
641 |
else
|
|
642 |
CC := $(CCACHE) $(TOOL_BINDIR)/$(PPU_PREFIX)gcc |
|
643 |
CXX := $(CCACHE) $(TOOL_BINDIR)/$(PPU_PREFIX)g++ |
|
644 |
||
645 |
ifeq "$(wildcard $(CC))" ""
|
|
646 |
$(warning $(CC) not found) |
|
647 |
endif
|
|
648 |
||
649 |
endif
|
|
650 |
||
651 |
PATH := $(TOOL_BINDIR):$(PATH) |
|
652 |
XLC_PREFIX := ppu
|
|
653 |
endif
|
|
654 |
||
655 |
||
656 |
#################
|
|
657 |
# XLC C Compiler
|
|
658 |
#################
|
|
659 |
||
660 |
ifdef _USING_XLC
|
|
661 |
_USING_XL := 1 |
|
662 |
ifndef XLC_INSTALL_DIR
|
|
663 |
# check for xlc in the order specified
|
|
664 |
find_xlc = $(shell for i in $(1); do if [ -e $$i/bin/$(2)xlc ]; then echo "$$i"; exit; elif [ -e $$i/ship/bin/$(2)xlc ]; then echo "$$i/ship"; exit; fi; done) |
|
665 |
||
666 |
_XLC_VERSIONS := $(subst xlc/,/opt/ibmcmp/xlc/,$(_XLC_VERSIONS)) \ |
|
667 |
$(subst xlc/,$(USR_LOCAL)/xlc/,$(_XLC_VERSIONS)) |
|
668 |
||
669 |
XLC_INSTALL_DIR := $(call find_xlc,$(_XLC_VERSIONS),$(XLC_PREFIX)) |
|
670 |
export XLC_INSTALL_DIR
|
|
671 |
endif
|
|
672 |
||
673 |
ifeq "$(XLC_INSTALL_DIR)" ""
|
|
674 |
$(error Error: No $(XLC_PREFIX)xlc found. $(CELL_TOP)/buildutils/make.env specified these choices: $(addsuffix /bin/$(XLC_PREFIX)xlc,$(_XLC_VERSIONS))) |
|
675 |
else
|
|
676 |
CC := $(XLC_INSTALL_DIR)/bin/$(XLC_PREFIX)xlc |
|
677 |
CXX := $(XLC_INSTALL_DIR)/bin/$(XLC_PREFIX)xlc++ |
|
678 |
PATH := $(XLC_INSTALL_DIR)/bin:$(PATH) |
|
679 |
endif
|
|
680 |
endif
|
|
681 |
||
682 |
#########################
|
|
683 |
# Fortran HOST Compiler
|
|
684 |
#########################
|
|
685 |
||
686 |
ifdef __host__
|
|
687 |
||
688 |
ifeq "$(HOST_COMPILER)" "local"
|
|
689 |
FTN_TOOL_BINDIR = $(FTN_BINDIR_gfortran) |
|
690 |
FORTRAN := $(FTN_TOOL_BINDIR)/gfortran |
|
691 |
COMMON_FFLAGS += --fixed-line-length-0 |
|
692 |
_FFLAGS = $(COMMON_FFLAGS) $(FFLAGS) $(INCLUDE) |
|
693 |
endif
|
|
694 |
||
695 |
PATH := $(FTN_TOOL_BINDIR):$(PATH) |
|
696 |
||
697 |
#ifeq "$(wildcard $(FORTRAN))" ""
|
|
698 |
# $(warning $(FORTRAN) not found)
|
|
699 |
#endif
|
|
700 |
endif
|
|
701 |
||
702 |
#########################
|
|
703 |
# Fortran SPU Compiler
|
|
704 |
#########################
|
|
705 |
||
706 |
ifdef __spu__
|
|
707 |
||
708 |
ifeq "$(FTN_SPU_COMPILER)" "spuxlf"
|
|
709 |
FTN_SPU_COMPILER := xlf
|
|
710 |
endif
|
|
711 |
||
712 |
ifeq "$(FTN_SPU_COMPILER)" "xlf"
|
|
713 |
FTN_TOOL_BINDIR = $(FTN_SPU_BINDIR_xlf) |
|
714 |
_XLF_VERSIONS := $(XLF_VERSION) |
|
715 |
_USING_XLF := 1 |
|
716 |
COMMON_FFLAGS += -qextname |
|
717 |
_FFLAGS = $(COMMON_FFLAGS) $(FFLAGS) $(INCLUDE) |
|
718 |
||
719 |
else
|
|
720 |
ifeq "$(FTN_SPU_COMPILER)" "gfortran"
|
|
721 |
||
722 |
FORTRAN := $(TOOL_BINDIR)/$(SPU_TOOL_PREFIX)gfortran |
|
723 |
COMMON_FFLAGS += --fixed-line-length-0 |
|
724 |
_FFLAGS = $(COMMON_FFLAGS) $(FFLAGS) $(INCLUDE) |
|
725 |
||
726 |
#ifeq "$(wildcard $(FORTRAN))" ""
|
|
727 |
# $(warning $(FORTRAN) not found)
|
|
728 |
#endif
|
|
729 |
endif
|
|
730 |
endif
|
|
731 |
||
732 |
PATH := $(FTN_TOOL_BINDIR):$(PATH) |
|
733 |
||
734 |
XLF_PREFIX := spu
|
|
735 |
endif
|
|
736 |
||
737 |
########################
|
|
738 |
# Fortran PPU Compiler
|
|
739 |
########################
|
|
740 |
||
741 |
ifdef __ppu__
|
|
742 |
||
743 |
PATH := $(FTN_TOOL_BINDIR):$(PATH) |
|
744 |
||
745 |
ifeq "$(FTN_PPU32_COMPILER)" "ppuxlf"
|
|
746 |
FTN_PPU32_COMPILER := xlf
|
|
747 |
endif
|
|
748 |
||
749 |
ifeq "$(FTN_PPU32_COMPILER)" "xlf"
|
|
750 |
FTN_TOOL_BINDIR = $(FTN_PPU_BINDIR_xlf) |
|
751 |
||
752 |
_XLF_VERSIONS := $(XLF_VERSION) |
|
753 |
_USING_XLF := 1 |
|
754 |
COMMON_FFLAGS += -qextname -q32 |
|
755 |
_FFLAGS = $(COMMON_FFLAGS) $(FFLAGS) $(INCLUDE) |
|
756 |
else
|
|
757 |
ifeq "$(FTN_PPU32_COMPILER)" "gfortran"
|
|
758 |
FORTRAN := $(TOOL_BINDIR)/$(PPU_TOOL_PREFIX)gfortran |
|
759 |
COMMON_FFLAGS += --fixed-line-length-0 -m32 |
|
760 |
_FFLAGS = $(COMMON_FFLAGS) $(FFLAGS) $(INCLUDE) |
|
761 |
||
762 |
#ifeq "$(wildcard $(FORTRAN))" ""
|
|
763 |
# $(warning $(FORTRAN) not found on this machine)
|
|
764 |
#endif
|
|
765 |
endif
|
|
766 |
endif
|
|
767 |
||
768 |
XLF_PREFIX := ppu
|
|
769 |
endif
|
|
770 |
||
771 |
##########################
|
|
772 |
# Fortran PPU64 Compiler
|
|
773 |
##########################
|
|
774 |
||
775 |
ifdef __ppu64__
|
|
776 |
||
777 |
PATH := $(FTN_TOOL_BINDIR):$(PATH) |
|
778 |
||
779 |
ifeq "$(FTN_PPU64_COMPILER)" "ppuxlf"
|
|
780 |
FTN_PPU64_COMPILER := xlf
|
|
781 |
endif
|
|
782 |
||
783 |
ifeq "$(FTN_PPU64_COMPILER)" "xlf"
|
|
784 |
FTN_TOOL_BINDIR = $(FTN_PPU_BINDIR_xlf) |
|
785 |
_XLF_VERSIONS := $(XLF_VERSION) |
|
786 |
_USING_XLF := 1 |
|
787 |
COMMON_FFLAGS += -qextname -q64 |
|
788 |
_FFLAGS = $(COMMON_FFLAGS) $(FFLAGS) $(INCLUDE) |
|
789 |
else
|
|
790 |
ifeq "$(FTN_PPU64_COMPILER)" "gfortran"
|
|
791 |
FORTRAN := $(TOOL_BINDIR)/$(PPU_TOOL_PREFIX)gfortran |
|
792 |
COMMON_FFLAGS += --fixed-line-length-0 -m64 |
|
793 |
_FFLAGS = $(COMMON_FFLAGS) $(FFLAGS) $(INCLUDE) |
|
794 |
||
795 |
#ifeq "$(wildcard $(FORTRAN))" ""
|
|
796 |
# $(warning $(FORTRAN) not found on this machine)
|
|
797 |
#endif
|
|
798 |
endif
|
|
799 |
endif
|
|
800 |
||
801 |
XLF_PREFIX := ppu
|
|
802 |
endif
|
|
803 |
||
804 |
#################
|
|
805 |
# XLF Compiler
|
|
806 |
#################
|
|
807 |
||
808 |
ifdef _USING_XLF
|
|
809 |
_USING_XL := 1 |
|
810 |
ifndef XLF_INSTALL_DIR
|
|
811 |
# check for xlf in the order specified
|
|
812 |
find_xlf = $(shell for i in $(1); do if [ -e $$i/bin/$(2)xlf ]; then echo "$$i"; exit; elif [ -e $$i/ship/bin/$(2)xlf ]; then echo "$$i/ship"; exit; fi; done) |
|
813 |
||
814 |
_XLF_VERSIONS := $(subst xlf/,/opt/ibmcmp/xlf/,$(_XLF_VERSIONS)) \ |
|
815 |
$(subst xlf/,$(USR_LOCAL)/xlf/,$(_XLF_VERSIONS)) |
|
816 |
||
817 |
XLF_INSTALL_DIR := $(call find_xlf,$(_XLF_VERSIONS),$(XLF_PREFIX)) |
|
818 |
export XLF_INSTALL_DIR
|
|
819 |
endif
|
|
820 |
||
821 |
ifeq "$(XLF_INSTALL_DIR)" ""
|
|
822 |
$(error Error: No $(XLF_PREFIX)xlf found. $(CELL_TOP)/buildutils/make.env specified these choices: $(addsuffix /bin/$(XLF_PREFIX)xlf,$(_XLF_VERSIONS))) |
|
823 |
else
|
|
824 |
FORTRAN := $(XLF_INSTALL_DIR)/bin/$(XLF_PREFIX)xlf |
|
825 |
PATH := $(XLF_INSTALL_DIR)/bin:$(PATH) |
|
826 |
endif
|
|
827 |
endif
|
|
828 |
||
829 |
########################################################################
|
|
830 |
# Other Tools
|
|
831 |
########################################################################
|
|
832 |
||
833 |
PATH := .:$(PATH) |
|
834 |
||
835 |
AS := $(TOOL_BINDIR)/$(TOOL_PREFIX)as |
|
836 |
LD := $(TOOL_BINDIR)/$(TOOL_PREFIX)ld |
|
837 |
||
838 |
SPU_AR := $(GNU_SPU_BINDIR)/$(SPU_TOOL_PREFIX)ar |
|
839 |
PPU_AR := $(TOOL_BINDIR)/$(PPU_TOOL_PREFIX)ar |
|
840 |
HOST_AR := $(TOOL_BINDIR)/ar |
|
841 |
||
842 |
ifdef __spu__
|
|
843 |
AR := $(SPU_AR) |
|
844 |
else
|
|
845 |
ifdef __ppu__
|
|
846 |
AR := $(PPU_AR) |
|
847 |
else
|
|
848 |
ifdef __ppu64__
|
|
849 |
AR := $(PPU_AR) |
|
850 |
else
|
|
851 |
# host
|
|
852 |
AR := $(HOST_AR) |
|
853 |
endif
|
|
854 |
endif
|
|
855 |
endif
|
|
856 |
||
857 |
EMBEDSPU32 := $(GNU_PPU_BINDIR)/ppu-embedspu -m32 |
|
858 |
EMBEDSPU64 := $(GNU_PPU_BINDIR)/ppu-embedspu -m64 |
|
859 |
||
860 |
ifdef __ppu3264__
|
|
861 |
# these is only 1 version of these - ppu (not ppu32 and ppu)
|
|
862 |
OBJCOPY := $(TOOL_BINDIR)/$(PPU_TOOL_PREFIX)objcopy |
|
863 |
OBJDUMP := $(TOOL_BINDIR)/$(PPU_TOOL_PREFIX)objdump |
|
864 |
RANLIB := $(TOOL_BINDIR)/$(PPU_TOOL_PREFIX)ranlib |
|
865 |
READELF := $(TOOL_BINDIR)/$(PPU_TOOL_PREFIX)readelf |
|
866 |
else
|
|
867 |
OBJCOPY := $(TOOL_BINDIR)/$(TOOL_PREFIX)objcopy |
|
868 |
OBJDUMP := $(TOOL_BINDIR)/$(TOOL_PREFIX)objdump |
|
869 |
RANLIB := $(TOOL_BINDIR)/$(TOOL_PREFIX)ranlib |
|
870 |
READELF := $(TOOL_BINDIR)/$(TOOL_PREFIX)readelf |
|
871 |
endif
|
|
872 |
||
873 |
AWK := awk |
|
874 |
CP := cp -pfP |
|
875 |
FLEX := flex |
|
876 |
GZIP := gzip -f |
|
877 |
INDENT := indent -bad -bap -bbb -bli0 -cli4 -i4 -l80 -nip -pcs -psl -sob |
|
878 |
MKDIR := mkdir -p |
|
879 |
MV := mv |
|
880 |
PERL := perl |
|
881 |
RM := rm -f |
|
882 |
SED := sed |
|
883 |
SORT := sort |
|
884 |
TAR := tar |
|
885 |
TAR_GZIP := $(TAR) -z |
|
886 |
TAR_BZIP := $(TAR) -j |
|
887 |
YACC := yacc |
|
888 |
||
889 |
REMOVE_EMPTY_DIRECTORY := rmdir -p --ignore-fail-on-non-empty |
|
890 |
||
891 |
||
892 |
# Default to allowing a .i file to be compiled (i.e. #line are not added).
|
|
893 |
# If you want to see the files that the code comes from (i.e. add the #line)
|
|
894 |
# then set this value to 0
|
|
895 |
#
|
|
896 |
WANT_TO_COMPILE_I_FILE ?= 1 |
|
897 |
||
898 |
||
899 |
########################################################################
|
|
900 |
# VPATH
|
|
901 |
########################################################################
|
|
902 |
||
903 |
empty := |
|
904 |
space := $(empty) $(empty) |
|
905 |
||
906 |
_VPATH := $(subst $(space),:,$(strip $(VPATH))) |
|
907 |
VPATH := $(_VPATH) |
|
908 |
||
909 |
||
910 |
########################################################################
|
|
911 |
# Include Directories
|
|
912 |
########################################################################
|
|
913 |
||
914 |
_INCLUDE := -I. |
|
915 |
||
916 |
ifdef VPATH
|
|
917 |
_INCLUDE += -I $(subst :, -I ,$(VPATH)) |
|
918 |
endif
|
|
919 |
||
920 |
_INCLUDE += $(INCLUDE) |
|
921 |
||
922 |
ifdef __x86__
|
|
923 |
# Nvidia has updated OpenGL files -- use those if installed
|
|
924 |
NVIDIA_INCLUDE := $(wildcard /usr/share/doc/NVIDIA_GLX-1.0/include) |
|
925 |
ifneq "$(NVIDIA_INCLUDE)" ""
|
|
926 |
_INCLUDE += -I $(NVIDIA_INCLUDE) |
|
927 |
endif
|
|
928 |
endif
|
|
929 |
||
930 |
# don't include this if its one of the standard locations
|
|
931 |
ifneq "$(ROOT_SYSROOT)" "$(GNU_SYSROOT)"
|
|
932 |
_INCLUDE += -I $(SDKINC) |
|
933 |
endif
|
|
934 |
||
935 |
_INCLUDE += -I $(SDKEXINC) |
|
936 |
||
937 |
PREV_DIR_1 = $(dir $(CURDIR)) |
|
938 |
PREV_DIR_2 = $(dir $(PREV_DIR_1:%/=%)) |
|
939 |
||
940 |
||
941 |
########################################################################
|
|
942 |
# Preprocessor Flags
|
|
943 |
########################################################################
|
|
944 |
ifeq "$(SYSTEMSIM_STANDALONE)" "1"
|
|
945 |
TEXT_ADDRESS ?= 0x1000
|
|
946 |
endif
|
|
947 |
||
948 |
||
949 |
||
950 |
ifdef _USING_XLC
|
|
951 |
#----------------------------------
|
|
952 |
# XLC-Specific Preprocessor Flags
|
|
953 |
#----------------------------------
|
|
954 |
# CPPFLAGS_xlc - User-defined in Makefile for xlc only
|
|
955 |
# -qcpluscmt - Allow // as a comment
|
|
956 |
# -M - Create a dependency file while compiling
|
|
957 |
# -ma - Generate inline calls to the "alloca" function
|
|
958 |
||
959 |
COMPILER_CPPFLAGS = $(CPPFLAGS_xlc) \ |
|
960 |
-qcpluscmt -M -ma |
|
961 |
C_COMPILER_LDFLAGS = $(LDFLAGS_xlc) |
|
962 |
||
963 |
ifdef __ppu3264__
|
|
964 |
VECTOR_FLAG = -qaltivec -qenablevmx |
|
965 |
||
966 |
ifeq "$(SYSTEMSIM_STANDALONE)" "1"
|
|
967 |
STANDALONE_LDFLAGS += -qnocrt -qstaticlink -Wl,-Ttext=$(TEXT_ADDRESS) |
|
968 |
endif
|
|
969 |
||
970 |
endif
|
|
971 |
ifdef __ppu__
|
|
972 |
C_COMPILER_LDFLAGS += -Wl,-m,elf32ppc |
|
973 |
endif
|
|
974 |
ifdef __ppu64__
|
|
975 |
C_COMPILER_LDFLAGS += -q64 -Wl,-m,elf64ppc |
|
976 |
endif
|
|
977 |
else
|
|
978 |
#----------------------------------
|
|
979 |
# GCC-Specific Preprocessor Flags
|
|
980 |
#----------------------------------
|
|
981 |
# CPPFLAGS_gcc - User-defined in Makefile for gcc only
|
|
982 |
# -W - Enable extra warnings
|
|
983 |
# -Wall - Enable all preprocessor warnings
|
|
984 |
# -Winline - Warn when inlined function cannot be inlined
|
|
985 |
||
986 |
COMPILER_CPPFLAGS = $(CPPFLAGS_gcc) |
|
987 |
C_COMPILER_LDFLAGS = $(LDFLAGS_gcc) |
|
988 |
WARNING_FLAGS ?= -W -Wall -Winline
|
|
989 |
||
990 |
ifdef __ppu3264__
|
|
991 |
VECTOR_FLAG = -mabi=altivec -maltivec |
|
992 |
||
993 |
ifeq "$(SYSTEMSIM_STANDALONE)" "1"
|
|
994 |
C_COMPILER_LDFLAGS += -nostartfiles -static -Wl,-Ttext=$(TEXT_ADDRESS) |
|
995 |
endif
|
|
996 |
endif
|
|
997 |
ifdef __ppu__
|
|
998 |
C_COMPILER_LDFLAGS += -m32 -Wl,-m,elf32ppc |
|
999 |
endif
|
|
1000 |
endif
|
|
1001 |
||
1002 |
COMMON_CPPFLAGS = $(NO_STDINC) \ |
|
1003 |
$(USE_VPATH) \ |
|
1004 |
$(WARNING_FLAGS) \ |
|
1005 |
$(COMPILER_CPPFLAGS) |
|
1006 |
||
1007 |
_SPPFLAGS = $(CPPFLAGS_$(@:.o=)) \ |
|
1008 |
$(CPPFLAGS_$(@:.s=)) \ |
|
1009 |
$(CPPFLAGS_$(@:.i=)) \ |
|
1010 |
$(CPPFLAGS_$(@:.d=)) \ |
|
1011 |
$(CPPFLAGS) \ |
|
1012 |
$(COMMON_CPPFLAGS) \ |
|
1013 |
$(_INCLUDE) |
|
1014 |
||
1015 |
_CPPFLAGS = $(_SPPFLAGS) \ |
|
1016 |
$(VECTOR_FLAG) |
|
1017 |
||
1018 |
########################################################################
|
|
1019 |
# Compiler Flags
|
|
1020 |
########################################################################
|
|
1021 |
||
1022 |
||
1023 |
ifdef _USING_XLC
|
|
1024 |
COMPILER_CFLAGS = $(CFLAGS_xlc) |
|
1025 |
CFLAGS_so ?= -qpic
|
|
1026 |
NOSTARTFILES := -qnocrt
|
|
1027 |
NOSTDLIB := -qnolib
|
|
1028 |
||
1029 |
ifdef __spu__
|
|
1030 |
CC_OPT_LEVEL_DEBUG := -g -qnoopt
|
|
1031 |
endif
|
|
1032 |
else
|
|
1033 |
COMPILER_CFLAGS := $(CFLAGS_gcc) |
|
1034 |
CFLAGS_so ?= -fpic
|
|
1035 |
NOSTARTFILES := -nostartfiles
|
|
1036 |
NOSTDLIB := -nostdlib
|
|
1037 |
endif
|
|
1038 |
||
1039 |
ifdef _SHARED_LIBRARY
|
|
1040 |
COMPILER_CFLAGS += $(CFLAGS_so) |
|
1041 |
endif
|
|
1042 |
||
1043 |
ifndef CC_OPT_LEVEL_DEBUG
|
|
1044 |
CC_OPT_LEVEL_DEBUG := -g -O0
|
|
1045 |
endif
|
|
1046 |
||
1047 |
ifndef CC_OPT_LEVEL
|
|
1048 |
ifdef _USING_XLC
|
|
1049 |
CC_OPT_LEVEL := -O3
|
|
1050 |
else
|
|
1051 |
CC_OPT_LEVEL := -O3
|
|
1052 |
endif
|
|
1053 |
endif
|
|
1054 |
||
1055 |
COMMON_CFLAGS := $(CC_OPT_LEVEL) $(COMPILER_CFLAGS) |
|
1056 |
||
1057 |
_CFLAGS_ = $(CFLAGS_$(@:.o=)) \ |
|
1058 |
$(CFLAGS) \ |
|
1059 |
$(COMMON_CFLAGS) |
|
1060 |
||
1061 |
ifdef _USING_XLC
|
|
1062 |
_CFLAGS = $(_CFLAGS_:-fno-inline=-qnoinline) |
|
1063 |
else
|
|
1064 |
_CFLAGS = $(_CFLAGS_:-qnoinline=-fno-inline) |
|
1065 |
endif
|
|
1066 |
||
1067 |
COMMON_CXXFLAGS := $(CC_OPT_LEVEL) $(COMPILER_CFLAGS) |
|
1068 |
||
1069 |
_CXXFLAGS_ = $(CXXFLAGS_$(@:.o=)) \ |
|
1070 |
$(CXXFLAGS) \ |
|
1071 |
$(COMMON_CXXFLAGS) |
|
1072 |
||
1073 |
ifdef _USING_XLC
|
|
1074 |
_CXXFLAGS = $(_CXXFLAGS_:-fno-inline=-qnoinline) |
|
1075 |
else
|
|
1076 |
_CXXFLAGS = $(_CXXFLAGS_:-qnoinline=-fno-inline) |
|
1077 |
endif
|
|
1078 |
||
1079 |
ifdef __spu__
|
|
1080 |
ifndef _USING_XLC
|
|
1081 |
_CXXFLAGS += -fno-exceptions -fno-rtti |
|
1082 |
endif
|
|
1083 |
endif
|
|
1084 |
||
1085 |
||
1086 |
########################################################################
|
|
1087 |
# Assembly Flags
|
|
1088 |
########################################################################
|
|
1089 |
||
1090 |
COMMON_ASFLAGS = |
|
1091 |
||
1092 |
ifdef __ppu__
|
|
1093 |
ifeq "$(PPU32_COMPILER)" "cell"
|
|
1094 |
COMMON_ASFLAGS += -a32 |
|
1095 |
endif
|
|
1096 |
endif
|
|
1097 |
||
1098 |
_ASFLAGS = $(ASFLAGS_$(@:.o=)) \ |
|
1099 |
$(ASFLAGS) \ |
|
1100 |
$(COMMON_ASFLAGS) \ |
|
1101 |
$(_INCLUDE) |
|
1102 |
||
1103 |
||
1104 |
########################################################################
|
|
1105 |
# Imported Libraries
|
|
1106 |
########################################################################
|
|
1107 |
||
1108 |
ifdef IMPORTS
|
|
1109 |
_IMPORTS := $(filter-out -l%,$(IMPORTS)) |
|
1110 |
SYS_LIBS += $(filter -l%,$(IMPORTS)) |
|
1111 |
endif
|
|
1112 |
||
1113 |
ifdef _PROGRAMS
|
|
1114 |
# This is in addition to IMPORTS, which applies to all PROGRAMS
|
|
1115 |
PER_FILE_IMPORTS := $(foreach prog,$(_PROGRAMS),$(IMPORTS_$(prog))) |
|
1116 |
_PER_FILE_IMPORTS := $(filter-out -l%,$(PER_FILE_IMPORTS)) |
|
1117 |
PER_FILE_SYS_LIBS := $(filter -l%,$(PER_FILE_IMPORTS)) |
|
1118 |
endif
|
|
1119 |
||
1120 |
||
1121 |
########################################################################
|
|
1122 |
# Link Flags
|
|
1123 |
########################################################################
|
|
1124 |
||
1125 |
ifndef _USING_XLC
|
|
1126 |
ifdef STRIP_PROGRAM
|
|
1127 |
STRIP_FLAG := -Wl,-s
|
|
1128 |
endif
|
|
1129 |
||
1130 |
ifdef MAPFILE
|
|
1131 |
_MAP_FLAG := -Wl,-Map,$(MAPFILE) |
|
1132 |
endif
|
|
1133 |
endif
|
|
1134 |
||
1135 |
ifdef _USING_XLF
|
|
1136 |
ifdef __spu__
|
|
1137 |
FTN_COMPILER_LDFLAGS := -L $(XLF_INSTALL_DIR)/spu/lib/ -R $(XLF_INSTALL_DIR)/spu/lib/ |
|
1138 |
else
|
|
1139 |
ifdef __ppc64__
|
|
1140 |
FTN_COMPILER_LDFLAGS := -L $(XLF_INSTALL_DIR)/lib64/ -R $(XLF_INSTALL_DIR)/lib64/ |
|
1141 |
else
|
|
1142 |
ifdef __ppu64__
|
|
1143 |
FTN_COMPILER_LDFLAGS := -L $(XLF_INSTALL_DIR)/lib64/ -R $(XLF_INSTALL_DIR)/lib64/ |
|
1144 |
FTN_COMPILER_LDFLAGS += -q64 -Wl,-m,elf64ppc |
|
1145 |
else
|
|
1146 |
FTN_COMPILER_LDFLAGS := -L $(XLF_INSTALL_DIR)/lib/ -R $(XLF_INSTALL_DIR)/lib/ |
|
1147 |
FTN_COMPILER_LDFLAGS += -Wl,-m,elf32ppc |
|
1148 |
endif
|
|
1149 |
endif
|
|
1150 |
endif
|
|
1151 |
FTN_COMPILER_LDFLAGS += -lxlf90 |
|
1152 |
else # gfortran
|
|
1153 |
ifdef __ppu__
|
|
1154 |
FTN_COMPILER_LDFLAGS += -m32 -Wl,-m,elf32ppc |
|
1155 |
endif
|
|
1156 |
endif
|
|
1157 |
||
1158 |
COMMON_LDFLAGS = $(STRIP_FLAG) $(_MAP_FLAG) |
|
1159 |
||
1160 |
ifneq "$(SYS_LIBS)$(PER_FILE_SYS_LIBS)" ""
|
|
1161 |
# don't include this if its one of the standard locations
|
|
1162 |
ifneq "$(ROOT_SYSROOT)" "$(GNU_SYSROOT)"
|
|
1163 |
COMMON_LDFLAGS += -L$(SDKLIB_$(__tp__)) |
|
1164 |
endif
|
|
1165 |
COMMON_LDFLAGS += -L$(SDKEXLIB_$(__tp__)) |
|
1166 |
ifdef __host__
|
|
1167 |
ifneq "$(filter -lX%,$(SYS_LIBS))" ""
|
|
1168 |
MULTI_OS_DIR = $(shell $(CC) -print-multi-os-directory 2>/dev/null) |
|
1169 |
COMMON_LDFLAGS += -L/usr/X11R6/lib/$(MULTI_OS_DIR) |
|
1170 |
endif
|
|
1171 |
endif
|
|
1172 |
endif
|
|
1173 |
||
1174 |
ifdef __spu__
|
|
1175 |
# Until we have an SPU loader capable of performing runtime relocations
|
|
1176 |
# as needed (feature 4758), we will collapse the text and data segments on
|
|
1177 |
# all SPU executables by default.
|
|
1178 |
COMMON_LDFLAGS += -Wl,-N |
|
1179 |
endif
|
|
1180 |
||
1181 |
ifdef START_FILE
|
|
1182 |
COMMON_LDFLAGS += $(NOSTARTFILES) |
|
1183 |
endif
|
|
1184 |
||
1185 |
# fun with sonames.
|
|
1186 |
# if defined SHARED_LIBRARY_SONAME and SHARED_LIBRARY_VERSION
|
|
1187 |
# real file is libfoo.so.#.#
|
|
1188 |
# create ln -s libfoo.so libfoo.so.#.#
|
|
1189 |
# create ln -s libfoo.so.# libfoo.so.#.#
|
|
1190 |
#
|
|
1191 |
# if defined SHARED_LIBRARY_VERSION ONLY
|
|
1192 |
# real file is libfoo.so.#.#
|
|
1193 |
# create ln -s libfoo.so libfoo.so.#.#
|
|
1194 |
#
|
|
1195 |
# if defined SHARED_LIBRARY_SONAME ONLY
|
|
1196 |
# real file is libfoo.so.#
|
|
1197 |
# create ln -s libfoo.so libfoo.so.#
|
|
1198 |
||
1199 |
ifdef SHARED_LIBRARY_VERSION
|
|
1200 |
#define targets for library link
|
|
1201 |
_SHARED_LIBRARY_BASENAME := $(_SHARED_LIBRARY:.so.$(SHARED_LIBRARY_VERSION)=.so) |
|
1202 |
||
1203 |
_SHARED_LIBRARY_VERSION := $(_SHARED_LIBRARY_BASENAME).$(SHARED_LIBRARY_VERSION) |
|
1204 |
INSTALL_FILES += $(_SHARED_LIBRARY_BASENAME) |
|
1205 |
$(_SHARED_LIBRARY_BASENAME): $(_SHARED_LIBRARY_SONAME) |
|
1206 |
ln -s $(_SHARED_LIBRARY_VERSION) $(_SHARED_LIBRARY_BASENAME) |
|
1207 |
||
1208 |
ifdef SHARED_LIBRARY_SONAME
|
|
1209 |
# sanity check - SONAME can't be equal to VERSION
|
|
1210 |
ifeq "$(SHARED_LIBRARY_SONAME)" "$(SHARED_LIBRARY_VERSION)"
|
|
1211 |
$(error SHARED_LIBRARY_SONAME can't be same as SHARED_LIBRARY_VERSION ) |
|
1212 |
endif
|
|
1213 |
#define targets for library link
|
|
1214 |
_SHARED_LIBRARY_SONAME := $(_SHARED_LIBRARY_BASENAME).$(SHARED_LIBRARY_SONAME) |
|
1215 |
INSTALL_FILES += $(_SHARED_LIBRARY_SONAME) |
|
1216 |
$(_SHARED_LIBRARY_SONAME): $(_SHARED_LIBRARY_BASENAME) |
|
1217 |
ln -s $(_SHARED_LIBRARY_VERSION) $(_SHARED_LIBRARY_SONAME) |
|
1218 |
else
|
|
1219 |
||
1220 |
_SHARED_LIBRARY_SONAME := $(_SHARED_LIBRARY) |
|
1221 |
||
1222 |
endif
|
|
1223 |
||
1224 |
else
|
|
1225 |
||
1226 |
ifdef SHARED_LIBRARY_SONAME
|
|
1227 |
#define targets for library link
|
|
1228 |
_SHARED_LIBRARY_BASENAME := $(_SHARED_LIBRARY:.so.$(SHARED_LIBRARY_SONAME)=.so) |
|
1229 |
_SHARED_LIBRARY_SONAME := $(_SHARED_LIBRARY_BASENAME).$(SHARED_LIBRARY_SONAME) |
|
1230 |
INSTALL_FILES += $(_SHARED_LIBRARY_BASENAME) |
|
1231 |
$(_SHARED_LIBRARY_BASENAME): $(_SHARED_LIBRARY_BASENAME) |
|
1232 |
ln -s $(_SHARED_LIBRARY_SONAME) $(_SHARED_LIBRARY_BASENAME) |
|
1233 |
||
1234 |
else
|
|
1235 |
||
1236 |
_SHARED_LIBRARY_SONAME := $(_SHARED_LIBRARY) |
|
1237 |
||
1238 |
endif
|
|
1239 |
||
1240 |
endif
|
|
1241 |
||
1242 |
ifdef __spu__
|
|
1243 |
SHARED_LDFLAGS := -shared -soname=$(_SHARED_LIBRARY_embed) |
|
1244 |
endif
|
|
1245 |
||
1246 |
ifdef __ppu__
|
|
1247 |
SHARED_LDFLAGS := -shared -soname=$(_SHARED_LIBRARY_SONAME) -m elf32ppc |
|
1248 |
COMMON_LDFLAGS += -R$(SDKEXRPATH) |
|
1249 |
endif
|
|
1250 |
||
1251 |
ifdef __ppu64__
|
|
1252 |
SHARED_LDFLAGS := -shared -soname=$(_SHARED_LIBRARY_SONAME) -m elf64ppc |
|
1253 |
COMMON_LDFLAGS += -R$(SDKEXRPATH) |
|
1254 |
endif
|
|
1255 |
||
1256 |
ifdef __host__
|
|
1257 |
SHARED_LDFLAGS := -shared -soname=$(_SHARED_LIBRARY_SONAME) |
|
1258 |
endif
|
|
1259 |
||
1260 |
||
1261 |
_LDFLAGS = $(LDFLAGS_$@) \ |
|
1262 |
$(LDFLAGS) \ |
|
1263 |
$(STANDALONE_LDFLAGS) \ |
|
1264 |
$(COMMON_LDFLAGS) |
|
1265 |
||
1266 |
||
1267 |
########################################################################
|
|
1268 |
# Source Rules
|
|
1269 |
########################################################################
|
|
1270 |
||
1271 |
SRC_BUILT_HERE = $(C_BUILT_HERE) $(S_BUILT_HERE) $(H_BUILT_HERE) $(F_BUILT_HERE) $(CXX_BUILT_HERE) |
|
1272 |
||
1273 |
||
1274 |
########################################################################
|
|
1275 |
# Object Rules
|
|
1276 |
########################################################################
|
|
1277 |
||
1278 |
ifneq "$(PROGRAM)$(LIBRARY)$(_SHARED_LIBRARY)" ""
|
|
1279 |
ifndef OBJS
|
|
1280 |
IMPLICIT_OBJS := 1 |
|
1281 |
endif
|
|
1282 |
endif
|
|
1283 |
||
1284 |
ifdef VPATH
|
|
1285 |
all_src = $(sort $(notdir $(foreach path,. $(subst :, ,$(VPATH)),$(wildcard $(path)/*.$(1))))) |
|
1286 |
else
|
|
1287 |
all_src = $(wildcard *.$(1)) |
|
1288 |
endif
|
|
1289 |
||
1290 |
CXX_SRC1 = $(call all_src,C) $(CXX_BUILT_HERE) |
|
1291 |
CXX_SRC2 = $(call all_src,cpp) |
|
1292 |
CXX_SRC3 = $(call all_src,cc) |
|
1293 |
CXX_SRC4 = $(call all_src,cxx) |
|
1294 |
CXX_OBJS = $(strip $(CXX_SRC1:.C=.o) $(CXX_SRC2:.cpp=.o) \ |
|
1295 |
$(CXX_SRC3:.cc=.o) $(CXX_SRC4:.cxx=.o)) |
|
1296 |
||
1297 |
FTN_SRC1 = $(call all_src,f) $(F_BUILT_HERE) |
|
1298 |
FTN_SRC2 = $(call all_src,f90) |
|
1299 |
FTN_OBJS = $(strip $(FTN_SRC1:.f=.o) $(FTN_SRC2:.f90=.o)) |
|
1300 |
||
1301 |
ifdef IMPLICIT_OBJS
|
|
1302 |
# if no OBJS specified, assume what they are
|
|
1303 |
# For a single programs, assume all .c .s source files will be used
|
|
1304 |
||
1305 |
C_SRC := $(call all_src,c) $(C_BUILT_HERE) |
|
1306 |
S_SRC := $(call all_src,S) $(S_BUILT_HERE) |
|
1307 |
AS_SRC := $(call all_src,s) |
|
1308 |
||
1309 |
C_OBJS := $(C_SRC:.c=.o) |
|
1310 |
S_OBJS := $(S_SRC:.S=.o) |
|
1311 |
AS_OBJS := $(AS_SRC:.s=.o) |
|
1312 |
||
1313 |
OBJS := $(strip $(C_OBJS) $(S_OBJS) $(AS_OBJS) $(CXX_OBJS) $(FTN_OBJS)) |
|
1314 |
endif
|
|
1315 |
||
1316 |
ifdef _PROGRAMS
|
|
1317 |
# Objects can be explicitly declared as OBJS_program, where program is
|
|
1318 |
# the name of one of the programs. If no objects are explictly declared,
|
|
1319 |
# then it is assumed that program is created from program.o.
|
|
1320 |
||
1321 |
OBJS := $(foreach prog,$(_PROGRAMS),$(if $(OBJS_$(prog)),$(OBJS_$(prog)),$(prog).o)) |
|
1322 |
endif
|
|
1323 |
||
1324 |
ifdef _EMBED
|
|
1325 |
EMBED_OBJS = $(patsubst %,%-embed.o,$(_PROGRAM) $(_PROGRAMS)) |
|
1326 |
EMBED_OBJS_V = $(filter $(addprefix %/,$(EMBED_OBJS)) $(EMBED_OBJS),$^) |
|
1327 |
endif
|
|
1328 |
||
1329 |
ifdef _EMBED64
|
|
1330 |
EMBED64_OBJS = $(patsubst %,%-embed64.o,$(_PROGRAM) $(_PROGRAMS)) |
|
1331 |
EMBED64_OBJS_V = $(filter $(addprefix %/,$(EMBED64_OBJS)) $(EMBED64_OBJS),$^) |
|
1332 |
endif
|
|
1333 |
||
1334 |
ifdef OBJS
|
|
1335 |
# This includes the full path of each object (needed for clone trees & VPATH)
|
|
1336 |
OBJS_V = $(filter $(addprefix %/,$(OBJS)) $(OBJS),$^) |
|
1337 |
endif
|
|
1338 |
||
1339 |
ifdef START_FILE
|
|
1340 |
START_FILE_V = $(filter $(addprefix %/,$(START_FILE)) $(START_FILE),$^) |
|
1341 |
endif
|
|
1342 |
||
1343 |
########################################################################
|
|
1344 |
# Implicit Rules
|
|
1345 |
########################################################################
|
|
1346 |
||
1347 |
#*************************************
|
|
1348 |
# Create Objects (.o)
|
|
1349 |
#*************************************
|
|
1350 |
||
1351 |
#----------
|
|
1352 |
# C
|
|
1353 |
#----------
|
|
1354 |
%.o: %.c |
|
1355 |
$(CC) $(_CPPFLAGS) $(_CFLAGS) -c $< |
|
1356 |
||
1357 |
#----------
|
|
1358 |
# C++
|
|
1359 |
#----------
|
|
1360 |
%.o: %.C |
|
1361 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) -c $< |
|
1362 |
||
1363 |
%.o: %.cpp |
|
1364 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) -c $< |
|
1365 |
||
1366 |
%.o: %.cc |
|
1367 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) -c $< |
|
1368 |
||
1369 |
%.o: %.cxx |
|
1370 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) -c $< |
|
1371 |
||
1372 |
#----------
|
|
1373 |
# Fortran
|
|
1374 |
#----------
|
|
1375 |
||
1376 |
%.o: %.f |
|
1377 |
$(FORTRAN) $(_FFLAGS) -c $< |
|
1378 |
||
1379 |
%.o: %.f90 |
|
1380 |
$(FORTRAN) $(_FFLAGS) -c $< |
|
1381 |
||
1382 |
#----------
|
|
1383 |
# Assembly
|
|
1384 |
#----------
|
|
1385 |
%.o: %.s |
|
1386 |
$(AS) $(_ASFLAGS) -o $@ $< |
|
1387 |
||
1388 |
%.o: %.S |
|
1389 |
$(CPP) $(_SPPFLAGS) $< | $(AS) $(ASFLAGS) -o $@ |
|
1390 |
||
1391 |
#*************************************
|
|
1392 |
# Create Assembly Source (.s)
|
|
1393 |
#*************************************
|
|
1394 |
||
1395 |
ifdef __spu__
|
|
1396 |
ifeq "$(SPU_TIMING)" "1"
|
|
1397 |
ASM_RULE_2 = ; /opt/cell/sdk/usr/bin/spu_timing -running-count $@ |
|
1398 |
endif
|
|
1399 |
endif
|
|
1400 |
||
1401 |
#----------
|
|
1402 |
# C
|
|
1403 |
#----------
|
|
1404 |
%.s: %.c |
|
1405 |
$(CC) $(_CPPFLAGS) $(_CFLAGS) -S $< $(ASM_RULE_2) |
|
1406 |
||
1407 |
#----------
|
|
1408 |
# C++
|
|
1409 |
#----------
|
|
1410 |
%.s: %.C |
|
1411 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) -S $< $(ASM_RULE_2) |
|
1412 |
||
1413 |
%.s: %.cpp |
|
1414 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) -S $< $(ASM_RULE_2) |
|
1415 |
||
1416 |
%.s: %.cc |
|
1417 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) -S $< $(ASM_RULE_2) |
|
1418 |
||
1419 |
%.s: %.cxx |
|
1420 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) -S $< $(ASM_RULE_2) |
|
1421 |
||
1422 |
#----------
|
|
1423 |
# Fortran
|
|
1424 |
#----------
|
|
1425 |
%.s: %.f |
|
1426 |
$(FORTRAN) $(_FFLAGS) -S $< $(ASM_RULE_2) |
|
1427 |
||
1428 |
%.s: %.f90 |
|
1429 |
$(FORTRAN) $(_FFLAGS) -S $< $(ASM_RULE_2) |
|
1430 |
||
1431 |
#----------
|
|
1432 |
# Assembly
|
|
1433 |
#----------
|
|
1434 |
||
1435 |
ifdef _USING_XLC
|
|
1436 |
%.s: %.S |
|
1437 |
$(CPP) $(_SPPFLAGS) $< > $@ |
|
1438 |
else
|
|
1439 |
%.s: %.S |
|
1440 |
$(CPP) $(_SPPFLAGS) -o $@ $< |
|
1441 |
endif
|
|
1442 |
||
1443 |
#*************************************
|
|
1444 |
# Create Preprocessed Source (.i)
|
|
1445 |
#*************************************
|
|
1446 |
||
1447 |
ifdef _USING_XLC
|
|
1448 |
_IFLAGS = -P |
|
1449 |
else
|
|
1450 |
_IFLAGS = -E -P -o $@ |
|
1451 |
endif
|
|
1452 |
||
1453 |
#----------
|
|
1454 |
# C
|
|
1455 |
#----------
|
|
1456 |
%.i: %.c |
|
1457 |
$(CC) $(_CPPFLAGS) $(_CFLAGS) $(_IFLAGS) $< |
|
1458 |
||
1459 |
#----------
|
|
1460 |
# C++
|
|
1461 |
#----------
|
|
1462 |
%.i: %.C |
|
1463 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) $(_IFLAGS) $< |
|
1464 |
||
1465 |
%.i: %.cpp |
|
1466 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) $(_IFLAGS) $< |
|
1467 |
||
1468 |
%.i: %.cc |
|
1469 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) $(_IFLAGS) $< |
|
1470 |
||
1471 |
%.i: %.cxx |
|
1472 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) $(_IFLAGS) $< |
|
1473 |
||
1474 |
#----------
|
|
1475 |
# Fortran
|
|
1476 |
#----------
|
|
1477 |
# no .i files for fortran
|
|
1478 |
||
1479 |
#----------
|
|
1480 |
# Assembly
|
|
1481 |
#----------
|
|
1482 |
%.i: %.S |
|
1483 |
$(CC) $(_SPPFLAGS) $(_CFLAGS) $(_IFLAGS) $< |
|
1484 |
||
1485 |
||
1486 |
#*********************************
|
|
1487 |
# Create Listing Files (.lst)
|
|
1488 |
#*********************************
|
|
1489 |
||
1490 |
ifdef _USING_XL
|
|
1491 |
_LSTFLAGS = -qsource -qlist -qlistopt -c |
|
1492 |
ifdef _USING_XLC
|
|
1493 |
_LSTFLAGS += -qshowinc |
|
1494 |
endif
|
|
1495 |
else
|
|
1496 |
_LSTFLAGS = -E -o $@ |
|
1497 |
endif
|
|
1498 |
||
1499 |
#----------
|
|
1500 |
# C
|
|
1501 |
#----------
|
|
1502 |
%.lst: %.c |
|
1503 |
$(CC) $(_CPPFLAGS) $(_CFLAGS) $(_LSTFLAGS) $< |
|
1504 |
||
1505 |
#----------
|
|
1506 |
# C++
|
|
1507 |
#----------
|
|
1508 |
%.lst: %.C |
|
1509 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) $(_LSTFLAGS) $< |
|
1510 |
||
1511 |
%.lst: %.cpp |
|
1512 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) $(_LSTFLAGS) $< |
|
1513 |
||
1514 |
%.lst: %.cc |
|
1515 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) $(_LSTFLAGS) $< |
|
1516 |
||
1517 |
%.lst: %.cxx |
|
1518 |
$(CXX) $(_CPPFLAGS) $(_CXXFLAGS) $(_LSTFLAGS) $< |
|
1519 |
||
1520 |
#----------
|
|
1521 |
# Fortran
|
|
1522 |
#----------
|
|
1523 |
%.lst: %.f |
|
1524 |
$(FORTRAN) $(_FFLAGS) $(_LSTFLAGS) $< |
|
1525 |
||
1526 |
%.lst: %.f90 |
|
1527 |
$(FORTRAN) $(_FFLAGS) $(_LSTFLAGS) $< |
|
1528 |
||
1529 |
#----------
|
|
1530 |
# Assembly
|
|
1531 |
#----------
|
|
1532 |
%.lst: %.S |
|
1533 |
$(CXX) $(_SPPFLAGS) $(_CXXFLAGS) $(_LSTFLAGS) $< |
|
1534 |
||
1535 |
||
1536 |
########################################################################
|
|
1537 |
# Subdirectories
|
|
1538 |
########################################################################
|
|
1539 |
||
1540 |
# dummydir:
|
|
1541 |
||
1542 |
ifdef DIRS
|
|
1543 |
.PHONY: $(DIRS) |
|
1544 |
||
1545 |
$(DIRS): |
|
1546 |
@if [ -r $@/Makefile ]; then $(MAKE) -C $@ $(MAKECMDGOALS); fi |
|
1547 |
endif
|
|
1548 |
||
1549 |
ifdef GNU_DIRS
|
|
1550 |
.PHONY: $(GNU_DIRS) |
|
1551 |
$(GNU_DIRS): |
|
1552 |
@if [ -r $@/Makefile.sti ]; \ |
|
1553 |
then \ |
|
1554 |
echo; \ |
|
1555 |
echo "***************************************************"; \ |
|
1556 |
echo "*"; \ |
|
1557 |
echo "* [`date +\"%b %d %T\"`] Configuring gnu directory $(notdir $(CURDIR))/$@";\ |
|
1558 |
echo "*"; \ |
|
1559 |
echo "***************************************************"; \ |
|
1560 |
echo; \ |
|
1561 |
$(MAKE) -C $@ -f Makefile.sti; \ |
|
1562 |
fi; \ |
|
1563 |
if [ -r $@/Makefile ]; \
|
|
1564 |
then \
|
|
1565 |
echo; \
|
|
1566 |
echo "***************************************************"; \
|
|
1567 |
echo "*"; \
|
|
1568 |
echo "* [`date +\"%b %d %T\"`] Building gnu directory $(notdir $(CURDIR))/$@";\
|
|
1569 |
echo "*"; \
|
|
1570 |
echo "***************************************************"; \
|
|
1571 |
echo; \
|
|
1572 |
$(MAKE) -C $@ all install; \
|
|
1573 |
fi
|
|
1574 |
endif
|
|
1575 |
||
1576 |
||
1577 |
########################################################################
|
|
1578 |
# Library Rules
|
|
1579 |
########################################################################
|
|
1580 |
||
1581 |
ifdef _LIBRARY
|
|
1582 |
$(_LIBRARY): $(SRC_BUILT_HERE) $(OBJS) $(_IMPORTS) |
|
1583 |
$(AR) -qcs $@ $(OBJS_V) $(_IMPORTS) |
|
1584 |
endif
|
|
1585 |
||
1586 |
||
1587 |
########################################################################
|
|
1588 |
# Embedded Library Rules
|
|
1589 |
########################################################################
|
|
1590 |
||
1591 |
# we use PPU_AR here explicitly because this usually happens in an spu
|
|
1592 |
# directory where __spu__ is defined, but the output is a ppu library.
|
|
1593 |
ifdef _LIBRARY_embed
|
|
1594 |
$(_LIBRARY_embed): $(EMBED_OBJS) |
|
1595 |
$(PPU_AR) -qcs $@ $(EMBED_OBJS_V) |
|
1596 |
endif
|
|
1597 |
||
1598 |
ifdef _LIBRARY_embed64
|
|
1599 |
$(_LIBRARY_embed64): $(EMBED64_OBJS) |
|
1600 |
$(PPU_AR) -qcs $@ $(EMBED64_OBJS_V) |
|
1601 |
endif
|
|
1602 |
||
1603 |
ifdef EMBED_OBJS
|
|
1604 |
# Embed into a 32-bit PPU obj
|
|
1605 |
$(EMBED_OBJS): %-embed.o: % |
|
1606 |
$(EMBEDSPU32) $(subst -,_,$<)$(FTN_UNDERSCORE) $< $@ |
|
1607 |
endif
|
|
1608 |
||
1609 |
ifdef EMBED64_OBJS
|
|
1610 |
# Embed spu obj into a 64-bit PPU obj
|
|
1611 |
$(EMBED64_OBJS): %-embed64.o: % |
|
1612 |
$(EMBEDSPU64) $(subst -,_,$<)$(FTN_UNDERSCORE) $< $@ |
|
1613 |
endif
|
|
1614 |
||
1615 |
||
1616 |
########################################################################
|
|
1617 |
# Executable Program Rules
|
|
1618 |
########################################################################
|
|
1619 |
||
1620 |
# get the filenames of the objs for this target, w/out the suffix:
|
|
1621 |
BASENAME_OBJS=$(basename $(OBJS)) |
|
1622 |
||
1623 |
# we need to determine if any of the OBJS were made with c++ files; if so
|
|
1624 |
# then we have to use g++/xlC; otherwise we'll use gcc/xlc
|
|
1625 |
# get the filenames of the c++ files we found in our vpath, w/out the suffix:
|
|
1626 |
BASENAME_CXX_OBJS=$(basename $(CXX_OBJS)) |
|
1627 |
# intersect - if any match, then we have a c++ file in the obj list
|
|
1628 |
findcxxinobj=$(filter $(a),$(BASENAME_CXX_OBJS)) |
|
1629 |
BASENAME_TRUE_CXX_OBJS=$(foreach a,$(BASENAME_OBJS),$(findcxxinobj)) |
|
1630 |
# and if there is any in this list, we have to use g++/xlC
|
|
1631 |
ifneq "$(strip $(BASENAME_TRUE_CXX_OBJS))" ""
|
|
1632 |
_LD = $(CXX) |
|
1633 |
_LDFLAGS += $(C_COMPILER_LDFLAGS) |
|
1634 |
else
|
|
1635 |
# we need to determine if any of the OBJS were made with fortran files; if so
|
|
1636 |
# then we have to use gfortran/xlf; otherwise we'll use gcc/xlc
|
|
1637 |
# get the filenames of the fortran files we found in our vpath, w/out the suffix:
|
|
1638 |
BASENAME_FTN_OBJS=$(basename $(FTN_OBJS)) |
|
1639 |
# intersect - if any match, then we have a fortran file in the obj list
|
|
1640 |
findftninobj=$(filter $(a),$(BASENAME_FTN_OBJS)) |
|
1641 |
BASENAME_TRUE_FTN_OBJS=$(foreach a,$(BASENAME_OBJS),$(findftninobj)) |
|
1642 |
# and if there is any in this list, we have to use gfortran/xlf
|
|
1643 |
ifneq "$(strip $(BASENAME_TRUE_FTN_OBJS))" ""
|
|
1644 |
_LD = $(FORTRAN) |
|
1645 |
_LDFLAGS += $(FTN_COMPILER_LDFLAGS) |
|
1646 |
else
|
|
1647 |
_LD = $(CC) |
|
1648 |
_LDFLAGS += $(C_COMPILER_LDFLAGS) |
|
1649 |
endif
|
|
1650 |
endif
|
|
1651 |
||
1652 |
ifdef _PROGRAM
|
|
1653 |
$(_PROGRAM): $(SRC_BUILT_HERE) $(OBJS) $(_IMPORTS) $(START_FILE) |
|
1654 |
$(_LD) -o $@ $(START_FILE_V) $(OBJS_V) $(_LDFLAGS) $(_IMPORTS) $(SYS_LIBS) |
|
1655 |
endif
|
|
1656 |
||
1657 |
ifdef _PROGRAMS
|
|
1658 |
#The % doesn't work in the $(OBJS_%) dependency:
|
|
1659 |
#$(_PROGRAMS): %: $(SRC_BUILT_HERE) $(OBJS_%) $(_IMPORTS)
|
|
1660 |
$(_PROGRAMS): $(SRC_BUILT_HERE) $(OBJS) $(_IMPORTS) $(_PER_FILE_IMPORTS) $(START_FILE) |
|
1661 |
@if [ "$(OBJS_$@)" != "" ]; \ |
|
1662 |
then \ |
|
1663 |
objs="$(filter $(addprefix %/,$(OBJS_$@)) $(OBJS_$@),$^)"; \ |
|
1664 |
else \
|
|
1665 |
objs="$(filter $(addprefix %/,$@.o) $@.o,$^)"; \
|
|
1666 |
fi; \
|
|
1667 |
per_file_syslibs="$(filter -l%,$(IMPORTS_$@))"; \
|
|
1668 |
per_file_imports="$(filter $(addprefix %/,$(IMPORTS_$@)) $(IMPORTS_$@),$^)";\
|
|
1669 |
imports="$(_IMPORTS) $$per_file_imports $$per_file_syslibs"; \
|
|
1670 |
echo "$(_LD) -o $@ $(START_FILE_V) $$objs $(_LDFLAGS) $$imports $(SYS_LIBS)";\
|
|
1671 |
$(_LD) -o $@ $(START_FILE_V) $$objs $(_LDFLAGS) $$imports $(SYS_LIBS)
|
|
1672 |
endif
|
|
1673 |
||
1674 |
||
1675 |
########################################################################
|
|
1676 |
# Shared Library Rules
|
|
1677 |
########################################################################
|
|
1678 |
||
1679 |
ifdef _SHARED_LIBRARY
|
|
1680 |
$(_SHARED_LIBRARY): $(SRC_BUILT_HERE) $(OBJS) $(_IMPORTS) |
|
1681 |
$(LD) $(LDFLAGS) -o $@ $(SHARED_LDFLAGS) $(OBJS_V) $(_IMPORTS) $(SYS_LIBS) |
|
1682 |
endif
|
|
1683 |
||
1684 |
ifdef _SHARED_LIBRARY_embed
|
|
1685 |
$(_SHARED_LIBRARY_embed): $(SRC_BUILT_HERE) $(EMBED_OBJS) |
|
1686 |
$(subst spu,ppu,$(subst $(SPU_TOOL_PREFIX),$(PPU32_TOOL_PREFIX),$(LD))) -o $@ $(SHARED_LDFLAGS) $(EMBED_OBJS_V) |
|
1687 |
endif
|
|
1688 |
||
1689 |
ifdef _SHARED_LIBRARY_embed64
|
|
1690 |
$(_SHARED_LIBRARY_embed64): $(SRC_BUILT_HERE) $(EMBED64_OBJS) |
|
1691 |
$(subst spu,ppu,$(subst $(SPU_TOOL_PREFIX),$(PPU_TOOL_PREFIX),$(LD))) -o $@ $(SHARED_LDFLAGS) $(EMBED64_OBJS_V) |
|
1692 |
endif
|
|
1693 |
||
1694 |
||
1695 |
########################################################################
|
|
1696 |
# Install Rules
|
|
1697 |
########################################################################
|
|
1698 |
.SECONDEXPANSION: |
|
1699 |
||
1700 |
ifdef _PROGRAM_dir
|
|
1701 |
$(PROGRAM): $(_PROGRAM) |
|
1702 |
@if [ "$(@D)" = "" ]; then echo "Error in PROGRAM definition (use = instead of :=)"; exit 1; fi |
|
1703 |
@$(MKDIR) $(@D) |
|
1704 |
$(CP) $< $@ |
|
1705 |
endif
|
|
1706 |
||
1707 |
ifdef _PROGRAMS_dirs
|
|
1708 |
$(PROGRAMS): $$(@F) |
|
1709 |
@if [ "$(@D)" = "" ]; then echo "Error in PROGRAMS definition (use = instead of :=)"; exit 1; fi |
|
1710 |
@$(MKDIR) $(@D) |
|
1711 |
$(CP) $< $@ |
|
1712 |
endif
|
|
1713 |
||
1714 |
ifdef _LIBRARY_dir
|
|
1715 |
$(LIBRARY): $(_LIBRARY) |
|
1716 |
@if [ "$(@D)" = "" ]; then echo "Error in LIBRARY definition (use = instead of :=)"; exit 1; fi |
|
1717 |
@$(MKDIR) $(@D) |
|
1718 |
$(CP) $< $@ |
|
1719 |
endif
|
|
1720 |
||
1721 |
ifdef _LIBRARY_embed_dir
|
|
1722 |
$(LIBRARY_embed): $(_LIBRARY_embed) |
|
1723 |
@if [ "$(@D)" = "" ]; then echo "Error in LIBRARY_embed definition (use = instead of :=)"; exit 1; fi |
|
1724 |
@$(MKDIR) $(@D) |
|
1725 |
$(CP) $< $@ |
|
1726 |
endif
|
|
1727 |
||
1728 |
ifdef _LIBRARY_embed64_dir
|
|
1729 |
$(LIBRARY_embed64): $(_LIBRARY_embed64) |
|
1730 |
@if [ "$(@D)" = "" ]; then echo "Error in LIBRARY_embed64 definition (use = instead of :=)"; exit 1; fi |
|
1731 |
@$(MKDIR) $(@D) |
|
1732 |
$(CP) $< $@ |
|
1733 |
endif
|
|
1734 |
||
1735 |
ifdef _SHARED_LIBRARY_dir
|
|
1736 |
$(SHARED_LIBRARY): $(_SHARED_LIBRARY) |
|
1737 |
@if [ "$(@D)" = "" ]; then echo "Error in SHARED_LIBRARY definition (use = instead of :=)"; exit 1; fi |
|
1738 |
@$(MKDIR) $(@D) |
|
1739 |
$(CP) $< $@ |
|
1740 |
endif
|
|
1741 |
||
1742 |
ifdef SHARED_LIBRARY_embed_dir
|
|
1743 |
$(SHARED_LIBRARY_embed): $(_SHARED_LIBRARY_embed) |
|
1744 |
@if [ "$(@D)" = "" ]; then echo "Error in SHARED_LIBRARY_embed definition (use = instead of :=)"; exit 1; fi |
|
1745 |
@$(MKDIR) $(@D) |
|
1746 |
$(CP) $< $@ |
|
1747 |
endif
|
|
1748 |
||
1749 |
ifdef SHARED_LIBRARY_embed64_dir
|
|
1750 |
$(SHARED_LIBRARY_embed64): $(_SHARED_LIBRARY_embed64) |
|
1751 |
@if [ "$(@D)" = "" ]; then echo "Error in SHARED_LIBRARY_embed64 definition (use = instead of :=)"; exit 1; fi |
|
1752 |
@$(MKDIR) $(@D) |
|
1753 |
$(CP) $< $@ |
|
1754 |
endif
|
|
1755 |
||
1756 |
||
1757 |
ifdef INSTALL_DIR
|
|
1758 |
_INSTALL_FILES = $(foreach dir,$(INSTALL_DIR),$(addprefix $(dir)/,$(INSTALL_FILES))) |
|
1759 |
else
|
|
1760 |
_INSTALL_FILES = $(INSTALL_FILES) |
|
1761 |
endif
|
|
1762 |
||
1763 |
ifdef TARGET_INSTALL_DIR
|
|
1764 |
_INSTALL_FILES += $(addprefix $(TARGET_INSTALL_DIR)/,$(TARGETS)) |
|
1765 |
endif
|
|
1766 |
||
1767 |
ifneq "$(_INSTALL_FILES)" ""
|
|
1768 |
$(_INSTALL_FILES): $$(@F) |
|
1769 |
@$(MKDIR) $(@D) |
|
1770 |
$(CP) $< $@ |
|
1771 |
endif
|
|
1772 |
||
1773 |
install: $(_INSTALL_FILES) |
|
1774 |
||
1775 |
||
1776 |
########################################################################
|
|
1777 |
# Cleanup Rules
|
|
1778 |
########################################################################
|
|
1779 |
||
1780 |
cleaninstall: |
|
1781 |
ifdef _INSTALL_FILES
|
|
1782 |
@$(RM) $(_INSTALL_FILES) |
|
1783 |
endif
|
|
1784 |
||
1785 |
cleanlocal: |
|
1786 |
||
1787 |
cleanmap: |
|
1788 |
ifdef MAPFILE
|
|
1789 |
@$(RM) $(MAPFILE) |
|
1790 |
endif
|
|
1791 |
||
1792 |
cleantobey: |
|
1793 |
ifdef _USING_XLC
|
|
1794 |
@$(RM) *_tobey.c *.lst *.i *.i.tmp *o\$$1.s |
|
1795 |
endif
|
|
1796 |
||
1797 |
cleanobj: |
|
1798 |
@$(RM) $(TARGETPATH_)*.o |
|
1799 |
||
1800 |
cleand: |
|
1801 |
@$(RM) $(TARGETPATH_)*.d |
|
1802 |
||
1803 |
cleanfortran: |
|
1804 |
@$(RM) $(TARGETPATH_)*.mod |
|
1805 |
||
1806 |
cleanlib: |
|
1807 |
@$(RM) $(LIBRARY)$(_LIBRARY) \ |
|
1808 |
$(SHARED_LIBRARY)$(_SHARED_LIBRARY) \ |
|
1809 |
$(_SHARED_LIBRARY_SONAME)$(_SHARED_LIBRARY_VERSION) \ |
|
1810 |
$(LIBRARY_embed)$(_LIBRARY_embed) \ |
|
1811 |
$(LIBRARY_embed64)$(_LIBRARY_embed64) \ |
|
1812 |
$(SHARED_LIBRARY_embed) $(_SHARED_LIBRARY_embed) \ |
|
1813 |
$(SHARED_LIBRARY_embed64) $(_SHARED_LIBRARY_embed64) |
|
1814 |
||
1815 |
cleanexe: |
|
1816 |
@$(RM) $(PROGRAM) $(_PROGRAM) $(PROGRAMS) $(_PROGRAMS) |
|
1817 |
||
1818 |
cleantargets: |
|
1819 |
@$(RM) -r $(LOCAL_TARGETS) $(OTHER_TARGETS) |
|
1820 |
||
1821 |
cleandir: cleanobj cleand cleanlib cleanexe cleantargets cleanmap cleantobey cleanlocal cleanfortran |
|
1822 |
@$(RM) out $(SRC_BUILT_HERE) |
|
1823 |
||
1824 |
.PHONY: cleansubdirs |
|
1825 |
||
1826 |
cleansubdirs: |
|
1827 |
ifdef DIRS
|
|
1828 |
@for i in $(DIRS); do \ |
|
1829 |
if [ -e $$i/Makefile ]; then $(MAKE) -C $$i clean; fi \
|
|
1830 |
done
|
|
1831 |
endif
|
|
1832 |
ifdef GNU_DIRS
|
|
1833 |
for i in $(GNU_DIRS); do \ |
|
1834 |
if [ -e $$i/Makefile.sti ]; then $(MAKE) -C $$i -f Makefile.sti clean; fi \
|
|
1835 |
done
|
|
1836 |
endif
|
|
1837 |
||
1838 |
clean: cleandir cleansubdirs cleaninstall |
|
1839 |
||
1840 |
||
1841 |
########################################################################
|
|
1842 |
# Dependency Rules
|
|
1843 |
########################################################################
|
|
1844 |
||
1845 |
ifdef OBJS
|
|
1846 |
_OBJS = $(OBJS) |
|
1847 |
endif
|
|
1848 |
||
1849 |
ifdef OBJS_ONLY
|
|
1850 |
_OBJS += $(OBJS_ONLY) |
|
1851 |
endif
|
|
1852 |
||
1853 |
ifdef _OBJS
|
|
1854 |
$(_OBJS): Makefile |
|
1855 |
||
1856 |
ifndef _USING_XLC
|
|
1857 |
$(_OBJS): %.o: %.d |
|
1858 |
endif
|
|
1859 |
endif
|
|
1860 |
||
1861 |
MACROIZE = -e 's,$(CELL_TOP),$$(CELL_TOP),g' |
|
1862 |
ifneq "$(strip $(CBE_SYSROOT))" ""
|
|
1863 |
MACROIZE += -e 's, $(CBE_SYSROOT), $$(CBE_SYSROOT),g' |
|
1864 |
endif
|
|
1865 |
ifneq "$(strip $(XLC_INSTALL_DIR))" ""
|
|
1866 |
MACROIZE += -e 's,$(XLC_INSTALL_DIR),$$(XLC_INSTALL_DIR),g' |
|
1867 |
endif
|
|
1868 |
ifneq "$(strip $(GNU_SYSROOT))" ""
|
|
1869 |
MACROIZE += -e 's,$(GNU_SYSROOT),$$(GNU_SYSROOT),g' |
|
1870 |
endif
|
|
1871 |
||
1872 |
CONVERT_U = -M $(_CPPFLAGS) $< | \ |
|
1873 |
sed -e 's/\($*\)\.o[ :]*/\1.o \1.i \1.lst $@ : /g' \ |
|
1874 |
$(MACROIZE) > $@; [ -s $@ ] || $(RM) $@ |
|
1875 |
||
1876 |
ifdef _USING_XLC
|
|
1877 |
||
1878 |
# xlc handles .d automagically with the -M option while compiling
|
|
1879 |
||
1880 |
else
|
|
1881 |
||
1882 |
%.d: %.c |
|
1883 |
@set -e; $(CC) $(CONVERT_U) |
|
1884 |
||
1885 |
%.d: %.C |
|
1886 |
@set -e; $(CXX) $(CONVERT_U) |
|
1887 |
||
1888 |
%.d: %.cpp |
|
1889 |
@set -e; $(CXX) $(CONVERT_U) |
|
1890 |
||
1891 |
%.d: %.cc |
|
1892 |
@set -e; $(CXX) $(CONVERT_U) |
|
1893 |
||
1894 |
%.d: %.cxx |
|
1895 |
@set -e; $(CXX) $(CONVERT_U) |
|
1896 |
||
1897 |
%.d: %.S |
|
1898 |
@set -e; $(CC) $(CONVERT_U) |
|
1899 |
||
1900 |
# following don't do .d files, so just touch one to satisfy the makefile rule
|
|
1901 |
%.d: %.s |
|
1902 |
@touch $@
|
|
1903 |
||
1904 |
%.d: %.f |
|
1905 |
@touch $@
|
|
1906 |
||
1907 |
%.d: %.f90 |
|
1908 |
@touch $@
|
|
1909 |
||
1910 |
endif
|
|
1911 |
||
1912 |
||
1913 |
########################################################################
|
|
1914 |
# Build Info
|
|
1915 |
########################################################################
|
|
1916 |
||
1917 |
copy_sysroot: |
|
1918 |
@mkdir -p ./sysroot/opt/cell/sdk |
|
1919 |
@cp -r ${GNU_SYSROOT}/opt/cell/sdk/usr ./sysroot/opt/cell/sdk |
|
1920 |
@if [ -d ${GNU_SYSROOT}/opt/cell/sdk/prototype/usr ]; then \ |
|
1921 |
mkdir -p ./sysroot/opt/cell/sdk/prototype; \ |
|
1922 |
cp -r ${GNU_SYSROOT}/opt/cell/sdk/prototype/usr ./sysroot/opt/cell/sdk/prototype; \ |
|
1923 |
fi
|
|
1924 |
@echo "sysroot copied into sandbox"; |
|
1925 |
||
1926 |
||
1927 |
copy_buildutils: |
|
1928 |
@cp -r ${OPTDIR}/buildutils . |
|
1929 |
@echo "buildutils copied into sandbox"
|
|
1930 |
||
1931 |
copy_src: |
|
1932 |
@mkdir -p ./src |
|
1933 |
@cp ${OPTDIR}/src/Makefile src |
|
1934 |
@mkdir -p ./prototype/src |
|
1935 |
@echo "src directory created in sandbox"
|
|
1936 |
||
1937 |
sandbox: copy_buildutils copy_sysroot copy_src |
|
1938 |
@echo "making a local sandbox here (" `pwd` ")" |
|
1939 |
@echo "make sure you do the following:"
|
|
1940 |
@echo "export CELL_TOP="`pwd` |
|
1941 |
||
1942 |
# Specify a target that will print out the key variables. This is
|
|
1943 |
# useful for debugging a Makefile.
|
|
1944 |
||
1945 |
listenv_c: |
|
1946 |
@echo $(shell which $(CC)) |
|
1947 |
||
1948 |
listenv_f: |
|
1949 |
@echo $(shell which $(FORTRAN)) |
|
1950 |
||
1951 |
listenv: |
|
1952 |
@echo |
|
1953 |
@echo "Directory Configuration:"
|
|
1954 |
@echo "------------------------"
|
|
1955 |
@echo " Building on: $(HOST_PROCESSOR) $(shell if [ -r /etc/redhat-release ]; then cat /etc/redhat-release; fi)" |
|
1956 |
@echo " Target Processor: $(TARGET_PROCESSOR)" |
|
1957 |
@echo " Makefiles: $(strip $(MAKEFILE_LIST))" |
|
1958 |
@echo |
|
1959 |
@echo " CELL_TOP = $(CELL_TOP) ($(abspath $(CELL_TOP)))" |
|
1960 |
@echo " VPATH = $(VPATH)" |
|
1961 |
@echo " PATH = $(PATH)" |
|
1962 |
@echo |
|
1963 |
@echo " ROOT_SYSROOT = $(ROOT_SYSROOT)" |
|
1964 |
@echo " CBE_SYSROOT = $(CBE_SYSROOT)" |
|
1965 |
@echo " EXP_SYSROOT = $(EXP_SYSROOT)" |
|
1966 |
@echo " OPTDIR = $(OPTDIR)" |
|
1967 |
@echo " SDK_OPTDIR = $(SDK_OPTDIR)" |
|
1968 |
@echo |
|
1969 |
@echo " SDKBIN = $(SDKBIN)" |
|
1970 |
@echo " SDKINC = $(SDKINC)" |
|
1971 |
@echo " SDKLIB = $(SDKLIB)" |
|
1972 |
@echo |
|
1973 |
@echo " SDKEXBIN = $(SDKEXBIN)" |
|
1974 |
@echo " SDKEXINC = $(SDKEXINC)" |
|
1975 |
@echo " SDKEXLIB = $(SDKEXLIB)" |
|
1976 |
@echo |
|
1977 |
@echo " SDKRPATH = $(SDKRPATH)" |
|
1978 |
@echo " SDKEXRPATH = $(SDKEXRPATH)" |
|
1979 |
@echo " SDKPRRPATH = $(SDKPRRPATH)" |
|
1980 |
@echo |
|
1981 |
@echo " EXP_SDKBIN = $(EXP_SDKBIN)" |
|
1982 |
@echo " EXP_SDKINC = $(EXP_SDKINC)" |
|
1983 |
@echo " EXP_SDKLIB = $(EXP_SDKLIB)" |
|
1984 |
@echo |
|
1985 |
@echo " EXP_SDKPRBIN = $(EXP_SDKPRBIN)" |
|
1986 |
@echo " EXP_SDKPRINC = $(EXP_SDKPRINC)" |
|
1987 |
@echo " EXP_SDKPRLIB = $(EXP_SDKPRLIB)" |
|
1988 |
@echo |
|
1989 |
@echo " SYSTEMSIM_INCLUDE = $(SYSTEMSIM_INCLUDE)" |
|
1990 |
@echo |
|
1991 |
@echo " Files:"
|
|
1992 |
@echo " ------"
|
|
1993 |
@echo " Targets = $(strip $(TARGETS))" |
|
1994 |
@echo " Objects = $(strip $(OBJS))" |
|
1995 |
@echo " Embed Objects = $(strip $(EMBED_OBJS))" |
|
1996 |
@echo " Embed64 Objs = $(strip $(EMBED64_OBJS))" |
|
1997 |
@echo " C++ Objects = $(strip $(CXX_OBJS))" |
|
1998 |
@echo " Fortran Objects= $(strip $(FTN_OBJS))" |
|
1999 |
@echo " C Objects = $(strip $(C_OBJS))" |
|
2000 |
@echo " .S Objects = $(strip $(S_OBJS))" |
|
2001 |
@echo " .s Objects = $(strip $(AS_OBJS))" |
|
2002 |
@echo " Install Files = $(strip $(_INSTALL_FILES))" |
|
2003 |
@echo |
|
2004 |
@echo " Build Tools:"
|
|
2005 |
@echo " ------------"
|
|
2006 |
@echo " C Preprocessor = $(CPP)" |
|
2007 |
@echo " C Compiler = $(shell which $(CC))" |
|
2008 |
@echo " C++ Compiler = $(shell which $(CXX))" |
|
2009 |
@echo " Fortran Compiler = $(shell which $(FORTRAN))" |
|
2010 |
@echo " Assembler = $(shell which $(AS))" |
|
2011 |
@echo " Library Linker = $(shell which $(LD))" |
|
2012 |
@echo " Program Linker = $(shell which $(_LD))" |
|
2013 |
@echo |
|
2014 |
@echo " Default Flags"
|
|
2015 |
@echo " -------------"
|
|
2016 |
@echo " CPPFLAGS = $(strip $(_CPPFLAGS))" |
|
2017 |
@echo " CXXFLAGS = $(strip $(_CXXFLAGS))" |
|
2018 |
@echo " CFLAGS = $(strip $(_CFLAGS))" |
|
2019 |
@echo " ASFLAGS = $(strip $(_ASFLAGS))" |
|
2020 |
@echo " FFLAGS = $(strip $(_FFLAGS))" |
|
2021 |
@echo " LDFLAGS = $(strip $(_LDFLAGS))" |
|
2022 |
@echo " SYS_LIBS = $(strip $(SYS_LIBS))" |
|
2023 |
@echo " IMPORTS = $(strip $(_IMPORTS))" |
|
2024 |
||
2025 |
$(CELL_TOP)/buildutils/make.header $(CELL_TOP)/buildutils/make.env $(make_footer) Makefile Makefile.sti: ; |
|
2026 |
||
2027 |
||
2028 |
########################################################################
|
|
2029 |
# Dependencies
|
|
2030 |
########################################################################
|
|
2031 |
||
2032 |
ifdef _OBJS
|
|
2033 |
ifneq "$(MAKECMDGOALS)" "listenv"
|
|
2034 |
ifneq "$(MAKECMDGOALS)" "clean"
|
|
2035 |
DEPEND_FILES := $(foreach file,$(_OBJS:.o=.d),$(wildcard $(file))) |
|
2036 |
ifneq "$(DEPEND_FILES)" ""
|
|
2037 |
include $(DEPEND_FILES)
|
|
2038 |
endif
|
|
2039 |
endif
|
|
2040 |
endif
|
|
2041 |
endif
|
|
2042 |
||
2043 |
endif # MAKEFILE_LIST
|
|
2044 |
endif # __MAKE_FOOTER__
|