author | david.stone@nokia.com |
Fri, 11 Dec 2009 11:25:51 +0000 | |
branch | wip |
changeset 69 | 9287c3bfa3eb |
parent 29 | ee00c00df073 |
child 220 | f7d68ecb923e |
child 317 | adc615fe34e8 |
permissions | -rw-r--r-- |
3 | 1 |
# Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
# All rights reserved. |
|
3 |
# This component and the accompanying materials are made available |
|
4 |
# under the terms of the License "Eclipse Public License v1.0" |
|
5 |
# which accompanies this distribution, and is available |
|
6 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
# |
|
8 |
# Initial Contributors: |
|
9 |
# Nokia Corporation - initial contribution. |
|
10 |
# |
|
11 |
# Contributors: |
|
12 |
# |
|
13 |
# Description: |
|
14 |
# Function-Like Makefile to build common TOOLS2 objects with gcc |
|
15 |
# (included by tools2exe.flm and tools2lib.flm) |
|
16 |
# |
|
17 |
# |
|
18 |
||
19 |
## Input parameters |
|
20 |
||
21 |
OUTPUTPATH:=$(OUTPUTPATH)/$(TARGET)_$(TARGETTYPE)/tools2/$(VARIANTTYPE)$(TOOLPLATFORMDIR) |
|
22 |
||
23 |
ifeq ($(OSTYPE),cygwin) |
|
24 |
CDEFS.TOOLS2:=$(CDEFS.WIN32) $(CDEFS) |
|
25 |
CFLAGS:=$(CFLAGS.WIN32) $(CFLAGS) $(OPTION_GCC) |
|
26 |
COMPILER_PATH:=$(COMPILER_PATH.WIN32) |
|
27 |
else |
|
28 |
CDEFS.TOOLS2:=$(CDEFS.LINUX) $(CDEFS) |
|
29 |
CFLAGS:=$(CFLAGS) $(OPTION_GCC) |
|
30 |
COMPILER_PATH=$(COMPILER_PATH.LINUX) |
|
31 |
endif |
|
32 |
CDEFS.TOOLS2:=$(call makemacrodef,$(OPT.D),$(CDEFS.TOOLS2)) |
|
33 |
||
34 |
## Locally used variables |
|
35 |
CREATABLEPATHS:=$(OUTPUTPATH) $(RELEASEPATH) $(TOOLSPATH) |
|
36 |
||
37 |
## Global targets |
|
38 |
$(ALLTARGET):: $(TARGETS) |
|
39 |
TARGET:: $(TARGETS) |
|
40 |
||
41 |
## Pre-Include directories |
|
42 |
ifneq ($(INC.COMPILER),) |
|
43 |
PINCLUDE:=$(patsubst %,$(OPT.PREINCLUDE)%,$(INC.COMPILER)) |
|
44 |
endif |
|
45 |
||
46 |
## User and System Include directories |
|
47 |
ifneq ($(USERINCLUDE),) |
|
48 |
UINCLUDE:=$(patsubst %,$(OPT.USERINCLUDE)%,$(USERINCLUDE)) |
|
49 |
endif |
|
50 |
ifneq ($(SYSTEMINCLUDE),) |
|
51 |
SINCLUDE:=$(patsubst %,$(OPT.SYSTEMINCLUDE)%,$(SYSTEMINCLUDE)) |
|
52 |
endif |
|
53 |
||
54 |
INCLUDES:=$(PINCLUDE) $(UINCLUDE) $(SINCLUDE) |
|
55 |
||
56 |
## Source files |
|
57 |
CPPFILES:=$(filter %.CPP,$(SOURCE)) |
|
58 |
cppFILES:=$(filter %.cpp,$(SOURCE)) |
|
59 |
CFILES:=$(filter %.C,$(SOURCE)) |
|
60 |
cFILES:=$(filter %.c,$(SOURCE)) |
|
61 |
||
62 |
## Object files |
|
63 |
CPPOBJFILES:=$(patsubst %,$(OUTPUTPATH)/%,$(notdir $(patsubst %.CPP,%.o,$(CPPFILES)))) |
|
64 |
cppOBJFILES:=$(patsubst %,$(OUTPUTPATH)/%,$(notdir $(patsubst %.cpp,%.o,$(cppFILES)))) |
|
65 |
COBJFILES:=$(patsubst %,$(OUTPUTPATH)/%,$(notdir $(patsubst %.C,%.o,$(CFILES)))) |
|
66 |
cOBJFILES:=$(patsubst %,$(OUTPUTPATH)/%,$(notdir $(patsubst %.c,%.o,$(cFILES)))) |
|
67 |
OBJECTFILES:=$(CPPOBJFILES) $(cppOBJFILES) $(cOBJFILES) $(COBJFILES) |
|
68 |
||
69 |
CLEANTARGETS:= |
|
70 |
## Compile CPP and cpp files |
|
71 |
define compile2object |
|
72 |
$(eval compile2object_TARGET:=$(OUTPUTPATH)/$(patsubst %.$(2),%.o,$(notdir $(1)))) |
|
73 |
$(eval DEPENDFILENAME:=$(compile2object_TARGET).d) |
|
74 |
$(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME))) |
|
75 |
$(compile2object_TARGET): $(1) $(if (DEPENDFILE),,EXPORT) |
|
76 |
$(call startrule,compile2object,,$(1)) \ |
|
77 |
$(if $(COMPILER_PATH),COMPILER_PATH="$(COMPILER_PATH)",) \ |
|
78 |
$(COMPILER) $(CFLAGS) $(CDEFS.TOOLS2) -MD -MT"$$@" -MF"$(DEPENDFILENAME)" $(INCLUDES) $(OPT.O)"$$@" "$(1)" \ |
|
79 |
$(call endrule,compile2object) |
|
80 |
||
81 |
CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME) |
|
82 |
ifneq "$(DEPENDFILE)" "" |
|
83 |
ifeq ($(NO_DEPEND_INCLUDE),) |
|
84 |
ifeq "$(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS)))" "" |
|
85 |
-include $(DEPENDFILE) |
|
86 |
endif |
|
87 |
endif |
|
88 |
endif |
|
89 |
||
90 |
endef |
|
91 |
||
92 |
$(foreach SRC,$(CPPFILES),$(eval $(call compile2object,$(SRC),CPP))) |
|
93 |
$(foreach SRC,$(cppFILES),$(eval $(call compile2object,$(SRC),cpp))) |
|
94 |
$(foreach SRC,$(CFILES),$(eval $(call compile2object,$(SRC),C))) |
|
95 |
$(foreach SRC,$(cFILES),$(eval $(call compile2object,$(SRC),c))) |
|
96 |
||
97 |
### Conclusion - cleanup and introspection ####################### |
|
98 |
||
99 |
# make the output directories while reading makefile - some build engines prefer this |
|
100 |
$(call makepath,$(CREATABLEPATHS)) |
|
101 |
||
5 | 102 |
## Clean up |
103 |
$(call raptor_clean,$(CLEANTARGETS) $(OBJECTFILES)) |
|
104 |
## for the --what option and the log file |
|
29
ee00c00df073
Catchup to Perforce WIP with timing, python24
timothy.murphy@nokia.com
parents:
5
diff
changeset
|
105 |
$(call raptor_release,$(RELEASABLES)) |
3 | 106 |
|
107 |
## The End |