author | Jon Chatten |
Tue, 30 Mar 2010 15:24:50 +0100 | |
branch | fix |
changeset 421 | 7db5250b5d4c |
parent 385 | cc1110af33a3 |
permissions | -rw-r--r-- |
383
770bd0892cdd
Remove .pdb generation from tools deb builds (enabling full parallel builds).
Jon Chatten
parents:
5
diff
changeset
|
1 |
# Copyright (c) 2008-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 |
# MSVC TOOLS EXE/LIB Function Like Makefile (FLM) |
|
15 |
# Knows how to build all possible executables for the TOOLS build |
|
16 |
# |
|
17 |
# |
|
18 |
||
19 |
CLEANTARGETS:= |
|
20 |
RELEASABLES:= |
|
21 |
INSTALLTARGET:= |
|
22 |
||
23 |
RELEASEPATH:=$(RELEASEPATHROOT)/$(FULLVARIANTPATH) |
|
24 |
BUILDPATH:=$(OUTPUTPATH)/$(FULLVARIANTPATH) |
|
25 |
RELEASETARGET:=$(RELEASEPATH)/$(TARGET).$(if $(REQUESTEDTARGETEXT),$(REQUESTEDTARGETEXT),$(TARGETTYPE)) |
|
26 |
||
27 |
# make the output directories while reading makefile - some build engines prefer this |
|
28 |
$(call makepath,$(RELEASEPATH)) |
|
29 |
$(call makepath,$(BUILDPATH)) |
|
30 |
||
385 | 31 |
RELEASABLES:=$(RELEASABLES) $(RELEASETARGET) |
3 | 32 |
|
33 |
GENDEBUGINFO:=$(if $(findstring deb,$(VARIANTTYPE)),1,) |
|
34 |
||
35 |
# MSVC "no space" arguments must take the form /<ARG><PATH_WITH_DOS_SLASHES> e.g. |
|
36 |
# /FoF:\object\file\to\be\created.obj |
|
37 |
define msvcformatarg |
|
38 |
$(1)$(subst /,\\\,$(2)) |
|
39 |
endef |
|
40 |
||
41 |
############# |
|
42 |
## COMPILE ## |
|
43 |
############# |
|
44 |
||
45 |
# object files and related |
|
46 |
OBJFILES:=$(patsubst %,$(BUILDPATH)/%.obj,$(basename $(notdir $(SOURCE)))) |
|
47 |
SBRFILES:=$(addsuffix .sbr, $(basename $(OBJFILES))) |
|
48 |
LISFILES:=$(addsuffix .lis, $(basename $(OBJFILES))) |
|
49 |
LSTFILES:=$(addsuffix .tools.lst, $(basename $(SOURCE))) |
|
50 |
CLEANTARGETS:=$(CLEANTARGETS) $(OBJFILES) $(SBRFILES) $(LISFILES) $(LSTFILES) |
|
51 |
||
52 |
# include paths and preinclude file |
|
53 |
UINCLUDE:=$(patsubst %,$(OPT.USERINCLUDE)%,$(USERINCLUDE)) |
|
54 |
SINCLUDE:=$(patsubst %,$(OPT.SYSINCLUDE)%,$(SYSTEMINCLUDE)) |
|
55 |
PINCLUDE:=$(OPT.PREINCLUDE)$(notdir $(PRODUCT_INCLUDE)) |
|
56 |
INCLUDES:=$(PINCLUDE) $(UINCLUDE) $(SINCLUDE) |
|
57 |
||
58 |
# macros |
|
59 |
DEFINES:=$(call makemacrodef,$(OPT.DEFINE),$(CDEFS) $(BASE_MACRO) $(CFLAGS.ADD)) |
|
60 |
||
61 |
#compile |
|
62 |
define msvctoolscompile |
|
63 |
$(BUILDPATH)/$(basename $(notdir $(1))).obj: $(1) $(PROJECT_META) $(if $(HAVE_ORDERONLY),|,) EXPORT |
|
64 |
$(call startrule,msvctoolscompile,,$(1)) \ |
|
65 |
$(CC) \ |
|
66 |
$(if $(findstring staticlib,$(BASE_TYPE)),,$(CFLAGS.LIB)) \ |
|
67 |
$(CFLAGS) $$(subst /,-,$(OPTION_MSVC)) \ |
|
68 |
$(if $(findstring /W,$(OPTION_MSVC)),,$(CFLAGS.DEFAULT.WARNLEVEL)) \ |
|
69 |
$(DEFINES) $(INCLUDES) \ |
|
70 |
$$(call msvcformatarg,$(OPT.BROWSEFILE),$(BUILDPATH)/$(basename $(notdir $(1))).sbr) \ |
|
71 |
$$(call msvcformatarg,$(OPT.OBJECTFILE),$$@) $(1) \ |
|
72 |
$(call endrule,msvctoolscompile) |
|
73 |
endef |
|
74 |
# make the output directories while reading makefile - some build engines prefer this |
|
75 |
$(call makepath,$(BUILDPATH)) |
|
76 |
$(foreach SRCFILE,$(SOURCE),$(eval $(call msvctoolscompile,$(SRCFILE)))) |
|
77 |
||
78 |
# assembler listing |
|
79 |
define msvctoolslisting |
|
80 |
LISTING:: $(BUILDPATH)/$(basename $(notdir $(1))).lis |
|
81 |
$(GNUCP) $$< $(basename $(1)).tools.lst |
|
82 |
||
83 |
$(BUILDPATH)/$(basename $(notdir $(1))).lis: $(1) |
|
84 |
$(call startrule,msvctoolslisting) \ |
|
85 |
$(CC) \ |
|
86 |
$(if $(findstring staticlib,$(BASE_TYPE)),,$(CFLAGS.LIB)) \ |
|
87 |
$(CFLAGS) $$(subst /,-,$(OPTION_MSVC)) \ |
|
88 |
$(if $(findstring /W,$(OPTION_MSVC)),,$(CFLAGS.DEFAULT.WARNLEVEL)) \ |
|
89 |
$(DEFINES) $(INCLUDES) \ |
|
90 |
$$(call msvcformatarg,$(OPT.LISTING),$(BUILDPATH)/$(basename $(notdir $(1))).lis) \ |
|
91 |
$(1) \ |
|
92 |
$(call endrule,msvctoolslisting) |
|
93 |
||
94 |
endef |
|
95 |
$(foreach SRCFILE,$(SOURCE),$(eval $(call msvctoolslisting,$(SRCFILE)))) |
|
96 |
||
97 |
||
98 |
ifeq ($(BASE_TYPE),staticlib) |
|
99 |
||
100 |
############# |
|
101 |
## ARCHIVE ## |
|
102 |
############# |
|
103 |
||
104 |
ARCHIVERRESPONSEFILE:=$(BUILDPATH)/$(TARGET).arf |
|
105 |
CLEANTARGETS:=$(CLEANTARGETS) $(ARCHIVERRESPONSEFILE) |
|
106 |
||
107 |
define msvctoolsarchive |
|
108 |
$(RELEASETARGET): $(OBJFILES) |
|
109 |
@echo "" > $(ARCHIVERRESPONSEFILE); |
|
110 |
$(call groupin10infile,$(ARCHIVERRESPONSEFILE),$(OBJFILES)) ; |
|
111 |
$(call startrule,msvctoolsarchive) \ |
|
112 |
$(AR) $(ARFLAGS) $(OPT.SUBSYSTEM)$(SUBSYSTEM) $$(call msvcformatarg,$(OPT.OUTFILE),$$@) \ |
|
113 |
$$(call msvcformatarg,$(PREFIX.RESPONSEFILE),$(ARCHIVERRESPONSEFILE)) \ |
|
114 |
$(if $(SAVESPACE),; $(GNURM) -f $(OBJFILES); true,) \ |
|
115 |
$(call endrule,msvctoolsarchive) |
|
116 |
||
117 |
endef |
|
118 |
$(eval $(msvctoolsarchive)) |
|
119 |
||
120 |
else |
|
121 |
||
122 |
########## |
|
123 |
## LINK ## |
|
124 |
########## |
|
125 |
||
126 |
STATICLIBS:=$(patsubst %,$(RELEASEPATH)/%.lib,$(STATICLIBRARY)) |
|
127 |
IMPORTLIBS:=$(patsubst %.dso,$(IMPORTLIBPATH)/%.lib,$(LIBRARY)) |
|
128 |
LINKERRESPONSEFILE:=$(BUILDPATH)/$(TARGET).lrf |
|
129 |
CLEANTARGETS:=$(CLEANTARGETS) $(RELEASETARGET).lib $(LINKERRESPONSEFILE) |
|
130 |
||
131 |
define msvctoolslink |
|
132 |
$(RELEASETARGET): $(OBJFILES) $(STATICLIBS) $(IMPORTLIBS) |
|
133 |
@echo "" > $(LINKERRESPONSEFILE); |
|
134 |
$(call groupin10infile,$(LINKERRESPONSEFILE),$(STATICLIBS) $(IMPORTLIBS) $(OBJFILES)) ; |
|
135 |
$(call startrule,msvctoolslink) \ |
|
136 |
$(LD) $(LFLAGS) $(WIN32_LIBRARY) $(OPT.SUBSYSTEM)$(SUBSYSTEM) \ |
|
137 |
$$(call msvcformatarg,$(OPT.OUTFILE),$$@) \ |
|
138 |
$$(call msvcformatarg,$(OPT.IMPLIB),$(RELEASETARGET).lib) \ |
|
139 |
$$(call msvcformatarg,$(PREFIX.RESPONSEFILE),$(LINKERRESPONSEFILE)) \ |
|
140 |
$(if $(SAVESPACE),; $(GNURM) -f $(OBJFILES); true,) \ |
|
141 |
$(call endrule,msvctoolslink) |
|
142 |
endef |
|
143 |
$(eval $(msvctoolslink)) |
|
144 |
||
145 |
endif |
|
146 |
||
147 |
||
148 |
############# |
|
149 |
## INSTALL ## |
|
150 |
############# |
|
151 |
||
152 |
ifneq ($(INSTALLPATH),) |
|
153 |
INSTALLTARGET:=$(INSTALLPATH)/$(TARGET).$(if $(REQUESTEDTARGETEXT),$(REQUESTEDTARGETEXT),$(TARGETTYPE)) |
|
385 | 154 |
RELEASABLES:=$(RELEASABLES) $(INSTALLTARGET) |
3 | 155 |
|
156 |
define msvctoolsinstall |
|
157 |
$(INSTALLTARGET): $(RELEASETARGET) |
|
158 |
$(call startrule,msvctoolsinstall) \ |
|
159 |
$(GNUCP) $$< $$@ && \ |
|
160 |
$(GNUCHMOD) a+rwx $$@ \ |
|
161 |
$(call endrule,msvctoolsinstall) |
|
162 |
endef |
|
163 |
# make the output directories while reading makefile - some build engines prefer this |
|
164 |
$(call makepath,$(INSTALLPATH)) |
|
165 |
$(eval $(msvctoolsinstall)) |
|
166 |
endif |
|
167 |
||
168 |
||
169 |
########################## |
|
170 |
## BROWSE DB GENERATION ## |
|
171 |
########################## |
|
172 |
||
173 |
ifneq ($(GENDEBUGINFO),) |
|
174 |
BSCFILE:=$(RELEASEPATH)/$(TARGET).bsc |
|
175 |
BSCRESPONSEFILE:=$(BUILDPATH)/$(TARGET).brf |
|
5 | 176 |
CLEANTARGETS:=$(CLEANTARGETS) $(BSCRESPONSEFILE) |
385 | 177 |
RELEASABLES:=$(RELEASABLES) $(BSCFILE) |
3 | 178 |
|
179 |
define msvctoolsgenbrowse |
|
180 |
$(BSCFILE): $(OBJFILES) |
|
181 |
@echo "" > $(BSCRESPONSEFILE); |
|
182 |
$(call groupin10infile,$(BSCRESPONSEFILE),$(SBRFILES)) ; |
|
183 |
$(call startrule,msvctoolsgenbrowse) \ |
|
184 |
$(BROWSETOOL) $(BROWSEFLAGS) $$(call msvcformatarg,$(OPT.BROWSEDB),$$@) \ |
|
185 |
$$(call msvcformatarg,$(PREFIX.RESPONSEFILE),$(BSCRESPONSEFILE)) \ |
|
186 |
$(if $(SAVESPACE),; $(GNURM) -f $(SBRFILES); true,) \ |
|
187 |
$(call endrule,msvctoolsgenbrowse) |
|
188 |
endef |
|
189 |
$(eval $(msvctoolsgenbrowse)) |
|
190 |
endif |
|
191 |
||
192 |
||
193 |
# Global targets |
|
194 |
.PHONY:: $(ALLTARGET) |
|
385 | 195 |
$(ALLTARGET):: $(RELEASABLES) |
196 |
TARGET:: $(RELEASABLES) |
|
3 | 197 |
|
198 |
ifeq ($(BASE_TYPE),staticlib) |
|
199 |
LIBRARY:: $(RELEASETARGET) $(INSTALLTARGET) |
|
200 |
endif |
|
201 |
||
202 |
# clean up |
|
5 | 203 |
$(call raptor_clean,$(CLEANTARGETS)) |
204 |
# for the --what option and the log file |
|
205 |
$(call raptor_release,$(INSTALLTARGET)) |