update dev300-m58
[ooovba.git] / solenv / inc / tg_app.mk
blob423b73b995305d851fb18dd7bee4ee0f344d3fdb
1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # $RCSfile: tg_app.mk,v $
11 # $Revision: 1.75 $
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
32 #######################################################
33 # instructions for linking
34 # unroll begin
36 .IF "$(GUI)" == "OS2" && "$(TARGETTYPE)" == "GUI"
37 APP$(TNR)DEF = $(MISC)/$(APP$(TNR)TARGET).def
38 .ENDIF
40 .IF "$(APP$(TNR)LINKTYPE)" != ""
41 #must be either STATIC or SHARED
42 APP$(TNR)LINKTYPEFLAG=$(APPLINK$(APP$(TNR)LINKTYPE))
43 .ENDIF
45 # decide how to link
46 .IF "$(APP$(TNR)CODETYPE)"=="C"
47 APP$(TNR)LINKER=$(LINKC)
48 APP$(TNR)STDLIB=$(subst,CPPRUNTIME, $(STDLIB))
49 APP$(TNR)LINKFLAGS+=$(LINKCFLAGS)
50 .ELSE # "$(APP$(TNR)CODETYPE)"=="C"
51 APP$(TNR)LINKER=$(LINK)
52 APP$(TNR)STDLIB=$(subst,CPPRUNTIME,$(STDLIBCPP) $(STDLIB))
53 APP$(TNR)LINKFLAGS+=$(LINKFLAGS)
54 .ENDIF # "$(APP$(TNR)CODETYPE)"=="C"
56 APP$(TNR)RPATH*=OOO
57 LINKFLAGSRUNPATH_$(APP$(TNR)RPATH)*=/ERROR:/Bad_APP$(TNR)RPATH_value
58 .IF "$(OS)" != "MACOSX"
59 APP$(TNR)LINKFLAGS+=$(LINKFLAGSRUNPATH_$(APP$(TNR)RPATH))
60 .ENDIF
62 .IF "$(APP$(TNR)STACK)" != ""
63 .IF "$(LINKFLAGSTACK)" != ""
64 APP$(TNR)STACKN=$(LINKFLAGSTACK)$(APP$(TNR)STACK)
65 .ENDIF
66 .ELSE
67 APP$(TNR)STACKN=
68 .ENDIF
70 .IF "$(APP$(TNR)NOSAL)"==""
71 .IF "$(TARGETTYPE)" == "GUI"
72 APP$(TNR)OBJS+= $(STDOBJVCL)
73 .ENDIF
74 .ENDIF
76 .IF "$(GUI)$(COM)" == "WNTGCC"
77 APP$(TNR)RESO=
78 .IF "$(APP$(TNR)LINKRES)" != "" || "$(APP$(TNR)RES)" != ""
79 APP$(TNR)RESO=$(MISC)/$(APP$(TNR)TARGET:b)_res.o
80 .ENDIF
81 .ENDIF
83 .IF "$(GUI)" == "UNX"
84 APP$(TNR)DEPN+:=$(APP$(TNR)DEPNU)
85 USE_APP$(TNR)DEF=
86 .ENDIF
88 .IF "$(APP$(TNR)TARGETN)"!=""
90 .IF "$(APP$(TNR)PRODUCTNAME)"!=""
91 APP$(TNR)PRODUCTDEF:=-DPRODUCT_NAME=\"$(APP$(TNR)PRODUCTNAME)\"
92 .ENDIF # "$(APP$(TNR)PRODUCTNAME)"!=""
94 .IF "$(linkinc)"!=""
95 .IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
96 .IF "$(APP$(TNR)LIBS)"!=""
97 $(MISC)/$(APP$(TNR)TARGET)_linkinc.ls .PHONY:
98 @@-$(RM) $@
99 sed -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(APP$(TNR)LIBS) $(i:s/.lib/.lin/)) >> $@
100 .ENDIF #"$(APP$(TNR)LIBS)"!=""
101 .ENDIF
103 LINKINCTARGETS+=$(MISC)/$(APP$(TNR)TARGETN:b)_linkinc.ls
104 $(APP$(TNR)TARGETN) : $(LINKINCTARGETS)
105 .ENDIF # "$(linkinc)"!=""
107 # Allow for target specific LIBSALCPPRT override
108 APP$(TNR)LIBSALCPPRT*=$(LIBSALCPPRT)
110 .IF "$(GUI)" == "OS2"
111 _APP$(TNR)IMP_ORD = $(APP$(TNR)STDLIBS:^"$(SOLARVERSION)/$(INPATH)/lib/") $(APP$(TNR)STDLIBS:^"$(LB)/")
112 APP$(TNR)IMP_ORD = $(foreach,i,$(_APP$(TNR)IMP_ORD) $(shell @-ls $i))
113 .ELSE
114 APP$(TNR)IMP_ORD =
115 .ENDIF
117 $(APP$(TNR)TARGETN): $(APP$(TNR)OBJS) $(APP$(TNR)LIBS) \
118 $(APP$(TNR)RES) \
119 $(APP$(TNR)IMP_ORD) \
120 $(APP$(TNR)ICON) $(APP$(TNR)DEPN) $(USE_APP$(TNR)DEF)
121 @echo ------------------------------
122 @echo Making: $@
123 .IF "$(GUI)"=="UNX"
124 .IF "$(OS)"=="MACOSX"
125 @echo unx
126 @-$(RM) $(MISC)/$(@:b).list
127 @-$(RM) $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
128 @-$(RM) $(MISC)/$(@:b).strip
129 @echo $(STDSLO) $(APP$(TNR)OBJS:s/.obj/.o/) \
130 `cat /dev/null $(APP$(TNR)LIBS) | sed s\#$(ROUT)\#$(OUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list
131 @echo -n $(APP$(TNR)LINKER) $(APP$(TNR)LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) -o $@ \
132 $(APP$(TNR)LINKTYPEFLAG) $(APP$(TNR)STDLIBS) $(APP$(TNR)STDLIB) $(STDLIB$(TNR)) -filelist $(MISC)/$(@:b).list > $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
133 @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \
134 `cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd` \
135 >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
136 @cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
137 @+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
138 # Need to strip __objcInit symbol to avoid duplicate symbols when loading
139 # libraries at runtime
140 @-nm $@ | grep -v ' U ' | $(AWK) '{ print $$NF }' | grep -F -x '__objcInit' > $(MISC)/$(@:b).strip
141 @strip -i -R $(MISC)/$(@:b).strip -X $@
142 @ls -l $@
143 @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \
144 app $(APP$(TNR)RPATH) $@
145 .IF "$(TARGETTYPE)"=="GUI"
146 @echo "Making: $@.app"
147 @macosx-create-bundle $@
148 .ENDIF # "$(TARGETTYPE)"=="GUI"
149 .ELSE # "$(OS)"=="MACOSX"
150 @echo unx
151 @-$(RM) $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
152 @echo $(APP$(TNR)LINKER) $(APP$(TNR)LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
153 $(APP$(TNR)OBJS:s/.obj/.o/) '\' > $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
154 @cat $(mktmp /dev/null $(APP$(TNR)LIBS)) | xargs -n 1 cat | sed s\#$(ROUT)\#$(OUT)\#g | sed 's#$$# \\#' >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
155 @echo $(APP$(TNR)LINKTYPEFLAG) $(APP$(TNR)LIBSALCPPRT) $(APP$(TNR)STDLIBS) $(APP$(TNR)STDLIB) $(STDLIB$(TNR)) -o $@ >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
156 cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
157 @+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
158 @ls -l $@
159 .ENDIF # "$(OS)"=="MACOSX"
160 .ENDIF
161 .IF "$(GUI)" == "WNT"
162 @@-$(MKDIR) $(@:d:d)
163 .IF "$(APP$(TNR)LINKRES)" != ""
164 @@-$(RM) $(MISC)/$(APP$(TNR)LINKRES:b).rc
165 .IF "$(APP$(TNR)ICON)" != ""
166 @-echo 1 ICON $(EMQ)"$(APP$(TNR)ICON:s/\/\\/)$(EMQ)" >> $(MISC)/$(APP$(TNR)LINKRES:b).rc
167 .ENDIF # "$(APP$(TNR)ICON)" != ""
168 .IF "$(APP$(TNR)VERINFO)" != ""
169 @-echo $(EMQ)#define VERVARIANT $(BUILD) >> $(MISC)/$(APP$(TNR)LINKRES:b).rc
170 @-echo $(EMQ)#include $(EMQ)"$(APP$(TNR)VERINFO)$(EMQ)" >> $(MISC)/$(APP$(TNR)LINKRES:b).rc
171 .ENDIF # "$(APP$(TNR)VERINFO)" != ""
172 $(RC) -DWIN32 $(APP$(TNR)PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP$(TNR)LINKRES:b).rc
173 .ENDIF # "$(APP$(TNR)LINKRES)" != ""
174 .IF "$(COM)" == "GCC"
175 @echo mingw
176 .IF "$(APP$(TNR)LINKRES)" != "" || "$(APP$(TNR)RES)" != ""
177 @cat $(APP$(TNR)LINKRES) $(subst,/res/,/res{$(subst,$(BIN), $(@:d))} $(APP$(TNR)RES)) > $(MISC)/$(@:b)_all.res
178 windres $(MISC)/$(@:b)_all.res $(APP$(TNR)RESO)
179 .ENDIF
180 @echo $(LINK) $(LINKFLAGS) $(LINKFLAGSAPP) $(MINGWSSTDOBJ) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
181 $(APP$(TNR)BASEX) $(APP$(TNR)STACKN) -o $@ $(APP$(TNR)OBJS) \
182 -Wl,-Map,$(MISC)/$(@:b).map $(STDOBJ) $(APP$(TNR)RESO) \
183 `$(TYPE) /dev/null $(APP$(TNR)LIBS) | sed s#$(ROUT)#$(OUT)#g` \
184 $(APP_LINKTYPE) $(APP$(TNR)LIBSALCPPRT) \
185 -Wl,--start-group $(APP$(TNR)STDLIBS) -Wl,--end-group $(APP$(TNR)STDLIB) \
186 $(STDLIB$(TNR)) $(MINGWSSTDENDOBJ) > $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
187 @$(TYPE) $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
188 @+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
189 @ls -l $@
190 .ELSE # "$(COM)" == "GCC"
191 .IF "$(linkinc)" == ""
192 $(APP$(TNR)LINKER) @$(mktmp \
193 $(APP$(TNR)LINKFLAGS) \
194 $(LINKFLAGSAPP) $(APP$(TNR)BASEX) \
195 $(APP$(TNR)STACKN) \
196 -out:$@ \
197 -map:$(MISC)/{$(subst,/,_ $(APP$(TNR)TARGET)).map} \
198 $(STDOBJ) \
199 $(APP$(TNR)LINKRES) \
200 $(APP$(TNR)RES) \
201 $(APP$(TNR)OBJS) \
202 $(APP$(TNR)LIBS) \
203 $(APP$(TNR)STDLIBS) \
204 $(APP$(TNR)STDLIB) $(STDLIB$(TNR)) \
206 @-echo linking $@.manifest ...
207 .IF "$(VISTA_MANIFEST)"!=""
208 $(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
209 $(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.tmanifest -outputresource:$@$(EMQ);1 $(FI)
210 .ELSE
211 $(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.manifest -outputresource:$@$(EMQ);1 $(FI)
212 .ENDIF # "$(VISTA_MANIFEST)"!=""
213 $(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
214 $(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
215 .ELSE
216 -$(RM) $(MISC)\$(APP$(TNR)TARGET).lnk
217 -$(RM) $(MISC)\$(APP$(TNR)TARGET).lst
218 -$(RM) $(MISC)\linkobj.lst
219 for %_i in ($(MISC)\*.obj) do type %_i >> $(MISC)\linkobj.lst
220 type $(mktmp,$(MISC)\$(APP$(TNR)TARGET).lst
221 $(APP$(TNR)LINKFLAGS) \
222 $(LINKFLAGSAPP) $(APP$(TNR)BASEX) \
223 $(APP$(TNR)STACKN) \
224 -out:$@ \
225 $(STDOBJ) \
226 $(APP$(TNR)LINKRES) \
227 $(APP$(TNR)RES) \
228 $(APP$(TNR)OBJS) \
229 $(APP$(TNR)LIBS) \
230 $(APP$(TNR)STDLIBS) \
231 $(APP$(TNR)STDLIB) $(STDLIB$(TNR)))
232 $(SED) -e 's/\(\.\.\\\)\{2,4\}/..\\/g' $(MISC)\$(APP$(TNR)TARGETN:b)_linkobj.lst >> $(MISC)\$(APP$(TNR)TARGET).lst
233 $(IFEXIST) $(MISC)/$(APP$(TNR)TARGET).lst $(THEN) type $(MISC)/$(APP$(TNR)TARGET).lst >> $(MISC)/$(APP$(TNR)TARGET).lnk $(FI)
234 $(APP$(TNR)LINKER) @$(MISC)\$(APP$(TNR)TARGET).lnk
235 .ENDIF # "$(linkinc)" == ""
236 .ENDIF # "$(COM)" == "GCC"
237 .IF "$(APP$(TNR)TARGET)" == "loader"
238 $(PERL) loader.pl $@
239 $(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
240 $(RM) $@
241 $(RENAME) $(@:d)_new.exe $(@:d)loader.exe
242 .ENDIF # "$(TARGET)" == "setup"
244 .ENDIF # "$(GUI)" == "WNT"
246 .IF "$(GUI)" == "OS2"
247 @+-$(MKDIR) $(@:d:d) >& $(NULLDEV)
248 .IF "$(APP$(TNR)LINKRES)" != ""
249 @+-$(RM) $(MISC)/$(APP$(TNR)LINKRES:b).rc >& $(NULLDEV)
250 .IF "$(APP$(TNR)ICON)" != ""
251 @-+$(WRAPCMD) echo 1 ICON $(EMQ)"$(APP$(TNR)ICON)$(EMQ)" | $(SED) 'sX\\X\\\\Xg' >> $(MISC)/$(APP$(TNR)LINKRES:b).rc
252 .ENDIF # "$(APP$(TNR)ICON)" != ""
253 .IF "$(APP$(TNR)VERINFO)" != ""
254 @-+echo $(EMQ)#define VERVARIANT $(BUILD) >> $(MISC)/$(APP$(TNR)LINKRES:b).rc
255 @-+echo $(EMQ)#include $(EMQ)"$(APP$(TNR)VERINFO)$(EMQ)" >> $(MISC)/$(APP$(TNR)LINKRES:b).rc
256 .ENDIF # "$(APP$(TNR)VERINFO)" != ""
257 $(RC) -r -DOS2 $(APP$(TNR)PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP$(TNR)LINKRES:b).rc
258 .ENDIF # "$(APP$(TNR)LINKRES)" != ""
260 .IF "$(TARGETTYPE)" == "GUI"
261 @echo NAME $(APP$(TNR)TARGET) WINDOWAPI > $(MISC)/$(APP$(TNR)TARGET).def
262 .ENDIF
264 @+echo $(APP$(TNR)LINKFLAGS) \
265 $(LINKFLAGSAPP) $(APP$(TNR)BASEX) \
266 $(APP$(TNR)STACKN) \
267 -o $@ \
268 -Zmap -L$(LB) \
269 -L$(SOLARVERSION)/$(INPATH)/lib \
270 $(STDOBJ) \
271 $(APP$(TNR)LINKRES) \
272 $(APP$(TNR)RES) \
273 $(APP$(TNR)DEF) \
274 $(APP$(TNR)OBJS) \
275 $(APP$(TNR)LIBS) \
276 $(APP$(TNR)STDLIBS:^"-l") \
277 $(APP$(TNR)STDLIB:^"-l") $(STDLIB$(TNR):^"-l")
278 $(APP$(TNR)LINKER) -v \
279 $(APP$(TNR)LINKFLAGS) \
280 $(LINKFLAGSAPP) $(APP$(TNR)BASEX) \
281 $(APP$(TNR)STACKN) \
282 -o $@ \
283 -Zmap -L$(LB) \
284 -L$(SOLARVERSION)/$(INPATH)/lib \
285 $(STDOBJ) \
286 $(APP$(TNR)LINKRES) \
287 $(APP$(TNR)RES) \
288 $(APP$(TNR)DEF) \
289 $(APP$(TNR)OBJS) \
290 $(APP$(TNR)LIBS) \
291 $(APP$(TNR)STDLIBS:^"-l") \
292 $(APP$(TNR)STDLIB:^"-l") $(STDLIB$(TNR):^"-l")
295 .IF "$(APP$(TNR)TARGET)" == "loader"
296 +$(PERL) loader.pl $@
297 +$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
298 +$(RM) $@
299 +$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
300 .ENDIF # "$(TARGET)" == "setup"
302 .ENDIF # "$(GUI)" == "OS2"
304 .ENDIF # "$(APP$(TNR)TARGETN)"!=""
307 # Instruction for linking
308 # unroll end
309 #######################################################