author | Daniel Jacobs <daniel.jacobs@nokia.com> |
Thu, 18 Feb 2010 16:42:28 +0000 | |
branch | wip |
changeset 337 | 62e1f66421b1 |
parent 319 | 17156855fe69 |
child 342 | f0e42ff3359f |
permissions | -rw-r--r-- |
317 | 1 |
# Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 | 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 |
||
319 | 21 |
ifeq ($(filter win,$(HOSTPLATFORM)),win) |
3 | 22 |
CDEFS.TOOLS2:=$(CDEFS.WIN32) $(CDEFS) |
23 |
CFLAGS:=$(CFLAGS.WIN32) $(CFLAGS) $(OPTION_GCC) |
|
24 |
COMPILER_PATH:=$(COMPILER_PATH.WIN32) |
|
317 | 25 |
OUTPUTPATH:=$(OUTPUTPATH)/$(TARGET)_$(TARGETTYPE)/tools2/$(VARIANTTYPE)$(TOOLPLATFORMDIR) |
3 | 26 |
else |
317 | 27 |
ifneq ($(TOOLS2WIN32),) |
28 |
# Build win32 tools in Linux |
|
29 |
CDEFS.TOOLS2:=$(CDEFS.WIN32) $(CDEFS) |
|
30 |
CFLAGS:=$(CFLAGS.WIN32) $(CFLAGS) $(OPTION_GCC) |
|
31 |
COMPILER_PATH:=$(COMPILER_PATH.WIN32) |
|
32 |
OUTPUTPATH:=$(OUTPUTPATH)/$(TARGET)_$(TARGETTYPE)/tools2/$(VARIANTTYPE) |
|
33 |
else |
|
34 |
# Build linux tools in Linux |
|
3 | 35 |
CDEFS.TOOLS2:=$(CDEFS.LINUX) $(CDEFS) |
36 |
CFLAGS:=$(CFLAGS) $(OPTION_GCC) |
|
37 |
COMPILER_PATH=$(COMPILER_PATH.LINUX) |
|
317 | 38 |
OUTPUTPATH:=$(OUTPUTPATH)/$(TARGET)_$(TARGETTYPE)/tools2/$(VARIANTTYPE)$(TOOLPLATFORMDIR) |
3 | 39 |
endif |
317 | 40 |
endif |
41 |
||
42 |
||
3 | 43 |
CDEFS.TOOLS2:=$(call makemacrodef,$(OPT.D),$(CDEFS.TOOLS2)) |
44 |
||
45 |
## Locally used variables |
|
46 |
CREATABLEPATHS:=$(OUTPUTPATH) $(RELEASEPATH) $(TOOLSPATH) |
|
47 |
||
48 |
## Global targets |
|
49 |
$(ALLTARGET):: $(TARGETS) |
|
50 |
TARGET:: $(TARGETS) |
|
51 |
||
52 |
## Pre-Include directories |
|
53 |
ifneq ($(INC.COMPILER),) |
|
54 |
PINCLUDE:=$(patsubst %,$(OPT.PREINCLUDE)%,$(INC.COMPILER)) |
|
55 |
endif |
|
56 |
||
57 |
## User and System Include directories |
|
58 |
ifneq ($(USERINCLUDE),) |
|
59 |
UINCLUDE:=$(patsubst %,$(OPT.USERINCLUDE)%,$(USERINCLUDE)) |
|
60 |
endif |
|
61 |
ifneq ($(SYSTEMINCLUDE),) |
|
62 |
SINCLUDE:=$(patsubst %,$(OPT.SYSTEMINCLUDE)%,$(SYSTEMINCLUDE)) |
|
63 |
endif |
|
64 |
||
65 |
INCLUDES:=$(PINCLUDE) $(UINCLUDE) $(SINCLUDE) |
|
66 |
||
67 |
## Source files |
|
68 |
CPPFILES:=$(filter %.CPP,$(SOURCE)) |
|
69 |
cppFILES:=$(filter %.cpp,$(SOURCE)) |
|
70 |
CFILES:=$(filter %.C,$(SOURCE)) |
|
71 |
cFILES:=$(filter %.c,$(SOURCE)) |
|
72 |
||
73 |
## Object files |
|
74 |
CPPOBJFILES:=$(patsubst %,$(OUTPUTPATH)/%,$(notdir $(patsubst %.CPP,%.o,$(CPPFILES)))) |
|
75 |
cppOBJFILES:=$(patsubst %,$(OUTPUTPATH)/%,$(notdir $(patsubst %.cpp,%.o,$(cppFILES)))) |
|
76 |
COBJFILES:=$(patsubst %,$(OUTPUTPATH)/%,$(notdir $(patsubst %.C,%.o,$(CFILES)))) |
|
77 |
cOBJFILES:=$(patsubst %,$(OUTPUTPATH)/%,$(notdir $(patsubst %.c,%.o,$(cFILES)))) |
|
78 |
OBJECTFILES:=$(CPPOBJFILES) $(cppOBJFILES) $(cOBJFILES) $(COBJFILES) |
|
79 |
||
80 |
CLEANTARGETS:= |
|
81 |
## Compile CPP and cpp files |
|
82 |
define compile2object |
|
83 |
$(eval compile2object_TARGET:=$(OUTPUTPATH)/$(patsubst %.$(2),%.o,$(notdir $(1)))) |
|
84 |
$(eval DEPENDFILENAME:=$(compile2object_TARGET).d) |
|
85 |
$(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME))) |
|
86 |
$(compile2object_TARGET): $(1) $(if (DEPENDFILE),,EXPORT) |
|
87 |
$(call startrule,compile2object,,$(1)) \ |
|
88 |
$(if $(COMPILER_PATH),COMPILER_PATH="$(COMPILER_PATH)",) \ |
|
89 |
$(COMPILER) $(CFLAGS) $(CDEFS.TOOLS2) -MD -MT"$$@" -MF"$(DEPENDFILENAME)" $(INCLUDES) $(OPT.O)"$$@" "$(1)" \ |
|
90 |
$(call endrule,compile2object) |
|
91 |
||
92 |
CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME) |
|
93 |
ifneq "$(DEPENDFILE)" "" |
|
94 |
ifeq ($(NO_DEPEND_INCLUDE),) |
|
95 |
ifeq "$(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS)))" "" |
|
96 |
-include $(DEPENDFILE) |
|
97 |
endif |
|
98 |
endif |
|
99 |
endif |
|
100 |
||
101 |
endef |
|
102 |
||
103 |
$(foreach SRC,$(CPPFILES),$(eval $(call compile2object,$(SRC),CPP))) |
|
104 |
$(foreach SRC,$(cppFILES),$(eval $(call compile2object,$(SRC),cpp))) |
|
105 |
$(foreach SRC,$(CFILES),$(eval $(call compile2object,$(SRC),C))) |
|
106 |
$(foreach SRC,$(cFILES),$(eval $(call compile2object,$(SRC),c))) |
|
107 |
||
108 |
### Conclusion - cleanup and introspection ####################### |
|
109 |
||
110 |
# make the output directories while reading makefile - some build engines prefer this |
|
111 |
$(call makepath,$(CREATABLEPATHS)) |
|
112 |
||
5 | 113 |
## Clean up |
114 |
$(call raptor_clean,$(CLEANTARGETS) $(OBJECTFILES)) |
|
115 |
## 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
|
116 |
$(call raptor_release,$(RELEASABLES)) |
3 | 117 |
|
118 |
## The End |