3
|
1 |
# Copyright (c) 2008-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 |
# 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 |
|
|
31 |
RELEASEABLES:=$(RELEASEABLES) $(RELEASETARGET)
|
|
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 |
# other
|
|
62 |
PDBFILE:=$(if $(GENDEBUGINFO),$(RELEASEPATH)/$(TARGET).pdb,)
|
|
63 |
CLEANTARGETS:=$(CLEANTARGETS) $(PDBFILE)
|
|
64 |
|
|
65 |
#compile
|
|
66 |
define msvctoolscompile
|
|
67 |
$(BUILDPATH)/$(basename $(notdir $(1))).obj: $(1) $(PROJECT_META) $(if $(HAVE_ORDERONLY),|,) EXPORT
|
|
68 |
$(call startrule,msvctoolscompile,,$(1)) \
|
|
69 |
$(CC) \
|
|
70 |
$(if $(findstring staticlib,$(BASE_TYPE)),,$(CFLAGS.LIB)) \
|
|
71 |
$(CFLAGS) $$(subst /,-,$(OPTION_MSVC)) \
|
|
72 |
$(if $(findstring /W,$(OPTION_MSVC)),,$(CFLAGS.DEFAULT.WARNLEVEL)) \
|
|
73 |
$(if $(PDBFILE),$$(call msvcformatarg,$(OPT.PDBFILE),$(PDBFILE)),) \
|
|
74 |
$(DEFINES) $(INCLUDES) \
|
|
75 |
$$(call msvcformatarg,$(OPT.BROWSEFILE),$(BUILDPATH)/$(basename $(notdir $(1))).sbr) \
|
|
76 |
$$(call msvcformatarg,$(OPT.OBJECTFILE),$$@) $(1) \
|
|
77 |
$(call endrule,msvctoolscompile)
|
|
78 |
endef
|
|
79 |
# make the output directories while reading makefile - some build engines prefer this
|
|
80 |
$(call makepath,$(BUILDPATH))
|
|
81 |
$(foreach SRCFILE,$(SOURCE),$(eval $(call msvctoolscompile,$(SRCFILE))))
|
|
82 |
|
|
83 |
# assembler listing
|
|
84 |
define msvctoolslisting
|
|
85 |
LISTING:: $(BUILDPATH)/$(basename $(notdir $(1))).lis
|
|
86 |
$(GNUCP) $$< $(basename $(1)).tools.lst
|
|
87 |
|
|
88 |
$(BUILDPATH)/$(basename $(notdir $(1))).lis: $(1)
|
|
89 |
$(call startrule,msvctoolslisting) \
|
|
90 |
$(CC) \
|
|
91 |
$(if $(findstring staticlib,$(BASE_TYPE)),,$(CFLAGS.LIB)) \
|
|
92 |
$(CFLAGS) $$(subst /,-,$(OPTION_MSVC)) \
|
|
93 |
$(if $(findstring /W,$(OPTION_MSVC)),,$(CFLAGS.DEFAULT.WARNLEVEL)) \
|
|
94 |
$(DEFINES) $(INCLUDES) \
|
|
95 |
$$(call msvcformatarg,$(OPT.LISTING),$(BUILDPATH)/$(basename $(notdir $(1))).lis) \
|
|
96 |
$(1) \
|
|
97 |
$(call endrule,msvctoolslisting)
|
|
98 |
|
|
99 |
endef
|
|
100 |
$(foreach SRCFILE,$(SOURCE),$(eval $(call msvctoolslisting,$(SRCFILE))))
|
|
101 |
|
|
102 |
|
|
103 |
ifeq ($(BASE_TYPE),staticlib)
|
|
104 |
|
|
105 |
#############
|
|
106 |
## ARCHIVE ##
|
|
107 |
#############
|
|
108 |
|
|
109 |
ARCHIVERRESPONSEFILE:=$(BUILDPATH)/$(TARGET).arf
|
|
110 |
CLEANTARGETS:=$(CLEANTARGETS) $(ARCHIVERRESPONSEFILE)
|
|
111 |
|
|
112 |
define msvctoolsarchive
|
|
113 |
$(RELEASETARGET): $(OBJFILES)
|
|
114 |
@echo "" > $(ARCHIVERRESPONSEFILE);
|
|
115 |
$(call groupin10infile,$(ARCHIVERRESPONSEFILE),$(OBJFILES)) ;
|
|
116 |
$(call startrule,msvctoolsarchive) \
|
|
117 |
$(AR) $(ARFLAGS) $(OPT.SUBSYSTEM)$(SUBSYSTEM) $$(call msvcformatarg,$(OPT.OUTFILE),$$@) \
|
|
118 |
$$(call msvcformatarg,$(PREFIX.RESPONSEFILE),$(ARCHIVERRESPONSEFILE)) \
|
|
119 |
$(if $(SAVESPACE),; $(GNURM) -f $(OBJFILES); true,) \
|
|
120 |
$(call endrule,msvctoolsarchive)
|
|
121 |
|
|
122 |
endef
|
|
123 |
$(eval $(msvctoolsarchive))
|
|
124 |
|
|
125 |
else
|
|
126 |
|
|
127 |
##########
|
|
128 |
## LINK ##
|
|
129 |
##########
|
|
130 |
|
|
131 |
STATICLIBS:=$(patsubst %,$(RELEASEPATH)/%.lib,$(STATICLIBRARY))
|
|
132 |
IMPORTLIBS:=$(patsubst %.dso,$(IMPORTLIBPATH)/%.lib,$(LIBRARY))
|
|
133 |
LINKERRESPONSEFILE:=$(BUILDPATH)/$(TARGET).lrf
|
|
134 |
CLEANTARGETS:=$(CLEANTARGETS) $(RELEASETARGET).lib $(LINKERRESPONSEFILE)
|
|
135 |
|
|
136 |
define msvctoolslink
|
|
137 |
$(RELEASETARGET): $(OBJFILES) $(STATICLIBS) $(IMPORTLIBS)
|
|
138 |
@echo "" > $(LINKERRESPONSEFILE);
|
|
139 |
$(call groupin10infile,$(LINKERRESPONSEFILE),$(STATICLIBS) $(IMPORTLIBS) $(OBJFILES)) ;
|
|
140 |
$(call startrule,msvctoolslink) \
|
|
141 |
$(LD) $(LFLAGS) $(WIN32_LIBRARY) $(OPT.SUBSYSTEM)$(SUBSYSTEM) \
|
|
142 |
$$(call msvcformatarg,$(OPT.OUTFILE),$$@) \
|
|
143 |
$$(call msvcformatarg,$(OPT.IMPLIB),$(RELEASETARGET).lib) \
|
|
144 |
$$(call msvcformatarg,$(PREFIX.RESPONSEFILE),$(LINKERRESPONSEFILE)) \
|
|
145 |
$(if $(SAVESPACE),; $(GNURM) -f $(OBJFILES); true,) \
|
|
146 |
$(call endrule,msvctoolslink)
|
|
147 |
endef
|
|
148 |
$(eval $(msvctoolslink))
|
|
149 |
|
|
150 |
endif
|
|
151 |
|
|
152 |
|
|
153 |
#############
|
|
154 |
## INSTALL ##
|
|
155 |
#############
|
|
156 |
|
|
157 |
ifneq ($(INSTALLPATH),)
|
|
158 |
INSTALLTARGET:=$(INSTALLPATH)/$(TARGET).$(if $(REQUESTEDTARGETEXT),$(REQUESTEDTARGETEXT),$(TARGETTYPE))
|
|
159 |
RELEASEABLES:=$(RELEASEABLES) $(INSTALLTARGET)
|
|
160 |
|
|
161 |
define msvctoolsinstall
|
|
162 |
$(INSTALLTARGET): $(RELEASETARGET)
|
|
163 |
$(call startrule,msvctoolsinstall) \
|
|
164 |
$(GNUCP) $$< $$@ && \
|
|
165 |
$(GNUCHMOD) a+rwx $$@ \
|
|
166 |
$(call endrule,msvctoolsinstall)
|
|
167 |
endef
|
|
168 |
# make the output directories while reading makefile - some build engines prefer this
|
|
169 |
$(call makepath,$(INSTALLPATH))
|
|
170 |
$(eval $(msvctoolsinstall))
|
|
171 |
endif
|
|
172 |
|
|
173 |
|
|
174 |
##########################
|
|
175 |
## BROWSE DB GENERATION ##
|
|
176 |
##########################
|
|
177 |
|
|
178 |
ifneq ($(GENDEBUGINFO),)
|
|
179 |
BSCFILE:=$(RELEASEPATH)/$(TARGET).bsc
|
|
180 |
BSCRESPONSEFILE:=$(BUILDPATH)/$(TARGET).brf
|
5
|
181 |
CLEANTARGETS:=$(CLEANTARGETS) $(BSCRESPONSEFILE)
|
3
|
182 |
RELEASEABLES:=$(RELEASEABLES) $(BSCFILE)
|
|
183 |
|
|
184 |
define msvctoolsgenbrowse
|
|
185 |
$(BSCFILE): $(OBJFILES)
|
|
186 |
@echo "" > $(BSCRESPONSEFILE);
|
|
187 |
$(call groupin10infile,$(BSCRESPONSEFILE),$(SBRFILES)) ;
|
|
188 |
$(call startrule,msvctoolsgenbrowse) \
|
|
189 |
$(BROWSETOOL) $(BROWSEFLAGS) $$(call msvcformatarg,$(OPT.BROWSEDB),$$@) \
|
|
190 |
$$(call msvcformatarg,$(PREFIX.RESPONSEFILE),$(BSCRESPONSEFILE)) \
|
|
191 |
$(if $(SAVESPACE),; $(GNURM) -f $(SBRFILES); true,) \
|
|
192 |
$(call endrule,msvctoolsgenbrowse)
|
|
193 |
endef
|
|
194 |
$(eval $(msvctoolsgenbrowse))
|
|
195 |
endif
|
|
196 |
|
|
197 |
|
|
198 |
# Global targets
|
|
199 |
.PHONY:: $(ALLTARGET)
|
|
200 |
$(ALLTARGET):: $(RELEASEABLES)
|
|
201 |
TARGET:: $(RELEASEABLES)
|
|
202 |
|
|
203 |
ifeq ($(BASE_TYPE),staticlib)
|
|
204 |
LIBRARY:: $(RELEASETARGET) $(INSTALLTARGET)
|
|
205 |
endif
|
|
206 |
|
|
207 |
# clean up
|
5
|
208 |
$(call raptor_clean,$(CLEANTARGETS))
|
|
209 |
# for the --what option and the log file
|
|
210 |
$(call raptor_release,$(INSTALLTARGET))
|