xref: /trunk/main/solenv/inc/_tg_app.mk (revision eadca5ea)
1# *************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20# *************************************************************
21
22CC_PATH*="$(CC_PATH)"
23
24# unroll begin
25
26.IF "$(GUI)" == "OS2" && "$(TARGETTYPE)" == "GUI"
27APP1DEF = $(MISC)/$(APP1TARGET).def
28.ENDIF
29
30.IF "$(APP1LINKTYPE)" != ""
31#must be either STATIC or SHARED
32APP1LINKTYPEFLAG=$(APPLINK$(APP1LINKTYPE))
33.ENDIF
34
35# decide how to link
36.IF "$(APP1CODETYPE)"=="C"
37APP1LINKER=$(LINKC)
38APP1STDLIB=$(subst,CPPRUNTIME, $(STDLIB))
39APP1LINKFLAGS+=$(LINKCFLAGS)
40.ELSE			# "$(APP1CODETYPE)"=="C"
41APP1LINKER=$(LINK)
42APP1STDLIB=$(subst,CPPRUNTIME,$(STDLIBCPP) $(STDLIB))
43APP1LINKFLAGS+=$(LINKFLAGS)
44.ENDIF			# "$(APP1CODETYPE)"=="C"
45
46APP1RPATH*=OOO
47LINKFLAGSRUNPATH_$(APP1RPATH)*=/ERROR:/Bad_APP1RPATH_value
48.IF "$(OS)" != "MACOSX"
49APP1LINKFLAGS+=$(LINKFLAGSRUNPATH_$(APP1RPATH))
50.ENDIF
51
52.IF "$(APP1STACK)" != ""
53.IF "$(LINKFLAGSTACK)" != ""
54APP1STACKN=$(LINKFLAGSTACK)$(APP1STACK)
55.ENDIF
56.ELSE
57APP1STACKN=
58.ENDIF
59
60.IF "$(APP1NOSAL)"==""
61.IF "$(TARGETTYPE)" == "GUI"
62APP1OBJS+= $(STDOBJVCL)
63.ENDIF
64.ENDIF
65
66.IF "$(GUI)$(COM)" == "WNTGCC"
67APP1RESO=
68.IF "$(APP1LINKRES)" != "" || "$(APP1RES)" != ""
69APP1RESO=$(MISC)/$(APP1TARGET:b)_res.o
70.ENDIF
71.ENDIF
72
73.IF "$(GUI)" == "UNX"
74APP1DEPN+:=$(APP1DEPNU)
75USE_APP1DEF=
76.ENDIF
77
78.IF "$(APP1TARGETN)"!=""
79
80.IF "$(APP1PRODUCTNAME)"!=""
81APP1PRODUCTDEF+:=-DPRODUCT_NAME=\"$(APP1PRODUCTNAME)\"
82.ENDIF			# "$(APP1PRODUCTNAME)"!=""
83
84.IF "$(linkinc)"!=""
85.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
86.IF "$(APP1LIBS)"!=""
87$(MISC)/$(APP1TARGET)_linkinc.ls .PHONY:
88	@@-$(RM) $@
89	sed -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(APP1LIBS) $(i:s/.lib/.lin/)) >> $@
90.ENDIF          #"$(APP1LIBS)"!=""
91.ENDIF
92
93LINKINCTARGETS+=$(MISC)/$(APP1TARGETN:b)_linkinc.ls
94$(APP1TARGETN) : $(LINKINCTARGETS)
95.ENDIF          # "$(linkinc)"!=""
96
97# Allow for target specific LIBSALCPPRT override
98APP1LIBSALCPPRT*=$(LIBSALCPPRT)
99
100$(APP1TARGETN): $(APP1OBJS) $(APP1LIBS) \
101	$(APP1RES) \
102	$(APP1ICON) $(APP1DEPN) $(USE_APP1DEF)
103	@echo "Making:   " $(@:f)
104.IF "$(GUI)"=="UNX"
105.IF "$(OS)"=="MACOSX"
106	@echo unx
107	@-$(RM) $(MISC)/$(@:b).list
108	@-$(RM) $(MISC)/$(TARGET).$(@:b)_1.cmd
109	@-$(RM) $(MISC)/$(@:b).strip
110	@echo $(STDSLO) $(APP1OBJS:s/.obj/.o/) \
111	`cat /dev/null $(APP1LIBS) | sed s\#$(ROUT)\#$(OUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list
112	@echo -n $(APP1LINKER) $(APP1LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) -o $@ \
113	$(APP1LINKTYPEFLAG) $(APP1STDLIBS) $(APP1STDLIB) $(STDLIB1) -filelist $(MISC)/$(@:b).list > $(MISC)/$(TARGET).$(@:b)_1.cmd
114    @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \
115        `cat $(MISC)/$(TARGET).$(@:b)_1.cmd` \
116        >> $(MISC)/$(TARGET).$(@:b)_1.cmd
117  .IF "$(VERBOSE)" == "TRUE"
118	@cat $(MISC)/$(TARGET).$(@:b)_1.cmd
119  .ENDIF
120	@+source $(MISC)/$(TARGET).$(@:b)_1.cmd
121# Need to strip __objcInit symbol to avoid duplicate symbols when loading
122# libraries at runtime
123	@-$(CC_PATH)nm $@ | grep -v ' U ' | $(AWK) '{ print $$NF }' | grep -F -x '__objcInit' > $(MISC)/$(@:b).strip
124	@$(CC_PATH)strip -i -R $(MISC)/$(@:b).strip -X $@
125	@ls -l $@
126    @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \
127        app $(APP1RPATH) $@
128.IF "$(TARGETTYPE)"=="GUI"
129	@echo "Making:   " $(@:f).app
130	@macosx-create-bundle $@
131.ENDIF		# "$(TARGETTYPE)"=="GUI"
132.ELSE		# "$(OS)"=="MACOSX"
133	@echo unx
134	@-$(RM) $(MISC)/$(TARGET).$(@:b)_1.cmd
135	@echo $(APP1LINKER) $(APP1LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
136	$(APP1OBJS:s/.obj/.o/) '\' >  $(MISC)/$(TARGET).$(@:b)_1.cmd
137	@cat $(mktmp /dev/null $(APP1LIBS)) | xargs -n 1 cat | sed s\#$(ROUT)\#$(OUT)\#g | sed 's#$$# \\#'  >> $(MISC)/$(TARGET).$(@:b)_1.cmd
138	@echo $(APP1LINKTYPEFLAG) $(APP1LIBSALCPPRT) $(APP1STDLIBS) $(APP1STDLIB) $(STDLIB1) -o $@ >> $(MISC)/$(TARGET).$(@:b)_1.cmd
139  .IF "$(VERBOSE)" == "TRUE"
140	@cat $(MISC)/$(TARGET).$(@:b)_1.cmd
141  .ENDIF
142	@+source $(MISC)/$(TARGET).$(@:b)_1.cmd
143  .IF "$(VERBOSE)" == "TRUE"
144	@ls -l $@
145  .ENDIF
146.ENDIF		# "$(OS)"=="MACOSX"
147.ENDIF
148.IF "$(GUI)" == "WNT"
149	@@-$(MKDIR) $(@:d:d)
150.IF "$(APP1LINKRES)" != ""
151	@@-$(RM) $(MISC)/$(APP1LINKRES:b).rc
152.IF "$(APP1ICON)" != ""
153	@-echo 1 ICON $(EMQ)"$(APP1ICON:s/\/\\/)$(EMQ)" >> $(MISC)/$(APP1LINKRES:b).rc
154.ENDIF		# "$(APP1ICON)" != ""
155.IF "$(APP1VERINFO)" != ""
156	@-echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP1LINKRES:b).rc
157	@-echo $(EMQ)#include  $(EMQ)"$(APP1VERINFO)$(EMQ)" >> $(MISC)/$(APP1LINKRES:b).rc
158.ENDIF		# "$(APP1VERINFO)" != ""
159	$(COMMAND_ECHO)$(RC) -DWIN32 $(APP1PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP1LINKRES:b).rc
160.ENDIF			# "$(APP1LINKRES)" != ""
161.IF "$(COM)" == "GCC"
162	@echo mingw
163.IF "$(APP1LINKRES)" != "" || "$(APP1RES)" != ""
164	@cat $(APP1LINKRES) $(subst,/res/,/res{$(subst,$(BIN), $(@:d))} $(APP1RES)) >  $(MISC)/$(@:b)_all.res
165	windres $(MISC)/$(@:b)_all.res $(APP1RESO)
166.ENDIF
167	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSAPP) $(MINGWSSTDOBJ) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
168		$(APP1BASEX) $(APP1STACKN) -o $@ $(APP1OBJS) \
169		-Wl,-Map,$(MISC)/$(@:b).map $(STDOBJ) $(APP1RESO) \
170		`$(TYPE) /dev/null $(APP1LIBS) | sed s#$(ROUT)#$(OUT)#g` \
171		$(APP_LINKTYPE) $(APP1LIBSALCPPRT) \
172		-Wl,--start-group $(APP1STDLIBS) -Wl,--end-group $(APP1STDLIB) \
173		$(STDLIB1) $(MINGWSSTDENDOBJ) > $(MISC)/$(TARGET).$(@:b)_1.cmd
174  # need this empty line, else dmake somehow gets confused by the .IFs and .ENDIFs
175  .IF "$(VERBOSE)" == "TRUE"
176	@$(TYPE)  $(MISC)/$(TARGET).$(@:b)_1.cmd
177  .ENDIF
178	@+source $(MISC)/$(TARGET).$(@:b)_1.cmd
179	@ls -l $@
180.ELSE	# "$(COM)" == "GCC"
181.IF "$(linkinc)" == ""
182	$(COMMAND_ECHO)$(APP1LINKER) @$(mktmp \
183		$(APP1LINKFLAGS) \
184		$(LINKFLAGSAPP) $(APP1BASEX) \
185		$(APP1STACKN) \
186		-out:$@ \
187		-map:$(MISC)/{$(subst,/,_ $(APP1TARGET)).map} \
188		$(STDOBJ) \
189		$(APP1LINKRES) \
190		$(APP1RES) \
191		$(APP1OBJS) \
192		$(APP1LIBS) \
193		$(APP1STDLIBS) \
194		$(APP1STDLIB) $(STDLIB1) \
195		)
196	@-echo linking $@.manifest ...
197.IF "$(VISTA_MANIFEST)"!=""
198	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
199	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);1 $(FI)
200.ELSE
201	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);1 $(FI)
202.ENDIF # "$(VISTA_MANIFEST)"!=""
203	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
204	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
205.ELSE
206		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP1TARGET).lnk
207		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP1TARGET).lst
208		$(COMMAND_ECHO)-$(RM) $(MISC)\linkobj.lst
209		for %_i in ($(MISC)\*.obj) do type %_i >> $(MISC)\linkobj.lst
210	type $(mktmp,$(MISC)\$(APP1TARGET).lst
211		$(APP1LINKFLAGS) \
212		$(LINKFLAGSAPP) $(APP1BASEX) \
213		$(APP1STACKN) \
214		-out:$@ \
215		$(STDOBJ) \
216		$(APP1LINKRES) \
217		$(APP1RES) \
218		$(APP1OBJS) \
219		$(APP1LIBS) \
220		$(APP1STDLIBS) \
221		$(APP1STDLIB) $(STDLIB1))
222		$(COMMAND_ECHO)$(SED)$(SED) -e 's/\(\.\.\\\)\{2,4\}/..\\/g' $(MISC)\$(APP1TARGETN:b)_linkobj.lst >> $(MISC)\$(APP1TARGET).lst
223		$(COMMAND_ECHO)$(SED)$(IFEXIST) $(MISC)/$(APP1TARGET).lst $(THEN) type $(MISC)/$(APP1TARGET).lst  >> $(MISC)/$(APP1TARGET).lnk $(FI)
224		$(COMMAND_ECHO)$(SED)$(APP1LINKER) @$(MISC)\$(APP1TARGET).lnk
225.ENDIF		# "$(linkinc)" == ""
226.ENDIF		# "$(COM)" == "GCC"
227.IF "$(APP1TARGET)" == "loader"
228	$(COMMAND_ECHO)$(PERL) loader.pl $@
229	$(COMMAND_ECHO)$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
230	$(COMMAND_ECHO)$(RM) $@
231	$(COMMAND_ECHO)$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
232.ENDIF			# "$(TARGET)" == "setup"
233
234.ENDIF			# "$(GUI)" == "WNT"
235
236.IF "$(GUI)" == "OS2"
237	@+-$(MKDIR) $(@:d:d) > $(NULLDEV)
238.IF "$(APP1LINKRES)" != ""
239	@+-$(RM) $(MISC)/$(APP1LINKRES:b).rc > $(NULLDEV)
240.IF "$(APP1ICON)" != ""
241	@-+echo ICON 1 $(EMQ)"$(APP1ICON:s#/#\\\\#)$(EMQ)" >> $(MISC)$/$(APP1LINKRES:b).rc
242.ENDIF		# "$(APP1ICON)" != ""
243.IF "$(APP1VERINFO)" != ""
244	@-+echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP1LINKRES:b).rc
245	@-+echo $(EMQ)#include  $(EMQ)"$(APP1VERINFO)$(EMQ)" >> $(MISC)/$(APP1LINKRES:b).rc
246.ENDIF		# "$(APP1VERINFO)" != ""
247	$(COMMAND_ECHO)$(RC) -r -DOS2 $(APP1PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP1LINKRES:b).rc
248.ENDIF			# "$(APP1LINKRES)" != ""
249
250.IF "$(TARGETTYPE)" == "GUI"
251	@echo NAME $(APP1TARGET) WINDOWAPI > $(MISC)/$(APP1TARGET).def
252.ENDIF
253
254	$(COMMAND_ECHO)$(APP1LINKER) -v \
255		$(APP1LINKFLAGS) \
256		$(LINKFLAGSAPP) $(APP1BASEX) \
257		$(APP1STACKN) \
258		-o $@ \
259		-Zmap -L$(LB) \
260		-L$(SOLARVERSION)/$(INPATH)/lib \
261		$(STDOBJ) \
262		$(APP1LINKRES) \
263		$(APP1RES) \
264		$(APP1DEF) \
265		$(APP1OBJS) \
266		$(APP1LIBS) \
267		$(APP1STDLIBS) \
268		$(APP1STDLIB) $(STDLIB1)
269
270
271.IF "$(APP1TARGET)" == "loader"
272	$(COMMAND_ECHO)+$(PERL) loader.pl $@
273	$(COMMAND_ECHO)+$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
274	$(COMMAND_ECHO)+$(RM) $@
275	$(COMMAND_ECHO)+$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
276.ENDIF			# "$(TARGET)" == "setup"
277
278.ENDIF			# "$(GUI)" == "OS2"
279
280.ENDIF			# "$(APP1TARGETN)"!=""
281
282# New rule for automatic run targets of unit test targets
283.IF "$(APP1TEST)" == "enabled" &&  "$(APP1TARGET)" != ""
284
285$(APP1TARGET)_run: $(APP1TARGETN)
286	$(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP1TARGETN) --gtest_output="xml:$(BIN)/$(APP1TARGET)_result.xml"
287
288.ENDIF
289
290
291# Instruction for linking
292# unroll begin
293
294.IF "$(GUI)" == "OS2" && "$(TARGETTYPE)" == "GUI"
295APP2DEF = $(MISC)/$(APP2TARGET).def
296.ENDIF
297
298.IF "$(APP2LINKTYPE)" != ""
299#must be either STATIC or SHARED
300APP2LINKTYPEFLAG=$(APPLINK$(APP2LINKTYPE))
301.ENDIF
302
303# decide how to link
304.IF "$(APP2CODETYPE)"=="C"
305APP2LINKER=$(LINKC)
306APP2STDLIB=$(subst,CPPRUNTIME, $(STDLIB))
307APP2LINKFLAGS+=$(LINKCFLAGS)
308.ELSE			# "$(APP2CODETYPE)"=="C"
309APP2LINKER=$(LINK)
310APP2STDLIB=$(subst,CPPRUNTIME,$(STDLIBCPP) $(STDLIB))
311APP2LINKFLAGS+=$(LINKFLAGS)
312.ENDIF			# "$(APP2CODETYPE)"=="C"
313
314APP2RPATH*=OOO
315LINKFLAGSRUNPATH_$(APP2RPATH)*=/ERROR:/Bad_APP2RPATH_value
316.IF "$(OS)" != "MACOSX"
317APP2LINKFLAGS+=$(LINKFLAGSRUNPATH_$(APP2RPATH))
318.ENDIF
319
320.IF "$(APP2STACK)" != ""
321.IF "$(LINKFLAGSTACK)" != ""
322APP2STACKN=$(LINKFLAGSTACK)$(APP2STACK)
323.ENDIF
324.ELSE
325APP2STACKN=
326.ENDIF
327
328.IF "$(APP2NOSAL)"==""
329.IF "$(TARGETTYPE)" == "GUI"
330APP2OBJS+= $(STDOBJVCL)
331.ENDIF
332.ENDIF
333
334.IF "$(GUI)$(COM)" == "WNTGCC"
335APP2RESO=
336.IF "$(APP2LINKRES)" != "" || "$(APP2RES)" != ""
337APP2RESO=$(MISC)/$(APP2TARGET:b)_res.o
338.ENDIF
339.ENDIF
340
341.IF "$(GUI)" == "UNX"
342APP2DEPN+:=$(APP2DEPNU)
343USE_APP2DEF=
344.ENDIF
345
346.IF "$(APP2TARGETN)"!=""
347
348.IF "$(APP2PRODUCTNAME)"!=""
349APP2PRODUCTDEF+:=-DPRODUCT_NAME=\"$(APP2PRODUCTNAME)\"
350.ENDIF			# "$(APP2PRODUCTNAME)"!=""
351
352.IF "$(linkinc)"!=""
353.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
354.IF "$(APP2LIBS)"!=""
355$(MISC)/$(APP2TARGET)_linkinc.ls .PHONY:
356	@@-$(RM) $@
357	sed -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(APP2LIBS) $(i:s/.lib/.lin/)) >> $@
358.ENDIF          #"$(APP2LIBS)"!=""
359.ENDIF
360
361LINKINCTARGETS+=$(MISC)/$(APP2TARGETN:b)_linkinc.ls
362$(APP2TARGETN) : $(LINKINCTARGETS)
363.ENDIF          # "$(linkinc)"!=""
364
365# Allow for target specific LIBSALCPPRT override
366APP2LIBSALCPPRT*=$(LIBSALCPPRT)
367
368$(APP2TARGETN): $(APP2OBJS) $(APP2LIBS) \
369	$(APP2RES) \
370	$(APP2ICON) $(APP2DEPN) $(USE_APP2DEF)
371	@echo "Making:   " $(@:f)
372.IF "$(GUI)"=="UNX"
373.IF "$(OS)"=="MACOSX"
374	@echo unx
375	@-$(RM) $(MISC)/$(@:b).list
376	@-$(RM) $(MISC)/$(TARGET).$(@:b)_2.cmd
377	@-$(RM) $(MISC)/$(@:b).strip
378	@echo $(STDSLO) $(APP2OBJS:s/.obj/.o/) \
379	`cat /dev/null $(APP2LIBS) | sed s\#$(ROUT)\#$(OUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list
380	@echo -n $(APP2LINKER) $(APP2LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) -o $@ \
381	$(APP2LINKTYPEFLAG) $(APP2STDLIBS) $(APP2STDLIB) $(STDLIB2) -filelist $(MISC)/$(@:b).list > $(MISC)/$(TARGET).$(@:b)_2.cmd
382    @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \
383        `cat $(MISC)/$(TARGET).$(@:b)_2.cmd` \
384        >> $(MISC)/$(TARGET).$(@:b)_2.cmd
385  .IF "$(VERBOSE)" == "TRUE"
386	@cat $(MISC)/$(TARGET).$(@:b)_2.cmd
387  .ENDIF
388	@+source $(MISC)/$(TARGET).$(@:b)_2.cmd
389# Need to strip __objcInit symbol to avoid duplicate symbols when loading
390# libraries at runtime
391	@-$(CC_PATH)nm $@ | grep -v ' U ' | $(AWK) '{ print $$NF }' | grep -F -x '__objcInit' > $(MISC)/$(@:b).strip
392	@$(CC_PATH)strip -i -R $(MISC)/$(@:b).strip -X $@
393	@ls -l $@
394    @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \
395        app $(APP2RPATH) $@
396.IF "$(TARGETTYPE)"=="GUI"
397	@echo "Making:   " $(@:f).app
398	@macosx-create-bundle $@
399.ENDIF		# "$(TARGETTYPE)"=="GUI"
400.ELSE		# "$(OS)"=="MACOSX"
401	@echo unx
402	@-$(RM) $(MISC)/$(TARGET).$(@:b)_2.cmd
403	@echo $(APP2LINKER) $(APP2LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
404	$(APP2OBJS:s/.obj/.o/) '\' >  $(MISC)/$(TARGET).$(@:b)_2.cmd
405	@cat $(mktmp /dev/null $(APP2LIBS)) | xargs -n 1 cat | sed s\#$(ROUT)\#$(OUT)\#g | sed 's#$$# \\#'  >> $(MISC)/$(TARGET).$(@:b)_2.cmd
406	@echo $(APP2LINKTYPEFLAG) $(APP2LIBSALCPPRT) $(APP2STDLIBS) $(APP2STDLIB) $(STDLIB2) -o $@ >> $(MISC)/$(TARGET).$(@:b)_2.cmd
407  .IF "$(VERBOSE)" == "TRUE"
408	@cat $(MISC)/$(TARGET).$(@:b)_2.cmd
409  .ENDIF
410	@+source $(MISC)/$(TARGET).$(@:b)_2.cmd
411  .IF "$(VERBOSE)" == "TRUE"
412	@ls -l $@
413  .ENDIF
414.ENDIF		# "$(OS)"=="MACOSX"
415.ENDIF
416.IF "$(GUI)" == "WNT"
417	@@-$(MKDIR) $(@:d:d)
418.IF "$(APP2LINKRES)" != ""
419	@@-$(RM) $(MISC)/$(APP2LINKRES:b).rc
420.IF "$(APP2ICON)" != ""
421	@-echo 1 ICON $(EMQ)"$(APP2ICON:s/\/\\/)$(EMQ)" >> $(MISC)/$(APP2LINKRES:b).rc
422.ENDIF		# "$(APP2ICON)" != ""
423.IF "$(APP2VERINFO)" != ""
424	@-echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP2LINKRES:b).rc
425	@-echo $(EMQ)#include  $(EMQ)"$(APP2VERINFO)$(EMQ)" >> $(MISC)/$(APP2LINKRES:b).rc
426.ENDIF		# "$(APP2VERINFO)" != ""
427	$(COMMAND_ECHO)$(RC) -DWIN32 $(APP2PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP2LINKRES:b).rc
428.ENDIF			# "$(APP2LINKRES)" != ""
429.IF "$(COM)" == "GCC"
430	@echo mingw
431.IF "$(APP2LINKRES)" != "" || "$(APP2RES)" != ""
432	@cat $(APP2LINKRES) $(subst,/res/,/res{$(subst,$(BIN), $(@:d))} $(APP2RES)) >  $(MISC)/$(@:b)_all.res
433	windres $(MISC)/$(@:b)_all.res $(APP2RESO)
434.ENDIF
435	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSAPP) $(MINGWSSTDOBJ) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
436		$(APP2BASEX) $(APP2STACKN) -o $@ $(APP2OBJS) \
437		-Wl,-Map,$(MISC)/$(@:b).map $(STDOBJ) $(APP2RESO) \
438		`$(TYPE) /dev/null $(APP2LIBS) | sed s#$(ROUT)#$(OUT)#g` \
439		$(APP_LINKTYPE) $(APP2LIBSALCPPRT) \
440		-Wl,--start-group $(APP2STDLIBS) -Wl,--end-group $(APP2STDLIB) \
441		$(STDLIB2) $(MINGWSSTDENDOBJ) > $(MISC)/$(TARGET).$(@:b)_2.cmd
442  # need this empty line, else dmake somehow gets confused by the .IFs and .ENDIFs
443  .IF "$(VERBOSE)" == "TRUE"
444	@$(TYPE)  $(MISC)/$(TARGET).$(@:b)_2.cmd
445  .ENDIF
446	@+source $(MISC)/$(TARGET).$(@:b)_2.cmd
447	@ls -l $@
448.ELSE	# "$(COM)" == "GCC"
449.IF "$(linkinc)" == ""
450	$(COMMAND_ECHO)$(APP2LINKER) @$(mktmp \
451		$(APP2LINKFLAGS) \
452		$(LINKFLAGSAPP) $(APP2BASEX) \
453		$(APP2STACKN) \
454		-out:$@ \
455		-map:$(MISC)/{$(subst,/,_ $(APP2TARGET)).map} \
456		$(STDOBJ) \
457		$(APP2LINKRES) \
458		$(APP2RES) \
459		$(APP2OBJS) \
460		$(APP2LIBS) \
461		$(APP2STDLIBS) \
462		$(APP2STDLIB) $(STDLIB2) \
463		)
464	@-echo linking $@.manifest ...
465.IF "$(VISTA_MANIFEST)"!=""
466	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
467	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);1 $(FI)
468.ELSE
469	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);1 $(FI)
470.ENDIF # "$(VISTA_MANIFEST)"!=""
471	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
472	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
473.ELSE
474		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP2TARGET).lnk
475		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP2TARGET).lst
476		$(COMMAND_ECHO)-$(RM) $(MISC)\linkobj.lst
477		for %_i in ($(MISC)\*.obj) do type %_i >> $(MISC)\linkobj.lst
478	type $(mktmp,$(MISC)\$(APP2TARGET).lst
479		$(APP2LINKFLAGS) \
480		$(LINKFLAGSAPP) $(APP2BASEX) \
481		$(APP2STACKN) \
482		-out:$@ \
483		$(STDOBJ) \
484		$(APP2LINKRES) \
485		$(APP2RES) \
486		$(APP2OBJS) \
487		$(APP2LIBS) \
488		$(APP2STDLIBS) \
489		$(APP2STDLIB) $(STDLIB2))
490		$(COMMAND_ECHO)$(SED)$(SED) -e 's/\(\.\.\\\)\{2,4\}/..\\/g' $(MISC)\$(APP2TARGETN:b)_linkobj.lst >> $(MISC)\$(APP2TARGET).lst
491		$(COMMAND_ECHO)$(SED)$(IFEXIST) $(MISC)/$(APP2TARGET).lst $(THEN) type $(MISC)/$(APP2TARGET).lst  >> $(MISC)/$(APP2TARGET).lnk $(FI)
492		$(COMMAND_ECHO)$(SED)$(APP2LINKER) @$(MISC)\$(APP2TARGET).lnk
493.ENDIF		# "$(linkinc)" == ""
494.ENDIF		# "$(COM)" == "GCC"
495.IF "$(APP2TARGET)" == "loader"
496	$(COMMAND_ECHO)$(PERL) loader.pl $@
497	$(COMMAND_ECHO)$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
498	$(COMMAND_ECHO)$(RM) $@
499	$(COMMAND_ECHO)$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
500.ENDIF			# "$(TARGET)" == "setup"
501
502.ENDIF			# "$(GUI)" == "WNT"
503
504.IF "$(GUI)" == "OS2"
505	@+-$(MKDIR) $(@:d:d) > $(NULLDEV)
506.IF "$(APP2LINKRES)" != ""
507	@+-$(RM) $(MISC)/$(APP2LINKRES:b).rc > $(NULLDEV)
508.IF "$(APP2ICON)" != ""
509	@-+echo ICON 1 $(EMQ)"$(APP2ICON:s#/#\\\\#)$(EMQ)" >> $(MISC)$/$(APP2LINKRES:b).rc
510.ENDIF		# "$(APP2ICON)" != ""
511.IF "$(APP2VERINFO)" != ""
512	@-+echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP2LINKRES:b).rc
513	@-+echo $(EMQ)#include  $(EMQ)"$(APP2VERINFO)$(EMQ)" >> $(MISC)/$(APP2LINKRES:b).rc
514.ENDIF		# "$(APP2VERINFO)" != ""
515	$(COMMAND_ECHO)$(RC) -r -DOS2 $(APP2PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP2LINKRES:b).rc
516.ENDIF			# "$(APP2LINKRES)" != ""
517
518.IF "$(TARGETTYPE)" == "GUI"
519	@echo NAME $(APP2TARGET) WINDOWAPI > $(MISC)/$(APP2TARGET).def
520.ENDIF
521
522	$(COMMAND_ECHO)$(APP2LINKER) -v \
523		$(APP2LINKFLAGS) \
524		$(LINKFLAGSAPP) $(APP2BASEX) \
525		$(APP2STACKN) \
526		-o $@ \
527		-Zmap -L$(LB) \
528		-L$(SOLARVERSION)/$(INPATH)/lib \
529		$(STDOBJ) \
530		$(APP2LINKRES) \
531		$(APP2RES) \
532		$(APP2DEF) \
533		$(APP2OBJS) \
534		$(APP2LIBS) \
535		$(APP2STDLIBS) \
536		$(APP2STDLIB) $(STDLIB2)
537
538
539.IF "$(APP2TARGET)" == "loader"
540	$(COMMAND_ECHO)+$(PERL) loader.pl $@
541	$(COMMAND_ECHO)+$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
542	$(COMMAND_ECHO)+$(RM) $@
543	$(COMMAND_ECHO)+$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
544.ENDIF			# "$(TARGET)" == "setup"
545
546.ENDIF			# "$(GUI)" == "OS2"
547
548.ENDIF			# "$(APP2TARGETN)"!=""
549
550# New rule for automatic run targets of unit test targets
551.IF "$(APP2TEST)" == "enabled" &&  "$(APP2TARGET)" != ""
552
553$(APP2TARGET)_run: $(APP2TARGETN)
554	$(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP2TARGETN) --gtest_output="xml:$(BIN)/$(APP2TARGET)_result.xml"
555
556.ENDIF
557
558
559# Instruction for linking
560# unroll begin
561
562.IF "$(GUI)" == "OS2" && "$(TARGETTYPE)" == "GUI"
563APP3DEF = $(MISC)/$(APP3TARGET).def
564.ENDIF
565
566.IF "$(APP3LINKTYPE)" != ""
567#must be either STATIC or SHARED
568APP3LINKTYPEFLAG=$(APPLINK$(APP3LINKTYPE))
569.ENDIF
570
571# decide how to link
572.IF "$(APP3CODETYPE)"=="C"
573APP3LINKER=$(LINKC)
574APP3STDLIB=$(subst,CPPRUNTIME, $(STDLIB))
575APP3LINKFLAGS+=$(LINKCFLAGS)
576.ELSE			# "$(APP3CODETYPE)"=="C"
577APP3LINKER=$(LINK)
578APP3STDLIB=$(subst,CPPRUNTIME,$(STDLIBCPP) $(STDLIB))
579APP3LINKFLAGS+=$(LINKFLAGS)
580.ENDIF			# "$(APP3CODETYPE)"=="C"
581
582APP3RPATH*=OOO
583LINKFLAGSRUNPATH_$(APP3RPATH)*=/ERROR:/Bad_APP3RPATH_value
584.IF "$(OS)" != "MACOSX"
585APP3LINKFLAGS+=$(LINKFLAGSRUNPATH_$(APP3RPATH))
586.ENDIF
587
588.IF "$(APP3STACK)" != ""
589.IF "$(LINKFLAGSTACK)" != ""
590APP3STACKN=$(LINKFLAGSTACK)$(APP3STACK)
591.ENDIF
592.ELSE
593APP3STACKN=
594.ENDIF
595
596.IF "$(APP3NOSAL)"==""
597.IF "$(TARGETTYPE)" == "GUI"
598APP3OBJS+= $(STDOBJVCL)
599.ENDIF
600.ENDIF
601
602.IF "$(GUI)$(COM)" == "WNTGCC"
603APP3RESO=
604.IF "$(APP3LINKRES)" != "" || "$(APP3RES)" != ""
605APP3RESO=$(MISC)/$(APP3TARGET:b)_res.o
606.ENDIF
607.ENDIF
608
609.IF "$(GUI)" == "UNX"
610APP3DEPN+:=$(APP3DEPNU)
611USE_APP3DEF=
612.ENDIF
613
614.IF "$(APP3TARGETN)"!=""
615
616.IF "$(APP3PRODUCTNAME)"!=""
617APP3PRODUCTDEF+:=-DPRODUCT_NAME=\"$(APP3PRODUCTNAME)\"
618.ENDIF			# "$(APP3PRODUCTNAME)"!=""
619
620.IF "$(linkinc)"!=""
621.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
622.IF "$(APP3LIBS)"!=""
623$(MISC)/$(APP3TARGET)_linkinc.ls .PHONY:
624	@@-$(RM) $@
625	sed -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(APP3LIBS) $(i:s/.lib/.lin/)) >> $@
626.ENDIF          #"$(APP3LIBS)"!=""
627.ENDIF
628
629LINKINCTARGETS+=$(MISC)/$(APP3TARGETN:b)_linkinc.ls
630$(APP3TARGETN) : $(LINKINCTARGETS)
631.ENDIF          # "$(linkinc)"!=""
632
633# Allow for target specific LIBSALCPPRT override
634APP3LIBSALCPPRT*=$(LIBSALCPPRT)
635
636$(APP3TARGETN): $(APP3OBJS) $(APP3LIBS) \
637	$(APP3RES) \
638	$(APP3ICON) $(APP3DEPN) $(USE_APP3DEF)
639	@echo "Making:   " $(@:f)
640.IF "$(GUI)"=="UNX"
641.IF "$(OS)"=="MACOSX"
642	@echo unx
643	@-$(RM) $(MISC)/$(@:b).list
644	@-$(RM) $(MISC)/$(TARGET).$(@:b)_3.cmd
645	@-$(RM) $(MISC)/$(@:b).strip
646	@echo $(STDSLO) $(APP3OBJS:s/.obj/.o/) \
647	`cat /dev/null $(APP3LIBS) | sed s\#$(ROUT)\#$(OUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list
648	@echo -n $(APP3LINKER) $(APP3LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) -o $@ \
649	$(APP3LINKTYPEFLAG) $(APP3STDLIBS) $(APP3STDLIB) $(STDLIB3) -filelist $(MISC)/$(@:b).list > $(MISC)/$(TARGET).$(@:b)_3.cmd
650    @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \
651        `cat $(MISC)/$(TARGET).$(@:b)_3.cmd` \
652        >> $(MISC)/$(TARGET).$(@:b)_3.cmd
653  .IF "$(VERBOSE)" == "TRUE"
654	@cat $(MISC)/$(TARGET).$(@:b)_3.cmd
655  .ENDIF
656	@+source $(MISC)/$(TARGET).$(@:b)_3.cmd
657# Need to strip __objcInit symbol to avoid duplicate symbols when loading
658# libraries at runtime
659	@-$(CC_PATH)nm $@ | grep -v ' U ' | $(AWK) '{ print $$NF }' | grep -F -x '__objcInit' > $(MISC)/$(@:b).strip
660	@$(CC_PATH)strip -i -R $(MISC)/$(@:b).strip -X $@
661	@ls -l $@
662    @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \
663        app $(APP3RPATH) $@
664.IF "$(TARGETTYPE)"=="GUI"
665	@echo "Making:   " $(@:f).app
666	@macosx-create-bundle $@
667.ENDIF		# "$(TARGETTYPE)"=="GUI"
668.ELSE		# "$(OS)"=="MACOSX"
669	@echo unx
670	@-$(RM) $(MISC)/$(TARGET).$(@:b)_3.cmd
671	@echo $(APP3LINKER) $(APP3LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
672	$(APP3OBJS:s/.obj/.o/) '\' >  $(MISC)/$(TARGET).$(@:b)_3.cmd
673	@cat $(mktmp /dev/null $(APP3LIBS)) | xargs -n 1 cat | sed s\#$(ROUT)\#$(OUT)\#g | sed 's#$$# \\#'  >> $(MISC)/$(TARGET).$(@:b)_3.cmd
674	@echo $(APP3LINKTYPEFLAG) $(APP3LIBSALCPPRT) $(APP3STDLIBS) $(APP3STDLIB) $(STDLIB3) -o $@ >> $(MISC)/$(TARGET).$(@:b)_3.cmd
675  .IF "$(VERBOSE)" == "TRUE"
676	@cat $(MISC)/$(TARGET).$(@:b)_3.cmd
677  .ENDIF
678	@+source $(MISC)/$(TARGET).$(@:b)_3.cmd
679  .IF "$(VERBOSE)" == "TRUE"
680	@ls -l $@
681  .ENDIF
682.ENDIF		# "$(OS)"=="MACOSX"
683.ENDIF
684.IF "$(GUI)" == "WNT"
685	@@-$(MKDIR) $(@:d:d)
686.IF "$(APP3LINKRES)" != ""
687	@@-$(RM) $(MISC)/$(APP3LINKRES:b).rc
688.IF "$(APP3ICON)" != ""
689	@-echo 1 ICON $(EMQ)"$(APP3ICON:s/\/\\/)$(EMQ)" >> $(MISC)/$(APP3LINKRES:b).rc
690.ENDIF		# "$(APP3ICON)" != ""
691.IF "$(APP3VERINFO)" != ""
692	@-echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP3LINKRES:b).rc
693	@-echo $(EMQ)#include  $(EMQ)"$(APP3VERINFO)$(EMQ)" >> $(MISC)/$(APP3LINKRES:b).rc
694.ENDIF		# "$(APP3VERINFO)" != ""
695	$(COMMAND_ECHO)$(RC) -DWIN32 $(APP3PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP3LINKRES:b).rc
696.ENDIF			# "$(APP3LINKRES)" != ""
697.IF "$(COM)" == "GCC"
698	@echo mingw
699.IF "$(APP3LINKRES)" != "" || "$(APP3RES)" != ""
700	@cat $(APP3LINKRES) $(subst,/res/,/res{$(subst,$(BIN), $(@:d))} $(APP3RES)) >  $(MISC)/$(@:b)_all.res
701	windres $(MISC)/$(@:b)_all.res $(APP3RESO)
702.ENDIF
703	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSAPP) $(MINGWSSTDOBJ) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
704		$(APP3BASEX) $(APP3STACKN) -o $@ $(APP3OBJS) \
705		-Wl,-Map,$(MISC)/$(@:b).map $(STDOBJ) $(APP3RESO) \
706		`$(TYPE) /dev/null $(APP3LIBS) | sed s#$(ROUT)#$(OUT)#g` \
707		$(APP_LINKTYPE) $(APP3LIBSALCPPRT) \
708		-Wl,--start-group $(APP3STDLIBS) -Wl,--end-group $(APP3STDLIB) \
709		$(STDLIB3) $(MINGWSSTDENDOBJ) > $(MISC)/$(TARGET).$(@:b)_3.cmd
710  # need this empty line, else dmake somehow gets confused by the .IFs and .ENDIFs
711  .IF "$(VERBOSE)" == "TRUE"
712	@$(TYPE)  $(MISC)/$(TARGET).$(@:b)_3.cmd
713  .ENDIF
714	@+source $(MISC)/$(TARGET).$(@:b)_3.cmd
715	@ls -l $@
716.ELSE	# "$(COM)" == "GCC"
717.IF "$(linkinc)" == ""
718	$(COMMAND_ECHO)$(APP3LINKER) @$(mktmp \
719		$(APP3LINKFLAGS) \
720		$(LINKFLAGSAPP) $(APP3BASEX) \
721		$(APP3STACKN) \
722		-out:$@ \
723		-map:$(MISC)/{$(subst,/,_ $(APP3TARGET)).map} \
724		$(STDOBJ) \
725		$(APP3LINKRES) \
726		$(APP3RES) \
727		$(APP3OBJS) \
728		$(APP3LIBS) \
729		$(APP3STDLIBS) \
730		$(APP3STDLIB) $(STDLIB3) \
731		)
732	@-echo linking $@.manifest ...
733.IF "$(VISTA_MANIFEST)"!=""
734	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
735	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);1 $(FI)
736.ELSE
737	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);1 $(FI)
738.ENDIF # "$(VISTA_MANIFEST)"!=""
739	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
740	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
741.ELSE
742		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP3TARGET).lnk
743		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP3TARGET).lst
744		$(COMMAND_ECHO)-$(RM) $(MISC)\linkobj.lst
745		for %_i in ($(MISC)\*.obj) do type %_i >> $(MISC)\linkobj.lst
746	type $(mktmp,$(MISC)\$(APP3TARGET).lst
747		$(APP3LINKFLAGS) \
748		$(LINKFLAGSAPP) $(APP3BASEX) \
749		$(APP3STACKN) \
750		-out:$@ \
751		$(STDOBJ) \
752		$(APP3LINKRES) \
753		$(APP3RES) \
754		$(APP3OBJS) \
755		$(APP3LIBS) \
756		$(APP3STDLIBS) \
757		$(APP3STDLIB) $(STDLIB3))
758		$(COMMAND_ECHO)$(SED)$(SED) -e 's/\(\.\.\\\)\{2,4\}/..\\/g' $(MISC)\$(APP3TARGETN:b)_linkobj.lst >> $(MISC)\$(APP3TARGET).lst
759		$(COMMAND_ECHO)$(SED)$(IFEXIST) $(MISC)/$(APP3TARGET).lst $(THEN) type $(MISC)/$(APP3TARGET).lst  >> $(MISC)/$(APP3TARGET).lnk $(FI)
760		$(COMMAND_ECHO)$(SED)$(APP3LINKER) @$(MISC)\$(APP3TARGET).lnk
761.ENDIF		# "$(linkinc)" == ""
762.ENDIF		# "$(COM)" == "GCC"
763.IF "$(APP3TARGET)" == "loader"
764	$(COMMAND_ECHO)$(PERL) loader.pl $@
765	$(COMMAND_ECHO)$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
766	$(COMMAND_ECHO)$(RM) $@
767	$(COMMAND_ECHO)$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
768.ENDIF			# "$(TARGET)" == "setup"
769
770.ENDIF			# "$(GUI)" == "WNT"
771
772.IF "$(GUI)" == "OS2"
773	@+-$(MKDIR) $(@:d:d) > $(NULLDEV)
774.IF "$(APP3LINKRES)" != ""
775	@+-$(RM) $(MISC)/$(APP3LINKRES:b).rc > $(NULLDEV)
776.IF "$(APP3ICON)" != ""
777	@-+echo ICON 1 $(EMQ)"$(APP3ICON:s#/#\\\\#)$(EMQ)" >> $(MISC)$/$(APP3LINKRES:b).rc
778.ENDIF		# "$(APP3ICON)" != ""
779.IF "$(APP3VERINFO)" != ""
780	@-+echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP3LINKRES:b).rc
781	@-+echo $(EMQ)#include  $(EMQ)"$(APP3VERINFO)$(EMQ)" >> $(MISC)/$(APP3LINKRES:b).rc
782.ENDIF		# "$(APP3VERINFO)" != ""
783	$(COMMAND_ECHO)$(RC) -r -DOS2 $(APP3PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP3LINKRES:b).rc
784.ENDIF			# "$(APP3LINKRES)" != ""
785
786.IF "$(TARGETTYPE)" == "GUI"
787	@echo NAME $(APP3TARGET) WINDOWAPI > $(MISC)/$(APP3TARGET).def
788.ENDIF
789
790	$(COMMAND_ECHO)$(APP3LINKER) -v \
791		$(APP3LINKFLAGS) \
792		$(LINKFLAGSAPP) $(APP3BASEX) \
793		$(APP3STACKN) \
794		-o $@ \
795		-Zmap -L$(LB) \
796		-L$(SOLARVERSION)/$(INPATH)/lib \
797		$(STDOBJ) \
798		$(APP3LINKRES) \
799		$(APP3RES) \
800		$(APP3DEF) \
801		$(APP3OBJS) \
802		$(APP3LIBS) \
803		$(APP3STDLIBS) \
804		$(APP3STDLIB) $(STDLIB3)
805
806
807.IF "$(APP3TARGET)" == "loader"
808	$(COMMAND_ECHO)+$(PERL) loader.pl $@
809	$(COMMAND_ECHO)+$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
810	$(COMMAND_ECHO)+$(RM) $@
811	$(COMMAND_ECHO)+$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
812.ENDIF			# "$(TARGET)" == "setup"
813
814.ENDIF			# "$(GUI)" == "OS2"
815
816.ENDIF			# "$(APP3TARGETN)"!=""
817
818# New rule for automatic run targets of unit test targets
819.IF "$(APP3TEST)" == "enabled" &&  "$(APP3TARGET)" != ""
820
821$(APP3TARGET)_run: $(APP3TARGETN)
822	$(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP3TARGETN) --gtest_output="xml:$(BIN)/$(APP3TARGET)_result.xml"
823
824.ENDIF
825
826
827# Instruction for linking
828# unroll begin
829
830.IF "$(GUI)" == "OS2" && "$(TARGETTYPE)" == "GUI"
831APP4DEF = $(MISC)/$(APP4TARGET).def
832.ENDIF
833
834.IF "$(APP4LINKTYPE)" != ""
835#must be either STATIC or SHARED
836APP4LINKTYPEFLAG=$(APPLINK$(APP4LINKTYPE))
837.ENDIF
838
839# decide how to link
840.IF "$(APP4CODETYPE)"=="C"
841APP4LINKER=$(LINKC)
842APP4STDLIB=$(subst,CPPRUNTIME, $(STDLIB))
843APP4LINKFLAGS+=$(LINKCFLAGS)
844.ELSE			# "$(APP4CODETYPE)"=="C"
845APP4LINKER=$(LINK)
846APP4STDLIB=$(subst,CPPRUNTIME,$(STDLIBCPP) $(STDLIB))
847APP4LINKFLAGS+=$(LINKFLAGS)
848.ENDIF			# "$(APP4CODETYPE)"=="C"
849
850APP4RPATH*=OOO
851LINKFLAGSRUNPATH_$(APP4RPATH)*=/ERROR:/Bad_APP4RPATH_value
852.IF "$(OS)" != "MACOSX"
853APP4LINKFLAGS+=$(LINKFLAGSRUNPATH_$(APP4RPATH))
854.ENDIF
855
856.IF "$(APP4STACK)" != ""
857.IF "$(LINKFLAGSTACK)" != ""
858APP4STACKN=$(LINKFLAGSTACK)$(APP4STACK)
859.ENDIF
860.ELSE
861APP4STACKN=
862.ENDIF
863
864.IF "$(APP4NOSAL)"==""
865.IF "$(TARGETTYPE)" == "GUI"
866APP4OBJS+= $(STDOBJVCL)
867.ENDIF
868.ENDIF
869
870.IF "$(GUI)$(COM)" == "WNTGCC"
871APP4RESO=
872.IF "$(APP4LINKRES)" != "" || "$(APP4RES)" != ""
873APP4RESO=$(MISC)/$(APP4TARGET:b)_res.o
874.ENDIF
875.ENDIF
876
877.IF "$(GUI)" == "UNX"
878APP4DEPN+:=$(APP4DEPNU)
879USE_APP4DEF=
880.ENDIF
881
882.IF "$(APP4TARGETN)"!=""
883
884.IF "$(APP4PRODUCTNAME)"!=""
885APP4PRODUCTDEF+:=-DPRODUCT_NAME=\"$(APP4PRODUCTNAME)\"
886.ENDIF			# "$(APP4PRODUCTNAME)"!=""
887
888.IF "$(linkinc)"!=""
889.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
890.IF "$(APP4LIBS)"!=""
891$(MISC)/$(APP4TARGET)_linkinc.ls .PHONY:
892	@@-$(RM) $@
893	sed -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(APP4LIBS) $(i:s/.lib/.lin/)) >> $@
894.ENDIF          #"$(APP4LIBS)"!=""
895.ENDIF
896
897LINKINCTARGETS+=$(MISC)/$(APP4TARGETN:b)_linkinc.ls
898$(APP4TARGETN) : $(LINKINCTARGETS)
899.ENDIF          # "$(linkinc)"!=""
900
901# Allow for target specific LIBSALCPPRT override
902APP4LIBSALCPPRT*=$(LIBSALCPPRT)
903
904$(APP4TARGETN): $(APP4OBJS) $(APP4LIBS) \
905	$(APP4RES) \
906	$(APP4ICON) $(APP4DEPN) $(USE_APP4DEF)
907	@echo "Making:   " $(@:f)
908.IF "$(GUI)"=="UNX"
909.IF "$(OS)"=="MACOSX"
910	@echo unx
911	@-$(RM) $(MISC)/$(@:b).list
912	@-$(RM) $(MISC)/$(TARGET).$(@:b)_4.cmd
913	@-$(RM) $(MISC)/$(@:b).strip
914	@echo $(STDSLO) $(APP4OBJS:s/.obj/.o/) \
915	`cat /dev/null $(APP4LIBS) | sed s\#$(ROUT)\#$(OUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list
916	@echo -n $(APP4LINKER) $(APP4LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) -o $@ \
917	$(APP4LINKTYPEFLAG) $(APP4STDLIBS) $(APP4STDLIB) $(STDLIB4) -filelist $(MISC)/$(@:b).list > $(MISC)/$(TARGET).$(@:b)_4.cmd
918    @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \
919        `cat $(MISC)/$(TARGET).$(@:b)_4.cmd` \
920        >> $(MISC)/$(TARGET).$(@:b)_4.cmd
921  .IF "$(VERBOSE)" == "TRUE"
922	@cat $(MISC)/$(TARGET).$(@:b)_4.cmd
923  .ENDIF
924	@+source $(MISC)/$(TARGET).$(@:b)_4.cmd
925# Need to strip __objcInit symbol to avoid duplicate symbols when loading
926# libraries at runtime
927	@-$(CC_PATH)nm $@ | grep -v ' U ' | $(AWK) '{ print $$NF }' | grep -F -x '__objcInit' > $(MISC)/$(@:b).strip
928	@$(CC_PATH)strip -i -R $(MISC)/$(@:b).strip -X $@
929	@ls -l $@
930    @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \
931        app $(APP4RPATH) $@
932.IF "$(TARGETTYPE)"=="GUI"
933	@echo "Making:   " $(@:f).app
934	@macosx-create-bundle $@
935.ENDIF		# "$(TARGETTYPE)"=="GUI"
936.ELSE		# "$(OS)"=="MACOSX"
937	@echo unx
938	@-$(RM) $(MISC)/$(TARGET).$(@:b)_4.cmd
939	@echo $(APP4LINKER) $(APP4LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
940	$(APP4OBJS:s/.obj/.o/) '\' >  $(MISC)/$(TARGET).$(@:b)_4.cmd
941	@cat $(mktmp /dev/null $(APP4LIBS)) | xargs -n 1 cat | sed s\#$(ROUT)\#$(OUT)\#g | sed 's#$$# \\#'  >> $(MISC)/$(TARGET).$(@:b)_4.cmd
942	@echo $(APP4LINKTYPEFLAG) $(APP4LIBSALCPPRT) $(APP4STDLIBS) $(APP4STDLIB) $(STDLIB4) -o $@ >> $(MISC)/$(TARGET).$(@:b)_4.cmd
943  .IF "$(VERBOSE)" == "TRUE"
944	@cat $(MISC)/$(TARGET).$(@:b)_4.cmd
945  .ENDIF
946	@+source $(MISC)/$(TARGET).$(@:b)_4.cmd
947  .IF "$(VERBOSE)" == "TRUE"
948	@ls -l $@
949  .ENDIF
950.ENDIF		# "$(OS)"=="MACOSX"
951.ENDIF
952.IF "$(GUI)" == "WNT"
953	@@-$(MKDIR) $(@:d:d)
954.IF "$(APP4LINKRES)" != ""
955	@@-$(RM) $(MISC)/$(APP4LINKRES:b).rc
956.IF "$(APP4ICON)" != ""
957	@-echo 1 ICON $(EMQ)"$(APP4ICON:s/\/\\/)$(EMQ)" >> $(MISC)/$(APP4LINKRES:b).rc
958.ENDIF		# "$(APP4ICON)" != ""
959.IF "$(APP4VERINFO)" != ""
960	@-echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP4LINKRES:b).rc
961	@-echo $(EMQ)#include  $(EMQ)"$(APP4VERINFO)$(EMQ)" >> $(MISC)/$(APP4LINKRES:b).rc
962.ENDIF		# "$(APP4VERINFO)" != ""
963	$(COMMAND_ECHO)$(RC) -DWIN32 $(APP4PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP4LINKRES:b).rc
964.ENDIF			# "$(APP4LINKRES)" != ""
965.IF "$(COM)" == "GCC"
966	@echo mingw
967.IF "$(APP4LINKRES)" != "" || "$(APP4RES)" != ""
968	@cat $(APP4LINKRES) $(subst,/res/,/res{$(subst,$(BIN), $(@:d))} $(APP4RES)) >  $(MISC)/$(@:b)_all.res
969	windres $(MISC)/$(@:b)_all.res $(APP4RESO)
970.ENDIF
971	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSAPP) $(MINGWSSTDOBJ) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
972		$(APP4BASEX) $(APP4STACKN) -o $@ $(APP4OBJS) \
973		-Wl,-Map,$(MISC)/$(@:b).map $(STDOBJ) $(APP4RESO) \
974		`$(TYPE) /dev/null $(APP4LIBS) | sed s#$(ROUT)#$(OUT)#g` \
975		$(APP_LINKTYPE) $(APP4LIBSALCPPRT) \
976		-Wl,--start-group $(APP4STDLIBS) -Wl,--end-group $(APP4STDLIB) \
977		$(STDLIB4) $(MINGWSSTDENDOBJ) > $(MISC)/$(TARGET).$(@:b)_4.cmd
978  # need this empty line, else dmake somehow gets confused by the .IFs and .ENDIFs
979  .IF "$(VERBOSE)" == "TRUE"
980	@$(TYPE)  $(MISC)/$(TARGET).$(@:b)_4.cmd
981  .ENDIF
982	@+source $(MISC)/$(TARGET).$(@:b)_4.cmd
983	@ls -l $@
984.ELSE	# "$(COM)" == "GCC"
985.IF "$(linkinc)" == ""
986	$(COMMAND_ECHO)$(APP4LINKER) @$(mktmp \
987		$(APP4LINKFLAGS) \
988		$(LINKFLAGSAPP) $(APP4BASEX) \
989		$(APP4STACKN) \
990		-out:$@ \
991		-map:$(MISC)/{$(subst,/,_ $(APP4TARGET)).map} \
992		$(STDOBJ) \
993		$(APP4LINKRES) \
994		$(APP4RES) \
995		$(APP4OBJS) \
996		$(APP4LIBS) \
997		$(APP4STDLIBS) \
998		$(APP4STDLIB) $(STDLIB4) \
999		)
1000	@-echo linking $@.manifest ...
1001.IF "$(VISTA_MANIFEST)"!=""
1002	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
1003	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);1 $(FI)
1004.ELSE
1005	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);1 $(FI)
1006.ENDIF # "$(VISTA_MANIFEST)"!=""
1007	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
1008	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
1009.ELSE
1010		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP4TARGET).lnk
1011		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP4TARGET).lst
1012		$(COMMAND_ECHO)-$(RM) $(MISC)\linkobj.lst
1013		for %_i in ($(MISC)\*.obj) do type %_i >> $(MISC)\linkobj.lst
1014	type $(mktmp,$(MISC)\$(APP4TARGET).lst
1015		$(APP4LINKFLAGS) \
1016		$(LINKFLAGSAPP) $(APP4BASEX) \
1017		$(APP4STACKN) \
1018		-out:$@ \
1019		$(STDOBJ) \
1020		$(APP4LINKRES) \
1021		$(APP4RES) \
1022		$(APP4OBJS) \
1023		$(APP4LIBS) \
1024		$(APP4STDLIBS) \
1025		$(APP4STDLIB) $(STDLIB4))
1026		$(COMMAND_ECHO)$(SED)$(SED) -e 's/\(\.\.\\\)\{2,4\}/..\\/g' $(MISC)\$(APP4TARGETN:b)_linkobj.lst >> $(MISC)\$(APP4TARGET).lst
1027		$(COMMAND_ECHO)$(SED)$(IFEXIST) $(MISC)/$(APP4TARGET).lst $(THEN) type $(MISC)/$(APP4TARGET).lst  >> $(MISC)/$(APP4TARGET).lnk $(FI)
1028		$(COMMAND_ECHO)$(SED)$(APP4LINKER) @$(MISC)\$(APP4TARGET).lnk
1029.ENDIF		# "$(linkinc)" == ""
1030.ENDIF		# "$(COM)" == "GCC"
1031.IF "$(APP4TARGET)" == "loader"
1032	$(COMMAND_ECHO)$(PERL) loader.pl $@
1033	$(COMMAND_ECHO)$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
1034	$(COMMAND_ECHO)$(RM) $@
1035	$(COMMAND_ECHO)$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
1036.ENDIF			# "$(TARGET)" == "setup"
1037
1038.ENDIF			# "$(GUI)" == "WNT"
1039
1040.IF "$(GUI)" == "OS2"
1041	@+-$(MKDIR) $(@:d:d) > $(NULLDEV)
1042.IF "$(APP4LINKRES)" != ""
1043	@+-$(RM) $(MISC)/$(APP4LINKRES:b).rc > $(NULLDEV)
1044.IF "$(APP4ICON)" != ""
1045	@-+echo ICON 1 $(EMQ)"$(APP4ICON:s#/#\\\\#)$(EMQ)" >> $(MISC)$/$(APP4LINKRES:b).rc
1046.ENDIF		# "$(APP4ICON)" != ""
1047.IF "$(APP4VERINFO)" != ""
1048	@-+echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP4LINKRES:b).rc
1049	@-+echo $(EMQ)#include  $(EMQ)"$(APP4VERINFO)$(EMQ)" >> $(MISC)/$(APP4LINKRES:b).rc
1050.ENDIF		# "$(APP4VERINFO)" != ""
1051	$(COMMAND_ECHO)$(RC) -r -DOS2 $(APP4PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP4LINKRES:b).rc
1052.ENDIF			# "$(APP4LINKRES)" != ""
1053
1054.IF "$(TARGETTYPE)" == "GUI"
1055	@echo NAME $(APP4TARGET) WINDOWAPI > $(MISC)/$(APP4TARGET).def
1056.ENDIF
1057
1058	$(COMMAND_ECHO)$(APP4LINKER) -v \
1059		$(APP4LINKFLAGS) \
1060		$(LINKFLAGSAPP) $(APP4BASEX) \
1061		$(APP4STACKN) \
1062		-o $@ \
1063		-Zmap -L$(LB) \
1064		-L$(SOLARVERSION)/$(INPATH)/lib \
1065		$(STDOBJ) \
1066		$(APP4LINKRES) \
1067		$(APP4RES) \
1068		$(APP4DEF) \
1069		$(APP4OBJS) \
1070		$(APP4LIBS) \
1071		$(APP4STDLIBS) \
1072		$(APP4STDLIB) $(STDLIB4)
1073
1074
1075.IF "$(APP4TARGET)" == "loader"
1076	$(COMMAND_ECHO)+$(PERL) loader.pl $@
1077	$(COMMAND_ECHO)+$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
1078	$(COMMAND_ECHO)+$(RM) $@
1079	$(COMMAND_ECHO)+$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
1080.ENDIF			# "$(TARGET)" == "setup"
1081
1082.ENDIF			# "$(GUI)" == "OS2"
1083
1084.ENDIF			# "$(APP4TARGETN)"!=""
1085
1086# New rule for automatic run targets of unit test targets
1087.IF "$(APP4TEST)" == "enabled" &&  "$(APP4TARGET)" != ""
1088
1089$(APP4TARGET)_run: $(APP4TARGETN)
1090	$(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP4TARGETN) --gtest_output="xml:$(BIN)/$(APP4TARGET)_result.xml"
1091
1092.ENDIF
1093
1094
1095# Instruction for linking
1096# unroll begin
1097
1098.IF "$(GUI)" == "OS2" && "$(TARGETTYPE)" == "GUI"
1099APP5DEF = $(MISC)/$(APP5TARGET).def
1100.ENDIF
1101
1102.IF "$(APP5LINKTYPE)" != ""
1103#must be either STATIC or SHARED
1104APP5LINKTYPEFLAG=$(APPLINK$(APP5LINKTYPE))
1105.ENDIF
1106
1107# decide how to link
1108.IF "$(APP5CODETYPE)"=="C"
1109APP5LINKER=$(LINKC)
1110APP5STDLIB=$(subst,CPPRUNTIME, $(STDLIB))
1111APP5LINKFLAGS+=$(LINKCFLAGS)
1112.ELSE			# "$(APP5CODETYPE)"=="C"
1113APP5LINKER=$(LINK)
1114APP5STDLIB=$(subst,CPPRUNTIME,$(STDLIBCPP) $(STDLIB))
1115APP5LINKFLAGS+=$(LINKFLAGS)
1116.ENDIF			# "$(APP5CODETYPE)"=="C"
1117
1118APP5RPATH*=OOO
1119LINKFLAGSRUNPATH_$(APP5RPATH)*=/ERROR:/Bad_APP5RPATH_value
1120.IF "$(OS)" != "MACOSX"
1121APP5LINKFLAGS+=$(LINKFLAGSRUNPATH_$(APP5RPATH))
1122.ENDIF
1123
1124.IF "$(APP5STACK)" != ""
1125.IF "$(LINKFLAGSTACK)" != ""
1126APP5STACKN=$(LINKFLAGSTACK)$(APP5STACK)
1127.ENDIF
1128.ELSE
1129APP5STACKN=
1130.ENDIF
1131
1132.IF "$(APP5NOSAL)"==""
1133.IF "$(TARGETTYPE)" == "GUI"
1134APP5OBJS+= $(STDOBJVCL)
1135.ENDIF
1136.ENDIF
1137
1138.IF "$(GUI)$(COM)" == "WNTGCC"
1139APP5RESO=
1140.IF "$(APP5LINKRES)" != "" || "$(APP5RES)" != ""
1141APP5RESO=$(MISC)/$(APP5TARGET:b)_res.o
1142.ENDIF
1143.ENDIF
1144
1145.IF "$(GUI)" == "UNX"
1146APP5DEPN+:=$(APP5DEPNU)
1147USE_APP5DEF=
1148.ENDIF
1149
1150.IF "$(APP5TARGETN)"!=""
1151
1152.IF "$(APP5PRODUCTNAME)"!=""
1153APP5PRODUCTDEF+:=-DPRODUCT_NAME=\"$(APP5PRODUCTNAME)\"
1154.ENDIF			# "$(APP5PRODUCTNAME)"!=""
1155
1156.IF "$(linkinc)"!=""
1157.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
1158.IF "$(APP5LIBS)"!=""
1159$(MISC)/$(APP5TARGET)_linkinc.ls .PHONY:
1160	@@-$(RM) $@
1161	sed -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(APP5LIBS) $(i:s/.lib/.lin/)) >> $@
1162.ENDIF          #"$(APP5LIBS)"!=""
1163.ENDIF
1164
1165LINKINCTARGETS+=$(MISC)/$(APP5TARGETN:b)_linkinc.ls
1166$(APP5TARGETN) : $(LINKINCTARGETS)
1167.ENDIF          # "$(linkinc)"!=""
1168
1169# Allow for target specific LIBSALCPPRT override
1170APP5LIBSALCPPRT*=$(LIBSALCPPRT)
1171
1172$(APP5TARGETN): $(APP5OBJS) $(APP5LIBS) \
1173	$(APP5RES) \
1174	$(APP5ICON) $(APP5DEPN) $(USE_APP5DEF)
1175	@echo "Making:   " $(@:f)
1176.IF "$(GUI)"=="UNX"
1177.IF "$(OS)"=="MACOSX"
1178	@echo unx
1179	@-$(RM) $(MISC)/$(@:b).list
1180	@-$(RM) $(MISC)/$(TARGET).$(@:b)_5.cmd
1181	@-$(RM) $(MISC)/$(@:b).strip
1182	@echo $(STDSLO) $(APP5OBJS:s/.obj/.o/) \
1183	`cat /dev/null $(APP5LIBS) | sed s\#$(ROUT)\#$(OUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list
1184	@echo -n $(APP5LINKER) $(APP5LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) -o $@ \
1185	$(APP5LINKTYPEFLAG) $(APP5STDLIBS) $(APP5STDLIB) $(STDLIB5) -filelist $(MISC)/$(@:b).list > $(MISC)/$(TARGET).$(@:b)_5.cmd
1186    @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \
1187        `cat $(MISC)/$(TARGET).$(@:b)_5.cmd` \
1188        >> $(MISC)/$(TARGET).$(@:b)_5.cmd
1189  .IF "$(VERBOSE)" == "TRUE"
1190	@cat $(MISC)/$(TARGET).$(@:b)_5.cmd
1191  .ENDIF
1192	@+source $(MISC)/$(TARGET).$(@:b)_5.cmd
1193# Need to strip __objcInit symbol to avoid duplicate symbols when loading
1194# libraries at runtime
1195	@-$(CC_PATH)nm $@ | grep -v ' U ' | $(AWK) '{ print $$NF }' | grep -F -x '__objcInit' > $(MISC)/$(@:b).strip
1196	@$(CC_PATH)strip -i -R $(MISC)/$(@:b).strip -X $@
1197	@ls -l $@
1198    @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \
1199        app $(APP5RPATH) $@
1200.IF "$(TARGETTYPE)"=="GUI"
1201	@echo "Making:   " $(@:f).app
1202	@macosx-create-bundle $@
1203.ENDIF		# "$(TARGETTYPE)"=="GUI"
1204.ELSE		# "$(OS)"=="MACOSX"
1205	@echo unx
1206	@-$(RM) $(MISC)/$(TARGET).$(@:b)_5.cmd
1207	@echo $(APP5LINKER) $(APP5LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
1208	$(APP5OBJS:s/.obj/.o/) '\' >  $(MISC)/$(TARGET).$(@:b)_5.cmd
1209	@cat $(mktmp /dev/null $(APP5LIBS)) | xargs -n 1 cat | sed s\#$(ROUT)\#$(OUT)\#g | sed 's#$$# \\#'  >> $(MISC)/$(TARGET).$(@:b)_5.cmd
1210	@echo $(APP5LINKTYPEFLAG) $(APP5LIBSALCPPRT) $(APP5STDLIBS) $(APP5STDLIB) $(STDLIB5) -o $@ >> $(MISC)/$(TARGET).$(@:b)_5.cmd
1211  .IF "$(VERBOSE)" == "TRUE"
1212	@cat $(MISC)/$(TARGET).$(@:b)_5.cmd
1213  .ENDIF
1214	@+source $(MISC)/$(TARGET).$(@:b)_5.cmd
1215  .IF "$(VERBOSE)" == "TRUE"
1216	@ls -l $@
1217  .ENDIF
1218.ENDIF		# "$(OS)"=="MACOSX"
1219.ENDIF
1220.IF "$(GUI)" == "WNT"
1221	@@-$(MKDIR) $(@:d:d)
1222.IF "$(APP5LINKRES)" != ""
1223	@@-$(RM) $(MISC)/$(APP5LINKRES:b).rc
1224.IF "$(APP5ICON)" != ""
1225	@-echo 1 ICON $(EMQ)"$(APP5ICON:s/\/\\/)$(EMQ)" >> $(MISC)/$(APP5LINKRES:b).rc
1226.ENDIF		# "$(APP5ICON)" != ""
1227.IF "$(APP5VERINFO)" != ""
1228	@-echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP5LINKRES:b).rc
1229	@-echo $(EMQ)#include  $(EMQ)"$(APP5VERINFO)$(EMQ)" >> $(MISC)/$(APP5LINKRES:b).rc
1230.ENDIF		# "$(APP5VERINFO)" != ""
1231	$(COMMAND_ECHO)$(RC) -DWIN32 $(APP5PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP5LINKRES:b).rc
1232.ENDIF			# "$(APP5LINKRES)" != ""
1233.IF "$(COM)" == "GCC"
1234	@echo mingw
1235.IF "$(APP5LINKRES)" != "" || "$(APP5RES)" != ""
1236	@cat $(APP5LINKRES) $(subst,/res/,/res{$(subst,$(BIN), $(@:d))} $(APP5RES)) >  $(MISC)/$(@:b)_all.res
1237	windres $(MISC)/$(@:b)_all.res $(APP5RESO)
1238.ENDIF
1239	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSAPP) $(MINGWSSTDOBJ) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
1240		$(APP5BASEX) $(APP5STACKN) -o $@ $(APP5OBJS) \
1241		-Wl,-Map,$(MISC)/$(@:b).map $(STDOBJ) $(APP5RESO) \
1242		`$(TYPE) /dev/null $(APP5LIBS) | sed s#$(ROUT)#$(OUT)#g` \
1243		$(APP_LINKTYPE) $(APP5LIBSALCPPRT) \
1244		-Wl,--start-group $(APP5STDLIBS) -Wl,--end-group $(APP5STDLIB) \
1245		$(STDLIB5) $(MINGWSSTDENDOBJ) > $(MISC)/$(TARGET).$(@:b)_5.cmd
1246  # need this empty line, else dmake somehow gets confused by the .IFs and .ENDIFs
1247  .IF "$(VERBOSE)" == "TRUE"
1248	@$(TYPE)  $(MISC)/$(TARGET).$(@:b)_5.cmd
1249  .ENDIF
1250	@+source $(MISC)/$(TARGET).$(@:b)_5.cmd
1251	@ls -l $@
1252.ELSE	# "$(COM)" == "GCC"
1253.IF "$(linkinc)" == ""
1254	$(COMMAND_ECHO)$(APP5LINKER) @$(mktmp \
1255		$(APP5LINKFLAGS) \
1256		$(LINKFLAGSAPP) $(APP5BASEX) \
1257		$(APP5STACKN) \
1258		-out:$@ \
1259		-map:$(MISC)/{$(subst,/,_ $(APP5TARGET)).map} \
1260		$(STDOBJ) \
1261		$(APP5LINKRES) \
1262		$(APP5RES) \
1263		$(APP5OBJS) \
1264		$(APP5LIBS) \
1265		$(APP5STDLIBS) \
1266		$(APP5STDLIB) $(STDLIB5) \
1267		)
1268	@-echo linking $@.manifest ...
1269.IF "$(VISTA_MANIFEST)"!=""
1270	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
1271	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);1 $(FI)
1272.ELSE
1273	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);1 $(FI)
1274.ENDIF # "$(VISTA_MANIFEST)"!=""
1275	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
1276	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
1277.ELSE
1278		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP5TARGET).lnk
1279		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP5TARGET).lst
1280		$(COMMAND_ECHO)-$(RM) $(MISC)\linkobj.lst
1281		for %_i in ($(MISC)\*.obj) do type %_i >> $(MISC)\linkobj.lst
1282	type $(mktmp,$(MISC)\$(APP5TARGET).lst
1283		$(APP5LINKFLAGS) \
1284		$(LINKFLAGSAPP) $(APP5BASEX) \
1285		$(APP5STACKN) \
1286		-out:$@ \
1287		$(STDOBJ) \
1288		$(APP5LINKRES) \
1289		$(APP5RES) \
1290		$(APP5OBJS) \
1291		$(APP5LIBS) \
1292		$(APP5STDLIBS) \
1293		$(APP5STDLIB) $(STDLIB5))
1294		$(COMMAND_ECHO)$(SED)$(SED) -e 's/\(\.\.\\\)\{2,4\}/..\\/g' $(MISC)\$(APP5TARGETN:b)_linkobj.lst >> $(MISC)\$(APP5TARGET).lst
1295		$(COMMAND_ECHO)$(SED)$(IFEXIST) $(MISC)/$(APP5TARGET).lst $(THEN) type $(MISC)/$(APP5TARGET).lst  >> $(MISC)/$(APP5TARGET).lnk $(FI)
1296		$(COMMAND_ECHO)$(SED)$(APP5LINKER) @$(MISC)\$(APP5TARGET).lnk
1297.ENDIF		# "$(linkinc)" == ""
1298.ENDIF		# "$(COM)" == "GCC"
1299.IF "$(APP5TARGET)" == "loader"
1300	$(COMMAND_ECHO)$(PERL) loader.pl $@
1301	$(COMMAND_ECHO)$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
1302	$(COMMAND_ECHO)$(RM) $@
1303	$(COMMAND_ECHO)$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
1304.ENDIF			# "$(TARGET)" == "setup"
1305
1306.ENDIF			# "$(GUI)" == "WNT"
1307
1308.IF "$(GUI)" == "OS2"
1309	@+-$(MKDIR) $(@:d:d) > $(NULLDEV)
1310.IF "$(APP5LINKRES)" != ""
1311	@+-$(RM) $(MISC)/$(APP5LINKRES:b).rc > $(NULLDEV)
1312.IF "$(APP5ICON)" != ""
1313	@-+echo ICON 1 $(EMQ)"$(APP5ICON:s#/#\\\\#)$(EMQ)" >> $(MISC)$/$(APP5LINKRES:b).rc
1314.ENDIF		# "$(APP5ICON)" != ""
1315.IF "$(APP5VERINFO)" != ""
1316	@-+echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP5LINKRES:b).rc
1317	@-+echo $(EMQ)#include  $(EMQ)"$(APP5VERINFO)$(EMQ)" >> $(MISC)/$(APP5LINKRES:b).rc
1318.ENDIF		# "$(APP5VERINFO)" != ""
1319	$(COMMAND_ECHO)$(RC) -r -DOS2 $(APP5PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP5LINKRES:b).rc
1320.ENDIF			# "$(APP5LINKRES)" != ""
1321
1322.IF "$(TARGETTYPE)" == "GUI"
1323	@echo NAME $(APP5TARGET) WINDOWAPI > $(MISC)/$(APP5TARGET).def
1324.ENDIF
1325
1326	$(COMMAND_ECHO)$(APP5LINKER) -v \
1327		$(APP5LINKFLAGS) \
1328		$(LINKFLAGSAPP) $(APP5BASEX) \
1329		$(APP5STACKN) \
1330		-o $@ \
1331		-Zmap -L$(LB) \
1332		-L$(SOLARVERSION)/$(INPATH)/lib \
1333		$(STDOBJ) \
1334		$(APP5LINKRES) \
1335		$(APP5RES) \
1336		$(APP5DEF) \
1337		$(APP5OBJS) \
1338		$(APP5LIBS) \
1339		$(APP5STDLIBS) \
1340		$(APP5STDLIB) $(STDLIB5)
1341
1342
1343.IF "$(APP5TARGET)" == "loader"
1344	$(COMMAND_ECHO)+$(PERL) loader.pl $@
1345	$(COMMAND_ECHO)+$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
1346	$(COMMAND_ECHO)+$(RM) $@
1347	$(COMMAND_ECHO)+$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
1348.ENDIF			# "$(TARGET)" == "setup"
1349
1350.ENDIF			# "$(GUI)" == "OS2"
1351
1352.ENDIF			# "$(APP5TARGETN)"!=""
1353
1354# New rule for automatic run targets of unit test targets
1355.IF "$(APP5TEST)" == "enabled" &&  "$(APP5TARGET)" != ""
1356
1357$(APP5TARGET)_run: $(APP5TARGETN)
1358	$(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP5TARGETN) --gtest_output="xml:$(BIN)/$(APP5TARGET)_result.xml"
1359
1360.ENDIF
1361
1362
1363# Instruction for linking
1364# unroll begin
1365
1366.IF "$(GUI)" == "OS2" && "$(TARGETTYPE)" == "GUI"
1367APP6DEF = $(MISC)/$(APP6TARGET).def
1368.ENDIF
1369
1370.IF "$(APP6LINKTYPE)" != ""
1371#must be either STATIC or SHARED
1372APP6LINKTYPEFLAG=$(APPLINK$(APP6LINKTYPE))
1373.ENDIF
1374
1375# decide how to link
1376.IF "$(APP6CODETYPE)"=="C"
1377APP6LINKER=$(LINKC)
1378APP6STDLIB=$(subst,CPPRUNTIME, $(STDLIB))
1379APP6LINKFLAGS+=$(LINKCFLAGS)
1380.ELSE			# "$(APP6CODETYPE)"=="C"
1381APP6LINKER=$(LINK)
1382APP6STDLIB=$(subst,CPPRUNTIME,$(STDLIBCPP) $(STDLIB))
1383APP6LINKFLAGS+=$(LINKFLAGS)
1384.ENDIF			# "$(APP6CODETYPE)"=="C"
1385
1386APP6RPATH*=OOO
1387LINKFLAGSRUNPATH_$(APP6RPATH)*=/ERROR:/Bad_APP6RPATH_value
1388.IF "$(OS)" != "MACOSX"
1389APP6LINKFLAGS+=$(LINKFLAGSRUNPATH_$(APP6RPATH))
1390.ENDIF
1391
1392.IF "$(APP6STACK)" != ""
1393.IF "$(LINKFLAGSTACK)" != ""
1394APP6STACKN=$(LINKFLAGSTACK)$(APP6STACK)
1395.ENDIF
1396.ELSE
1397APP6STACKN=
1398.ENDIF
1399
1400.IF "$(APP6NOSAL)"==""
1401.IF "$(TARGETTYPE)" == "GUI"
1402APP6OBJS+= $(STDOBJVCL)
1403.ENDIF
1404.ENDIF
1405
1406.IF "$(GUI)$(COM)" == "WNTGCC"
1407APP6RESO=
1408.IF "$(APP6LINKRES)" != "" || "$(APP6RES)" != ""
1409APP6RESO=$(MISC)/$(APP6TARGET:b)_res.o
1410.ENDIF
1411.ENDIF
1412
1413.IF "$(GUI)" == "UNX"
1414APP6DEPN+:=$(APP6DEPNU)
1415USE_APP6DEF=
1416.ENDIF
1417
1418.IF "$(APP6TARGETN)"!=""
1419
1420.IF "$(APP6PRODUCTNAME)"!=""
1421APP6PRODUCTDEF+:=-DPRODUCT_NAME=\"$(APP6PRODUCTNAME)\"
1422.ENDIF			# "$(APP6PRODUCTNAME)"!=""
1423
1424.IF "$(linkinc)"!=""
1425.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
1426.IF "$(APP6LIBS)"!=""
1427$(MISC)/$(APP6TARGET)_linkinc.ls .PHONY:
1428	@@-$(RM) $@
1429	sed -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(APP6LIBS) $(i:s/.lib/.lin/)) >> $@
1430.ENDIF          #"$(APP6LIBS)"!=""
1431.ENDIF
1432
1433LINKINCTARGETS+=$(MISC)/$(APP6TARGETN:b)_linkinc.ls
1434$(APP6TARGETN) : $(LINKINCTARGETS)
1435.ENDIF          # "$(linkinc)"!=""
1436
1437# Allow for target specific LIBSALCPPRT override
1438APP6LIBSALCPPRT*=$(LIBSALCPPRT)
1439
1440$(APP6TARGETN): $(APP6OBJS) $(APP6LIBS) \
1441	$(APP6RES) \
1442	$(APP6ICON) $(APP6DEPN) $(USE_APP6DEF)
1443	@echo "Making:   " $(@:f)
1444.IF "$(GUI)"=="UNX"
1445.IF "$(OS)"=="MACOSX"
1446	@echo unx
1447	@-$(RM) $(MISC)/$(@:b).list
1448	@-$(RM) $(MISC)/$(TARGET).$(@:b)_6.cmd
1449	@-$(RM) $(MISC)/$(@:b).strip
1450	@echo $(STDSLO) $(APP6OBJS:s/.obj/.o/) \
1451	`cat /dev/null $(APP6LIBS) | sed s\#$(ROUT)\#$(OUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list
1452	@echo -n $(APP6LINKER) $(APP6LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) -o $@ \
1453	$(APP6LINKTYPEFLAG) $(APP6STDLIBS) $(APP6STDLIB) $(STDLIB6) -filelist $(MISC)/$(@:b).list > $(MISC)/$(TARGET).$(@:b)_6.cmd
1454    @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \
1455        `cat $(MISC)/$(TARGET).$(@:b)_6.cmd` \
1456        >> $(MISC)/$(TARGET).$(@:b)_6.cmd
1457  .IF "$(VERBOSE)" == "TRUE"
1458	@cat $(MISC)/$(TARGET).$(@:b)_6.cmd
1459  .ENDIF
1460	@+source $(MISC)/$(TARGET).$(@:b)_6.cmd
1461# Need to strip __objcInit symbol to avoid duplicate symbols when loading
1462# libraries at runtime
1463	@-$(CC_PATH)nm $@ | grep -v ' U ' | $(AWK) '{ print $$NF }' | grep -F -x '__objcInit' > $(MISC)/$(@:b).strip
1464	@$(CC_PATH)strip -i -R $(MISC)/$(@:b).strip -X $@
1465	@ls -l $@
1466    @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \
1467        app $(APP6RPATH) $@
1468.IF "$(TARGETTYPE)"=="GUI"
1469	@echo "Making:   " $(@:f).app
1470	@macosx-create-bundle $@
1471.ENDIF		# "$(TARGETTYPE)"=="GUI"
1472.ELSE		# "$(OS)"=="MACOSX"
1473	@echo unx
1474	@-$(RM) $(MISC)/$(TARGET).$(@:b)_6.cmd
1475	@echo $(APP6LINKER) $(APP6LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
1476	$(APP6OBJS:s/.obj/.o/) '\' >  $(MISC)/$(TARGET).$(@:b)_6.cmd
1477	@cat $(mktmp /dev/null $(APP6LIBS)) | xargs -n 1 cat | sed s\#$(ROUT)\#$(OUT)\#g | sed 's#$$# \\#'  >> $(MISC)/$(TARGET).$(@:b)_6.cmd
1478	@echo $(APP6LINKTYPEFLAG) $(APP6LIBSALCPPRT) $(APP6STDLIBS) $(APP6STDLIB) $(STDLIB6) -o $@ >> $(MISC)/$(TARGET).$(@:b)_6.cmd
1479  .IF "$(VERBOSE)" == "TRUE"
1480	@cat $(MISC)/$(TARGET).$(@:b)_6.cmd
1481  .ENDIF
1482	@+source $(MISC)/$(TARGET).$(@:b)_6.cmd
1483  .IF "$(VERBOSE)" == "TRUE"
1484	@ls -l $@
1485  .ENDIF
1486.ENDIF		# "$(OS)"=="MACOSX"
1487.ENDIF
1488.IF "$(GUI)" == "WNT"
1489	@@-$(MKDIR) $(@:d:d)
1490.IF "$(APP6LINKRES)" != ""
1491	@@-$(RM) $(MISC)/$(APP6LINKRES:b).rc
1492.IF "$(APP6ICON)" != ""
1493	@-echo 1 ICON $(EMQ)"$(APP6ICON:s/\/\\/)$(EMQ)" >> $(MISC)/$(APP6LINKRES:b).rc
1494.ENDIF		# "$(APP6ICON)" != ""
1495.IF "$(APP6VERINFO)" != ""
1496	@-echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP6LINKRES:b).rc
1497	@-echo $(EMQ)#include  $(EMQ)"$(APP6VERINFO)$(EMQ)" >> $(MISC)/$(APP6LINKRES:b).rc
1498.ENDIF		# "$(APP6VERINFO)" != ""
1499	$(COMMAND_ECHO)$(RC) -DWIN32 $(APP6PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP6LINKRES:b).rc
1500.ENDIF			# "$(APP6LINKRES)" != ""
1501.IF "$(COM)" == "GCC"
1502	@echo mingw
1503.IF "$(APP6LINKRES)" != "" || "$(APP6RES)" != ""
1504	@cat $(APP6LINKRES) $(subst,/res/,/res{$(subst,$(BIN), $(@:d))} $(APP6RES)) >  $(MISC)/$(@:b)_all.res
1505	windres $(MISC)/$(@:b)_all.res $(APP6RESO)
1506.ENDIF
1507	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSAPP) $(MINGWSSTDOBJ) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
1508		$(APP6BASEX) $(APP6STACKN) -o $@ $(APP6OBJS) \
1509		-Wl,-Map,$(MISC)/$(@:b).map $(STDOBJ) $(APP6RESO) \
1510		`$(TYPE) /dev/null $(APP6LIBS) | sed s#$(ROUT)#$(OUT)#g` \
1511		$(APP_LINKTYPE) $(APP6LIBSALCPPRT) \
1512		-Wl,--start-group $(APP6STDLIBS) -Wl,--end-group $(APP6STDLIB) \
1513		$(STDLIB6) $(MINGWSSTDENDOBJ) > $(MISC)/$(TARGET).$(@:b)_6.cmd
1514  # need this empty line, else dmake somehow gets confused by the .IFs and .ENDIFs
1515  .IF "$(VERBOSE)" == "TRUE"
1516	@$(TYPE)  $(MISC)/$(TARGET).$(@:b)_6.cmd
1517  .ENDIF
1518	@+source $(MISC)/$(TARGET).$(@:b)_6.cmd
1519	@ls -l $@
1520.ELSE	# "$(COM)" == "GCC"
1521.IF "$(linkinc)" == ""
1522	$(COMMAND_ECHO)$(APP6LINKER) @$(mktmp \
1523		$(APP6LINKFLAGS) \
1524		$(LINKFLAGSAPP) $(APP6BASEX) \
1525		$(APP6STACKN) \
1526		-out:$@ \
1527		-map:$(MISC)/{$(subst,/,_ $(APP6TARGET)).map} \
1528		$(STDOBJ) \
1529		$(APP6LINKRES) \
1530		$(APP6RES) \
1531		$(APP6OBJS) \
1532		$(APP6LIBS) \
1533		$(APP6STDLIBS) \
1534		$(APP6STDLIB) $(STDLIB6) \
1535		)
1536	@-echo linking $@.manifest ...
1537.IF "$(VISTA_MANIFEST)"!=""
1538	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
1539	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);1 $(FI)
1540.ELSE
1541	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);1 $(FI)
1542.ENDIF # "$(VISTA_MANIFEST)"!=""
1543	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
1544	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
1545.ELSE
1546		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP6TARGET).lnk
1547		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP6TARGET).lst
1548		$(COMMAND_ECHO)-$(RM) $(MISC)\linkobj.lst
1549		for %_i in ($(MISC)\*.obj) do type %_i >> $(MISC)\linkobj.lst
1550	type $(mktmp,$(MISC)\$(APP6TARGET).lst
1551		$(APP6LINKFLAGS) \
1552		$(LINKFLAGSAPP) $(APP6BASEX) \
1553		$(APP6STACKN) \
1554		-out:$@ \
1555		$(STDOBJ) \
1556		$(APP6LINKRES) \
1557		$(APP6RES) \
1558		$(APP6OBJS) \
1559		$(APP6LIBS) \
1560		$(APP6STDLIBS) \
1561		$(APP6STDLIB) $(STDLIB6))
1562		$(COMMAND_ECHO)$(SED)$(SED) -e 's/\(\.\.\\\)\{2,4\}/..\\/g' $(MISC)\$(APP6TARGETN:b)_linkobj.lst >> $(MISC)\$(APP6TARGET).lst
1563		$(COMMAND_ECHO)$(SED)$(IFEXIST) $(MISC)/$(APP6TARGET).lst $(THEN) type $(MISC)/$(APP6TARGET).lst  >> $(MISC)/$(APP6TARGET).lnk $(FI)
1564		$(COMMAND_ECHO)$(SED)$(APP6LINKER) @$(MISC)\$(APP6TARGET).lnk
1565.ENDIF		# "$(linkinc)" == ""
1566.ENDIF		# "$(COM)" == "GCC"
1567.IF "$(APP6TARGET)" == "loader"
1568	$(COMMAND_ECHO)$(PERL) loader.pl $@
1569	$(COMMAND_ECHO)$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
1570	$(COMMAND_ECHO)$(RM) $@
1571	$(COMMAND_ECHO)$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
1572.ENDIF			# "$(TARGET)" == "setup"
1573
1574.ENDIF			# "$(GUI)" == "WNT"
1575
1576.IF "$(GUI)" == "OS2"
1577	@+-$(MKDIR) $(@:d:d) > $(NULLDEV)
1578.IF "$(APP6LINKRES)" != ""
1579	@+-$(RM) $(MISC)/$(APP6LINKRES:b).rc > $(NULLDEV)
1580.IF "$(APP6ICON)" != ""
1581	@-+echo ICON 1 $(EMQ)"$(APP6ICON:s#/#\\\\#)$(EMQ)" >> $(MISC)$/$(APP6LINKRES:b).rc
1582.ENDIF		# "$(APP6ICON)" != ""
1583.IF "$(APP6VERINFO)" != ""
1584	@-+echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP6LINKRES:b).rc
1585	@-+echo $(EMQ)#include  $(EMQ)"$(APP6VERINFO)$(EMQ)" >> $(MISC)/$(APP6LINKRES:b).rc
1586.ENDIF		# "$(APP6VERINFO)" != ""
1587	$(COMMAND_ECHO)$(RC) -r -DOS2 $(APP6PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP6LINKRES:b).rc
1588.ENDIF			# "$(APP6LINKRES)" != ""
1589
1590.IF "$(TARGETTYPE)" == "GUI"
1591	@echo NAME $(APP6TARGET) WINDOWAPI > $(MISC)/$(APP6TARGET).def
1592.ENDIF
1593
1594	$(COMMAND_ECHO)$(APP6LINKER) -v \
1595		$(APP6LINKFLAGS) \
1596		$(LINKFLAGSAPP) $(APP6BASEX) \
1597		$(APP6STACKN) \
1598		-o $@ \
1599		-Zmap -L$(LB) \
1600		-L$(SOLARVERSION)/$(INPATH)/lib \
1601		$(STDOBJ) \
1602		$(APP6LINKRES) \
1603		$(APP6RES) \
1604		$(APP6DEF) \
1605		$(APP6OBJS) \
1606		$(APP6LIBS) \
1607		$(APP6STDLIBS) \
1608		$(APP6STDLIB) $(STDLIB6)
1609
1610
1611.IF "$(APP6TARGET)" == "loader"
1612	$(COMMAND_ECHO)+$(PERL) loader.pl $@
1613	$(COMMAND_ECHO)+$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
1614	$(COMMAND_ECHO)+$(RM) $@
1615	$(COMMAND_ECHO)+$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
1616.ENDIF			# "$(TARGET)" == "setup"
1617
1618.ENDIF			# "$(GUI)" == "OS2"
1619
1620.ENDIF			# "$(APP6TARGETN)"!=""
1621
1622# New rule for automatic run targets of unit test targets
1623.IF "$(APP6TEST)" == "enabled" &&  "$(APP6TARGET)" != ""
1624
1625$(APP6TARGET)_run: $(APP6TARGETN)
1626	$(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP6TARGETN) --gtest_output="xml:$(BIN)/$(APP6TARGET)_result.xml"
1627
1628.ENDIF
1629
1630
1631# Instruction for linking
1632# unroll begin
1633
1634.IF "$(GUI)" == "OS2" && "$(TARGETTYPE)" == "GUI"
1635APP7DEF = $(MISC)/$(APP7TARGET).def
1636.ENDIF
1637
1638.IF "$(APP7LINKTYPE)" != ""
1639#must be either STATIC or SHARED
1640APP7LINKTYPEFLAG=$(APPLINK$(APP7LINKTYPE))
1641.ENDIF
1642
1643# decide how to link
1644.IF "$(APP7CODETYPE)"=="C"
1645APP7LINKER=$(LINKC)
1646APP7STDLIB=$(subst,CPPRUNTIME, $(STDLIB))
1647APP7LINKFLAGS+=$(LINKCFLAGS)
1648.ELSE			# "$(APP7CODETYPE)"=="C"
1649APP7LINKER=$(LINK)
1650APP7STDLIB=$(subst,CPPRUNTIME,$(STDLIBCPP) $(STDLIB))
1651APP7LINKFLAGS+=$(LINKFLAGS)
1652.ENDIF			# "$(APP7CODETYPE)"=="C"
1653
1654APP7RPATH*=OOO
1655LINKFLAGSRUNPATH_$(APP7RPATH)*=/ERROR:/Bad_APP7RPATH_value
1656.IF "$(OS)" != "MACOSX"
1657APP7LINKFLAGS+=$(LINKFLAGSRUNPATH_$(APP7RPATH))
1658.ENDIF
1659
1660.IF "$(APP7STACK)" != ""
1661.IF "$(LINKFLAGSTACK)" != ""
1662APP7STACKN=$(LINKFLAGSTACK)$(APP7STACK)
1663.ENDIF
1664.ELSE
1665APP7STACKN=
1666.ENDIF
1667
1668.IF "$(APP7NOSAL)"==""
1669.IF "$(TARGETTYPE)" == "GUI"
1670APP7OBJS+= $(STDOBJVCL)
1671.ENDIF
1672.ENDIF
1673
1674.IF "$(GUI)$(COM)" == "WNTGCC"
1675APP7RESO=
1676.IF "$(APP7LINKRES)" != "" || "$(APP7RES)" != ""
1677APP7RESO=$(MISC)/$(APP7TARGET:b)_res.o
1678.ENDIF
1679.ENDIF
1680
1681.IF "$(GUI)" == "UNX"
1682APP7DEPN+:=$(APP7DEPNU)
1683USE_APP7DEF=
1684.ENDIF
1685
1686.IF "$(APP7TARGETN)"!=""
1687
1688.IF "$(APP7PRODUCTNAME)"!=""
1689APP7PRODUCTDEF+:=-DPRODUCT_NAME=\"$(APP7PRODUCTNAME)\"
1690.ENDIF			# "$(APP7PRODUCTNAME)"!=""
1691
1692.IF "$(linkinc)"!=""
1693.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
1694.IF "$(APP7LIBS)"!=""
1695$(MISC)/$(APP7TARGET)_linkinc.ls .PHONY:
1696	@@-$(RM) $@
1697	sed -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(APP7LIBS) $(i:s/.lib/.lin/)) >> $@
1698.ENDIF          #"$(APP7LIBS)"!=""
1699.ENDIF
1700
1701LINKINCTARGETS+=$(MISC)/$(APP7TARGETN:b)_linkinc.ls
1702$(APP7TARGETN) : $(LINKINCTARGETS)
1703.ENDIF          # "$(linkinc)"!=""
1704
1705# Allow for target specific LIBSALCPPRT override
1706APP7LIBSALCPPRT*=$(LIBSALCPPRT)
1707
1708$(APP7TARGETN): $(APP7OBJS) $(APP7LIBS) \
1709	$(APP7RES) \
1710	$(APP7ICON) $(APP7DEPN) $(USE_APP7DEF)
1711	@echo "Making:   " $(@:f)
1712.IF "$(GUI)"=="UNX"
1713.IF "$(OS)"=="MACOSX"
1714	@echo unx
1715	@-$(RM) $(MISC)/$(@:b).list
1716	@-$(RM) $(MISC)/$(TARGET).$(@:b)_7.cmd
1717	@-$(RM) $(MISC)/$(@:b).strip
1718	@echo $(STDSLO) $(APP7OBJS:s/.obj/.o/) \
1719	`cat /dev/null $(APP7LIBS) | sed s\#$(ROUT)\#$(OUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list
1720	@echo -n $(APP7LINKER) $(APP7LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) -o $@ \
1721	$(APP7LINKTYPEFLAG) $(APP7STDLIBS) $(APP7STDLIB) $(STDLIB7) -filelist $(MISC)/$(@:b).list > $(MISC)/$(TARGET).$(@:b)_7.cmd
1722    @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \
1723        `cat $(MISC)/$(TARGET).$(@:b)_7.cmd` \
1724        >> $(MISC)/$(TARGET).$(@:b)_7.cmd
1725  .IF "$(VERBOSE)" == "TRUE"
1726	@cat $(MISC)/$(TARGET).$(@:b)_7.cmd
1727  .ENDIF
1728	@+source $(MISC)/$(TARGET).$(@:b)_7.cmd
1729# Need to strip __objcInit symbol to avoid duplicate symbols when loading
1730# libraries at runtime
1731	@-$(CC_PATH)nm $@ | grep -v ' U ' | $(AWK) '{ print $$NF }' | grep -F -x '__objcInit' > $(MISC)/$(@:b).strip
1732	@$(CC_PATH)strip -i -R $(MISC)/$(@:b).strip -X $@
1733	@ls -l $@
1734    @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \
1735        app $(APP7RPATH) $@
1736.IF "$(TARGETTYPE)"=="GUI"
1737	@echo "Making:   " $(@:f).app
1738	@macosx-create-bundle $@
1739.ENDIF		# "$(TARGETTYPE)"=="GUI"
1740.ELSE		# "$(OS)"=="MACOSX"
1741	@echo unx
1742	@-$(RM) $(MISC)/$(TARGET).$(@:b)_7.cmd
1743	@echo $(APP7LINKER) $(APP7LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
1744	$(APP7OBJS:s/.obj/.o/) '\' >  $(MISC)/$(TARGET).$(@:b)_7.cmd
1745	@cat $(mktmp /dev/null $(APP7LIBS)) | xargs -n 1 cat | sed s\#$(ROUT)\#$(OUT)\#g | sed 's#$$# \\#'  >> $(MISC)/$(TARGET).$(@:b)_7.cmd
1746	@echo $(APP7LINKTYPEFLAG) $(APP7LIBSALCPPRT) $(APP7STDLIBS) $(APP7STDLIB) $(STDLIB7) -o $@ >> $(MISC)/$(TARGET).$(@:b)_7.cmd
1747  .IF "$(VERBOSE)" == "TRUE"
1748	@cat $(MISC)/$(TARGET).$(@:b)_7.cmd
1749  .ENDIF
1750	@+source $(MISC)/$(TARGET).$(@:b)_7.cmd
1751  .IF "$(VERBOSE)" == "TRUE"
1752	@ls -l $@
1753  .ENDIF
1754.ENDIF		# "$(OS)"=="MACOSX"
1755.ENDIF
1756.IF "$(GUI)" == "WNT"
1757	@@-$(MKDIR) $(@:d:d)
1758.IF "$(APP7LINKRES)" != ""
1759	@@-$(RM) $(MISC)/$(APP7LINKRES:b).rc
1760.IF "$(APP7ICON)" != ""
1761	@-echo 1 ICON $(EMQ)"$(APP7ICON:s/\/\\/)$(EMQ)" >> $(MISC)/$(APP7LINKRES:b).rc
1762.ENDIF		# "$(APP7ICON)" != ""
1763.IF "$(APP7VERINFO)" != ""
1764	@-echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP7LINKRES:b).rc
1765	@-echo $(EMQ)#include  $(EMQ)"$(APP7VERINFO)$(EMQ)" >> $(MISC)/$(APP7LINKRES:b).rc
1766.ENDIF		# "$(APP7VERINFO)" != ""
1767	$(COMMAND_ECHO)$(RC) -DWIN32 $(APP7PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP7LINKRES:b).rc
1768.ENDIF			# "$(APP7LINKRES)" != ""
1769.IF "$(COM)" == "GCC"
1770	@echo mingw
1771.IF "$(APP7LINKRES)" != "" || "$(APP7RES)" != ""
1772	@cat $(APP7LINKRES) $(subst,/res/,/res{$(subst,$(BIN), $(@:d))} $(APP7RES)) >  $(MISC)/$(@:b)_all.res
1773	windres $(MISC)/$(@:b)_all.res $(APP7RESO)
1774.ENDIF
1775	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSAPP) $(MINGWSSTDOBJ) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
1776		$(APP7BASEX) $(APP7STACKN) -o $@ $(APP7OBJS) \
1777		-Wl,-Map,$(MISC)/$(@:b).map $(STDOBJ) $(APP7RESO) \
1778		`$(TYPE) /dev/null $(APP7LIBS) | sed s#$(ROUT)#$(OUT)#g` \
1779		$(APP_LINKTYPE) $(APP7LIBSALCPPRT) \
1780		-Wl,--start-group $(APP7STDLIBS) -Wl,--end-group $(APP7STDLIB) \
1781		$(STDLIB7) $(MINGWSSTDENDOBJ) > $(MISC)/$(TARGET).$(@:b)_7.cmd
1782  # need this empty line, else dmake somehow gets confused by the .IFs and .ENDIFs
1783  .IF "$(VERBOSE)" == "TRUE"
1784	@$(TYPE)  $(MISC)/$(TARGET).$(@:b)_7.cmd
1785  .ENDIF
1786	@+source $(MISC)/$(TARGET).$(@:b)_7.cmd
1787	@ls -l $@
1788.ELSE	# "$(COM)" == "GCC"
1789.IF "$(linkinc)" == ""
1790	$(COMMAND_ECHO)$(APP7LINKER) @$(mktmp \
1791		$(APP7LINKFLAGS) \
1792		$(LINKFLAGSAPP) $(APP7BASEX) \
1793		$(APP7STACKN) \
1794		-out:$@ \
1795		-map:$(MISC)/{$(subst,/,_ $(APP7TARGET)).map} \
1796		$(STDOBJ) \
1797		$(APP7LINKRES) \
1798		$(APP7RES) \
1799		$(APP7OBJS) \
1800		$(APP7LIBS) \
1801		$(APP7STDLIBS) \
1802		$(APP7STDLIB) $(STDLIB7) \
1803		)
1804	@-echo linking $@.manifest ...
1805.IF "$(VISTA_MANIFEST)"!=""
1806	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
1807	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);1 $(FI)
1808.ELSE
1809	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);1 $(FI)
1810.ENDIF # "$(VISTA_MANIFEST)"!=""
1811	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
1812	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
1813.ELSE
1814		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP7TARGET).lnk
1815		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP7TARGET).lst
1816		$(COMMAND_ECHO)-$(RM) $(MISC)\linkobj.lst
1817		for %_i in ($(MISC)\*.obj) do type %_i >> $(MISC)\linkobj.lst
1818	type $(mktmp,$(MISC)\$(APP7TARGET).lst
1819		$(APP7LINKFLAGS) \
1820		$(LINKFLAGSAPP) $(APP7BASEX) \
1821		$(APP7STACKN) \
1822		-out:$@ \
1823		$(STDOBJ) \
1824		$(APP7LINKRES) \
1825		$(APP7RES) \
1826		$(APP7OBJS) \
1827		$(APP7LIBS) \
1828		$(APP7STDLIBS) \
1829		$(APP7STDLIB) $(STDLIB7))
1830		$(COMMAND_ECHO)$(SED)$(SED) -e 's/\(\.\.\\\)\{2,4\}/..\\/g' $(MISC)\$(APP7TARGETN:b)_linkobj.lst >> $(MISC)\$(APP7TARGET).lst
1831		$(COMMAND_ECHO)$(SED)$(IFEXIST) $(MISC)/$(APP7TARGET).lst $(THEN) type $(MISC)/$(APP7TARGET).lst  >> $(MISC)/$(APP7TARGET).lnk $(FI)
1832		$(COMMAND_ECHO)$(SED)$(APP7LINKER) @$(MISC)\$(APP7TARGET).lnk
1833.ENDIF		# "$(linkinc)" == ""
1834.ENDIF		# "$(COM)" == "GCC"
1835.IF "$(APP7TARGET)" == "loader"
1836	$(COMMAND_ECHO)$(PERL) loader.pl $@
1837	$(COMMAND_ECHO)$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
1838	$(COMMAND_ECHO)$(RM) $@
1839	$(COMMAND_ECHO)$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
1840.ENDIF			# "$(TARGET)" == "setup"
1841
1842.ENDIF			# "$(GUI)" == "WNT"
1843
1844.IF "$(GUI)" == "OS2"
1845	@+-$(MKDIR) $(@:d:d) > $(NULLDEV)
1846.IF "$(APP7LINKRES)" != ""
1847	@+-$(RM) $(MISC)/$(APP7LINKRES:b).rc > $(NULLDEV)
1848.IF "$(APP7ICON)" != ""
1849	@-+echo ICON 1 $(EMQ)"$(APP7ICON:s#/#\\\\#)$(EMQ)" >> $(MISC)$/$(APP7LINKRES:b).rc
1850.ENDIF		# "$(APP7ICON)" != ""
1851.IF "$(APP7VERINFO)" != ""
1852	@-+echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP7LINKRES:b).rc
1853	@-+echo $(EMQ)#include  $(EMQ)"$(APP7VERINFO)$(EMQ)" >> $(MISC)/$(APP7LINKRES:b).rc
1854.ENDIF		# "$(APP7VERINFO)" != ""
1855	$(COMMAND_ECHO)$(RC) -r -DOS2 $(APP7PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP7LINKRES:b).rc
1856.ENDIF			# "$(APP7LINKRES)" != ""
1857
1858.IF "$(TARGETTYPE)" == "GUI"
1859	@echo NAME $(APP7TARGET) WINDOWAPI > $(MISC)/$(APP7TARGET).def
1860.ENDIF
1861
1862	$(COMMAND_ECHO)$(APP7LINKER) -v \
1863		$(APP7LINKFLAGS) \
1864		$(LINKFLAGSAPP) $(APP7BASEX) \
1865		$(APP7STACKN) \
1866		-o $@ \
1867		-Zmap -L$(LB) \
1868		-L$(SOLARVERSION)/$(INPATH)/lib \
1869		$(STDOBJ) \
1870		$(APP7LINKRES) \
1871		$(APP7RES) \
1872		$(APP7DEF) \
1873		$(APP7OBJS) \
1874		$(APP7LIBS) \
1875		$(APP7STDLIBS) \
1876		$(APP7STDLIB) $(STDLIB7)
1877
1878
1879.IF "$(APP7TARGET)" == "loader"
1880	$(COMMAND_ECHO)+$(PERL) loader.pl $@
1881	$(COMMAND_ECHO)+$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
1882	$(COMMAND_ECHO)+$(RM) $@
1883	$(COMMAND_ECHO)+$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
1884.ENDIF			# "$(TARGET)" == "setup"
1885
1886.ENDIF			# "$(GUI)" == "OS2"
1887
1888.ENDIF			# "$(APP7TARGETN)"!=""
1889
1890# New rule for automatic run targets of unit test targets
1891.IF "$(APP7TEST)" == "enabled" &&  "$(APP7TARGET)" != ""
1892
1893$(APP7TARGET)_run: $(APP7TARGETN)
1894	$(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP7TARGETN) --gtest_output="xml:$(BIN)/$(APP7TARGET)_result.xml"
1895
1896.ENDIF
1897
1898
1899# Instruction for linking
1900# unroll begin
1901
1902.IF "$(GUI)" == "OS2" && "$(TARGETTYPE)" == "GUI"
1903APP8DEF = $(MISC)/$(APP8TARGET).def
1904.ENDIF
1905
1906.IF "$(APP8LINKTYPE)" != ""
1907#must be either STATIC or SHARED
1908APP8LINKTYPEFLAG=$(APPLINK$(APP8LINKTYPE))
1909.ENDIF
1910
1911# decide how to link
1912.IF "$(APP8CODETYPE)"=="C"
1913APP8LINKER=$(LINKC)
1914APP8STDLIB=$(subst,CPPRUNTIME, $(STDLIB))
1915APP8LINKFLAGS+=$(LINKCFLAGS)
1916.ELSE			# "$(APP8CODETYPE)"=="C"
1917APP8LINKER=$(LINK)
1918APP8STDLIB=$(subst,CPPRUNTIME,$(STDLIBCPP) $(STDLIB))
1919APP8LINKFLAGS+=$(LINKFLAGS)
1920.ENDIF			# "$(APP8CODETYPE)"=="C"
1921
1922APP8RPATH*=OOO
1923LINKFLAGSRUNPATH_$(APP8RPATH)*=/ERROR:/Bad_APP8RPATH_value
1924.IF "$(OS)" != "MACOSX"
1925APP8LINKFLAGS+=$(LINKFLAGSRUNPATH_$(APP8RPATH))
1926.ENDIF
1927
1928.IF "$(APP8STACK)" != ""
1929.IF "$(LINKFLAGSTACK)" != ""
1930APP8STACKN=$(LINKFLAGSTACK)$(APP8STACK)
1931.ENDIF
1932.ELSE
1933APP8STACKN=
1934.ENDIF
1935
1936.IF "$(APP8NOSAL)"==""
1937.IF "$(TARGETTYPE)" == "GUI"
1938APP8OBJS+= $(STDOBJVCL)
1939.ENDIF
1940.ENDIF
1941
1942.IF "$(GUI)$(COM)" == "WNTGCC"
1943APP8RESO=
1944.IF "$(APP8LINKRES)" != "" || "$(APP8RES)" != ""
1945APP8RESO=$(MISC)/$(APP8TARGET:b)_res.o
1946.ENDIF
1947.ENDIF
1948
1949.IF "$(GUI)" == "UNX"
1950APP8DEPN+:=$(APP8DEPNU)
1951USE_APP8DEF=
1952.ENDIF
1953
1954.IF "$(APP8TARGETN)"!=""
1955
1956.IF "$(APP8PRODUCTNAME)"!=""
1957APP8PRODUCTDEF+:=-DPRODUCT_NAME=\"$(APP8PRODUCTNAME)\"
1958.ENDIF			# "$(APP8PRODUCTNAME)"!=""
1959
1960.IF "$(linkinc)"!=""
1961.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
1962.IF "$(APP8LIBS)"!=""
1963$(MISC)/$(APP8TARGET)_linkinc.ls .PHONY:
1964	@@-$(RM) $@
1965	sed -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(APP8LIBS) $(i:s/.lib/.lin/)) >> $@
1966.ENDIF          #"$(APP8LIBS)"!=""
1967.ENDIF
1968
1969LINKINCTARGETS+=$(MISC)/$(APP8TARGETN:b)_linkinc.ls
1970$(APP8TARGETN) : $(LINKINCTARGETS)
1971.ENDIF          # "$(linkinc)"!=""
1972
1973# Allow for target specific LIBSALCPPRT override
1974APP8LIBSALCPPRT*=$(LIBSALCPPRT)
1975
1976$(APP8TARGETN): $(APP8OBJS) $(APP8LIBS) \
1977	$(APP8RES) \
1978	$(APP8ICON) $(APP8DEPN) $(USE_APP8DEF)
1979	@echo "Making:   " $(@:f)
1980.IF "$(GUI)"=="UNX"
1981.IF "$(OS)"=="MACOSX"
1982	@echo unx
1983	@-$(RM) $(MISC)/$(@:b).list
1984	@-$(RM) $(MISC)/$(TARGET).$(@:b)_8.cmd
1985	@-$(RM) $(MISC)/$(@:b).strip
1986	@echo $(STDSLO) $(APP8OBJS:s/.obj/.o/) \
1987	`cat /dev/null $(APP8LIBS) | sed s\#$(ROUT)\#$(OUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list
1988	@echo -n $(APP8LINKER) $(APP8LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) -o $@ \
1989	$(APP8LINKTYPEFLAG) $(APP8STDLIBS) $(APP8STDLIB) $(STDLIB8) -filelist $(MISC)/$(@:b).list > $(MISC)/$(TARGET).$(@:b)_8.cmd
1990    @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \
1991        `cat $(MISC)/$(TARGET).$(@:b)_8.cmd` \
1992        >> $(MISC)/$(TARGET).$(@:b)_8.cmd
1993  .IF "$(VERBOSE)" == "TRUE"
1994	@cat $(MISC)/$(TARGET).$(@:b)_8.cmd
1995  .ENDIF
1996	@+source $(MISC)/$(TARGET).$(@:b)_8.cmd
1997# Need to strip __objcInit symbol to avoid duplicate symbols when loading
1998# libraries at runtime
1999	@-$(CC_PATH)nm $@ | grep -v ' U ' | $(AWK) '{ print $$NF }' | grep -F -x '__objcInit' > $(MISC)/$(@:b).strip
2000	@$(CC_PATH)strip -i -R $(MISC)/$(@:b).strip -X $@
2001	@ls -l $@
2002    @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \
2003        app $(APP8RPATH) $@
2004.IF "$(TARGETTYPE)"=="GUI"
2005	@echo "Making:   " $(@:f).app
2006	@macosx-create-bundle $@
2007.ENDIF		# "$(TARGETTYPE)"=="GUI"
2008.ELSE		# "$(OS)"=="MACOSX"
2009	@echo unx
2010	@-$(RM) $(MISC)/$(TARGET).$(@:b)_8.cmd
2011	@echo $(APP8LINKER) $(APP8LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
2012	$(APP8OBJS:s/.obj/.o/) '\' >  $(MISC)/$(TARGET).$(@:b)_8.cmd
2013	@cat $(mktmp /dev/null $(APP8LIBS)) | xargs -n 1 cat | sed s\#$(ROUT)\#$(OUT)\#g | sed 's#$$# \\#'  >> $(MISC)/$(TARGET).$(@:b)_8.cmd
2014	@echo $(APP8LINKTYPEFLAG) $(APP8LIBSALCPPRT) $(APP8STDLIBS) $(APP8STDLIB) $(STDLIB8) -o $@ >> $(MISC)/$(TARGET).$(@:b)_8.cmd
2015  .IF "$(VERBOSE)" == "TRUE"
2016	@cat $(MISC)/$(TARGET).$(@:b)_8.cmd
2017  .ENDIF
2018	@+source $(MISC)/$(TARGET).$(@:b)_8.cmd
2019  .IF "$(VERBOSE)" == "TRUE"
2020	@ls -l $@
2021  .ENDIF
2022.ENDIF		# "$(OS)"=="MACOSX"
2023.ENDIF
2024.IF "$(GUI)" == "WNT"
2025	@@-$(MKDIR) $(@:d:d)
2026.IF "$(APP8LINKRES)" != ""
2027	@@-$(RM) $(MISC)/$(APP8LINKRES:b).rc
2028.IF "$(APP8ICON)" != ""
2029	@-echo 1 ICON $(EMQ)"$(APP8ICON:s/\/\\/)$(EMQ)" >> $(MISC)/$(APP8LINKRES:b).rc
2030.ENDIF		# "$(APP8ICON)" != ""
2031.IF "$(APP8VERINFO)" != ""
2032	@-echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP8LINKRES:b).rc
2033	@-echo $(EMQ)#include  $(EMQ)"$(APP8VERINFO)$(EMQ)" >> $(MISC)/$(APP8LINKRES:b).rc
2034.ENDIF		# "$(APP8VERINFO)" != ""
2035	$(COMMAND_ECHO)$(RC) -DWIN32 $(APP8PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP8LINKRES:b).rc
2036.ENDIF			# "$(APP8LINKRES)" != ""
2037.IF "$(COM)" == "GCC"
2038	@echo mingw
2039.IF "$(APP8LINKRES)" != "" || "$(APP8RES)" != ""
2040	@cat $(APP8LINKRES) $(subst,/res/,/res{$(subst,$(BIN), $(@:d))} $(APP8RES)) >  $(MISC)/$(@:b)_all.res
2041	windres $(MISC)/$(@:b)_all.res $(APP8RESO)
2042.ENDIF
2043	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSAPP) $(MINGWSSTDOBJ) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
2044		$(APP8BASEX) $(APP8STACKN) -o $@ $(APP8OBJS) \
2045		-Wl,-Map,$(MISC)/$(@:b).map $(STDOBJ) $(APP8RESO) \
2046		`$(TYPE) /dev/null $(APP8LIBS) | sed s#$(ROUT)#$(OUT)#g` \
2047		$(APP_LINKTYPE) $(APP8LIBSALCPPRT) \
2048		-Wl,--start-group $(APP8STDLIBS) -Wl,--end-group $(APP8STDLIB) \
2049		$(STDLIB8) $(MINGWSSTDENDOBJ) > $(MISC)/$(TARGET).$(@:b)_8.cmd
2050  # need this empty line, else dmake somehow gets confused by the .IFs and .ENDIFs
2051  .IF "$(VERBOSE)" == "TRUE"
2052	@$(TYPE)  $(MISC)/$(TARGET).$(@:b)_8.cmd
2053  .ENDIF
2054	@+source $(MISC)/$(TARGET).$(@:b)_8.cmd
2055	@ls -l $@
2056.ELSE	# "$(COM)" == "GCC"
2057.IF "$(linkinc)" == ""
2058	$(COMMAND_ECHO)$(APP8LINKER) @$(mktmp \
2059		$(APP8LINKFLAGS) \
2060		$(LINKFLAGSAPP) $(APP8BASEX) \
2061		$(APP8STACKN) \
2062		-out:$@ \
2063		-map:$(MISC)/{$(subst,/,_ $(APP8TARGET)).map} \
2064		$(STDOBJ) \
2065		$(APP8LINKRES) \
2066		$(APP8RES) \
2067		$(APP8OBJS) \
2068		$(APP8LIBS) \
2069		$(APP8STDLIBS) \
2070		$(APP8STDLIB) $(STDLIB8) \
2071		)
2072	@-echo linking $@.manifest ...
2073.IF "$(VISTA_MANIFEST)"!=""
2074	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
2075	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);1 $(FI)
2076.ELSE
2077	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);1 $(FI)
2078.ENDIF # "$(VISTA_MANIFEST)"!=""
2079	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
2080	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
2081.ELSE
2082		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP8TARGET).lnk
2083		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP8TARGET).lst
2084		$(COMMAND_ECHO)-$(RM) $(MISC)\linkobj.lst
2085		for %_i in ($(MISC)\*.obj) do type %_i >> $(MISC)\linkobj.lst
2086	type $(mktmp,$(MISC)\$(APP8TARGET).lst
2087		$(APP8LINKFLAGS) \
2088		$(LINKFLAGSAPP) $(APP8BASEX) \
2089		$(APP8STACKN) \
2090		-out:$@ \
2091		$(STDOBJ) \
2092		$(APP8LINKRES) \
2093		$(APP8RES) \
2094		$(APP8OBJS) \
2095		$(APP8LIBS) \
2096		$(APP8STDLIBS) \
2097		$(APP8STDLIB) $(STDLIB8))
2098		$(COMMAND_ECHO)$(SED)$(SED) -e 's/\(\.\.\\\)\{2,4\}/..\\/g' $(MISC)\$(APP8TARGETN:b)_linkobj.lst >> $(MISC)\$(APP8TARGET).lst
2099		$(COMMAND_ECHO)$(SED)$(IFEXIST) $(MISC)/$(APP8TARGET).lst $(THEN) type $(MISC)/$(APP8TARGET).lst  >> $(MISC)/$(APP8TARGET).lnk $(FI)
2100		$(COMMAND_ECHO)$(SED)$(APP8LINKER) @$(MISC)\$(APP8TARGET).lnk
2101.ENDIF		# "$(linkinc)" == ""
2102.ENDIF		# "$(COM)" == "GCC"
2103.IF "$(APP8TARGET)" == "loader"
2104	$(COMMAND_ECHO)$(PERL) loader.pl $@
2105	$(COMMAND_ECHO)$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
2106	$(COMMAND_ECHO)$(RM) $@
2107	$(COMMAND_ECHO)$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
2108.ENDIF			# "$(TARGET)" == "setup"
2109
2110.ENDIF			# "$(GUI)" == "WNT"
2111
2112.IF "$(GUI)" == "OS2"
2113	@+-$(MKDIR) $(@:d:d) > $(NULLDEV)
2114.IF "$(APP8LINKRES)" != ""
2115	@+-$(RM) $(MISC)/$(APP8LINKRES:b).rc > $(NULLDEV)
2116.IF "$(APP8ICON)" != ""
2117	@-+echo ICON 1 $(EMQ)"$(APP8ICON:s#/#\\\\#)$(EMQ)" >> $(MISC)$/$(APP8LINKRES:b).rc
2118.ENDIF		# "$(APP8ICON)" != ""
2119.IF "$(APP8VERINFO)" != ""
2120	@-+echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP8LINKRES:b).rc
2121	@-+echo $(EMQ)#include  $(EMQ)"$(APP8VERINFO)$(EMQ)" >> $(MISC)/$(APP8LINKRES:b).rc
2122.ENDIF		# "$(APP8VERINFO)" != ""
2123	$(COMMAND_ECHO)$(RC) -r -DOS2 $(APP8PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP8LINKRES:b).rc
2124.ENDIF			# "$(APP8LINKRES)" != ""
2125
2126.IF "$(TARGETTYPE)" == "GUI"
2127	@echo NAME $(APP8TARGET) WINDOWAPI > $(MISC)/$(APP8TARGET).def
2128.ENDIF
2129
2130	$(COMMAND_ECHO)$(APP8LINKER) -v \
2131		$(APP8LINKFLAGS) \
2132		$(LINKFLAGSAPP) $(APP8BASEX) \
2133		$(APP8STACKN) \
2134		-o $@ \
2135		-Zmap -L$(LB) \
2136		-L$(SOLARVERSION)/$(INPATH)/lib \
2137		$(STDOBJ) \
2138		$(APP8LINKRES) \
2139		$(APP8RES) \
2140		$(APP8DEF) \
2141		$(APP8OBJS) \
2142		$(APP8LIBS) \
2143		$(APP8STDLIBS) \
2144		$(APP8STDLIB) $(STDLIB8)
2145
2146
2147.IF "$(APP8TARGET)" == "loader"
2148	$(COMMAND_ECHO)+$(PERL) loader.pl $@
2149	$(COMMAND_ECHO)+$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
2150	$(COMMAND_ECHO)+$(RM) $@
2151	$(COMMAND_ECHO)+$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
2152.ENDIF			# "$(TARGET)" == "setup"
2153
2154.ENDIF			# "$(GUI)" == "OS2"
2155
2156.ENDIF			# "$(APP8TARGETN)"!=""
2157
2158# New rule for automatic run targets of unit test targets
2159.IF "$(APP8TEST)" == "enabled" &&  "$(APP8TARGET)" != ""
2160
2161$(APP8TARGET)_run: $(APP8TARGETN)
2162	$(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP8TARGETN) --gtest_output="xml:$(BIN)/$(APP8TARGET)_result.xml"
2163
2164.ENDIF
2165
2166
2167# Instruction for linking
2168# unroll begin
2169
2170.IF "$(GUI)" == "OS2" && "$(TARGETTYPE)" == "GUI"
2171APP9DEF = $(MISC)/$(APP9TARGET).def
2172.ENDIF
2173
2174.IF "$(APP9LINKTYPE)" != ""
2175#must be either STATIC or SHARED
2176APP9LINKTYPEFLAG=$(APPLINK$(APP9LINKTYPE))
2177.ENDIF
2178
2179# decide how to link
2180.IF "$(APP9CODETYPE)"=="C"
2181APP9LINKER=$(LINKC)
2182APP9STDLIB=$(subst,CPPRUNTIME, $(STDLIB))
2183APP9LINKFLAGS+=$(LINKCFLAGS)
2184.ELSE			# "$(APP9CODETYPE)"=="C"
2185APP9LINKER=$(LINK)
2186APP9STDLIB=$(subst,CPPRUNTIME,$(STDLIBCPP) $(STDLIB))
2187APP9LINKFLAGS+=$(LINKFLAGS)
2188.ENDIF			# "$(APP9CODETYPE)"=="C"
2189
2190APP9RPATH*=OOO
2191LINKFLAGSRUNPATH_$(APP9RPATH)*=/ERROR:/Bad_APP9RPATH_value
2192.IF "$(OS)" != "MACOSX"
2193APP9LINKFLAGS+=$(LINKFLAGSRUNPATH_$(APP9RPATH))
2194.ENDIF
2195
2196.IF "$(APP9STACK)" != ""
2197.IF "$(LINKFLAGSTACK)" != ""
2198APP9STACKN=$(LINKFLAGSTACK)$(APP9STACK)
2199.ENDIF
2200.ELSE
2201APP9STACKN=
2202.ENDIF
2203
2204.IF "$(APP9NOSAL)"==""
2205.IF "$(TARGETTYPE)" == "GUI"
2206APP9OBJS+= $(STDOBJVCL)
2207.ENDIF
2208.ENDIF
2209
2210.IF "$(GUI)$(COM)" == "WNTGCC"
2211APP9RESO=
2212.IF "$(APP9LINKRES)" != "" || "$(APP9RES)" != ""
2213APP9RESO=$(MISC)/$(APP9TARGET:b)_res.o
2214.ENDIF
2215.ENDIF
2216
2217.IF "$(GUI)" == "UNX"
2218APP9DEPN+:=$(APP9DEPNU)
2219USE_APP9DEF=
2220.ENDIF
2221
2222.IF "$(APP9TARGETN)"!=""
2223
2224.IF "$(APP9PRODUCTNAME)"!=""
2225APP9PRODUCTDEF+:=-DPRODUCT_NAME=\"$(APP9PRODUCTNAME)\"
2226.ENDIF			# "$(APP9PRODUCTNAME)"!=""
2227
2228.IF "$(linkinc)"!=""
2229.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
2230.IF "$(APP9LIBS)"!=""
2231$(MISC)/$(APP9TARGET)_linkinc.ls .PHONY:
2232	@@-$(RM) $@
2233	sed -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(APP9LIBS) $(i:s/.lib/.lin/)) >> $@
2234.ENDIF          #"$(APP9LIBS)"!=""
2235.ENDIF
2236
2237LINKINCTARGETS+=$(MISC)/$(APP9TARGETN:b)_linkinc.ls
2238$(APP9TARGETN) : $(LINKINCTARGETS)
2239.ENDIF          # "$(linkinc)"!=""
2240
2241# Allow for target specific LIBSALCPPRT override
2242APP9LIBSALCPPRT*=$(LIBSALCPPRT)
2243
2244$(APP9TARGETN): $(APP9OBJS) $(APP9LIBS) \
2245	$(APP9RES) \
2246	$(APP9ICON) $(APP9DEPN) $(USE_APP9DEF)
2247	@echo "Making:   " $(@:f)
2248.IF "$(GUI)"=="UNX"
2249.IF "$(OS)"=="MACOSX"
2250	@echo unx
2251	@-$(RM) $(MISC)/$(@:b).list
2252	@-$(RM) $(MISC)/$(TARGET).$(@:b)_9.cmd
2253	@-$(RM) $(MISC)/$(@:b).strip
2254	@echo $(STDSLO) $(APP9OBJS:s/.obj/.o/) \
2255	`cat /dev/null $(APP9LIBS) | sed s\#$(ROUT)\#$(OUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list
2256	@echo -n $(APP9LINKER) $(APP9LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) -o $@ \
2257	$(APP9LINKTYPEFLAG) $(APP9STDLIBS) $(APP9STDLIB) $(STDLIB9) -filelist $(MISC)/$(@:b).list > $(MISC)/$(TARGET).$(@:b)_9.cmd
2258    @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \
2259        `cat $(MISC)/$(TARGET).$(@:b)_9.cmd` \
2260        >> $(MISC)/$(TARGET).$(@:b)_9.cmd
2261  .IF "$(VERBOSE)" == "TRUE"
2262	@cat $(MISC)/$(TARGET).$(@:b)_9.cmd
2263  .ENDIF
2264	@+source $(MISC)/$(TARGET).$(@:b)_9.cmd
2265# Need to strip __objcInit symbol to avoid duplicate symbols when loading
2266# libraries at runtime
2267	@-$(CC_PATH)nm $@ | grep -v ' U ' | $(AWK) '{ print $$NF }' | grep -F -x '__objcInit' > $(MISC)/$(@:b).strip
2268	@$(CC_PATH)strip -i -R $(MISC)/$(@:b).strip -X $@
2269	@ls -l $@
2270    @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \
2271        app $(APP9RPATH) $@
2272.IF "$(TARGETTYPE)"=="GUI"
2273	@echo "Making:   " $(@:f).app
2274	@macosx-create-bundle $@
2275.ENDIF		# "$(TARGETTYPE)"=="GUI"
2276.ELSE		# "$(OS)"=="MACOSX"
2277	@echo unx
2278	@-$(RM) $(MISC)/$(TARGET).$(@:b)_9.cmd
2279	@echo $(APP9LINKER) $(APP9LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
2280	$(APP9OBJS:s/.obj/.o/) '\' >  $(MISC)/$(TARGET).$(@:b)_9.cmd
2281	@cat $(mktmp /dev/null $(APP9LIBS)) | xargs -n 1 cat | sed s\#$(ROUT)\#$(OUT)\#g | sed 's#$$# \\#'  >> $(MISC)/$(TARGET).$(@:b)_9.cmd
2282	@echo $(APP9LINKTYPEFLAG) $(APP9LIBSALCPPRT) $(APP9STDLIBS) $(APP9STDLIB) $(STDLIB9) -o $@ >> $(MISC)/$(TARGET).$(@:b)_9.cmd
2283  .IF "$(VERBOSE)" == "TRUE"
2284	@cat $(MISC)/$(TARGET).$(@:b)_9.cmd
2285  .ENDIF
2286	@+source $(MISC)/$(TARGET).$(@:b)_9.cmd
2287  .IF "$(VERBOSE)" == "TRUE"
2288	@ls -l $@
2289  .ENDIF
2290.ENDIF		# "$(OS)"=="MACOSX"
2291.ENDIF
2292.IF "$(GUI)" == "WNT"
2293	@@-$(MKDIR) $(@:d:d)
2294.IF "$(APP9LINKRES)" != ""
2295	@@-$(RM) $(MISC)/$(APP9LINKRES:b).rc
2296.IF "$(APP9ICON)" != ""
2297	@-echo 1 ICON $(EMQ)"$(APP9ICON:s/\/\\/)$(EMQ)" >> $(MISC)/$(APP9LINKRES:b).rc
2298.ENDIF		# "$(APP9ICON)" != ""
2299.IF "$(APP9VERINFO)" != ""
2300	@-echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP9LINKRES:b).rc
2301	@-echo $(EMQ)#include  $(EMQ)"$(APP9VERINFO)$(EMQ)" >> $(MISC)/$(APP9LINKRES:b).rc
2302.ENDIF		# "$(APP9VERINFO)" != ""
2303	$(COMMAND_ECHO)$(RC) -DWIN32 $(APP9PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP9LINKRES:b).rc
2304.ENDIF			# "$(APP9LINKRES)" != ""
2305.IF "$(COM)" == "GCC"
2306	@echo mingw
2307.IF "$(APP9LINKRES)" != "" || "$(APP9RES)" != ""
2308	@cat $(APP9LINKRES) $(subst,/res/,/res{$(subst,$(BIN), $(@:d))} $(APP9RES)) >  $(MISC)/$(@:b)_all.res
2309	windres $(MISC)/$(@:b)_all.res $(APP9RESO)
2310.ENDIF
2311	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSAPP) $(MINGWSSTDOBJ) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
2312		$(APP9BASEX) $(APP9STACKN) -o $@ $(APP9OBJS) \
2313		-Wl,-Map,$(MISC)/$(@:b).map $(STDOBJ) $(APP9RESO) \
2314		`$(TYPE) /dev/null $(APP9LIBS) | sed s#$(ROUT)#$(OUT)#g` \
2315		$(APP_LINKTYPE) $(APP9LIBSALCPPRT) \
2316		-Wl,--start-group $(APP9STDLIBS) -Wl,--end-group $(APP9STDLIB) \
2317		$(STDLIB9) $(MINGWSSTDENDOBJ) > $(MISC)/$(TARGET).$(@:b)_9.cmd
2318  # need this empty line, else dmake somehow gets confused by the .IFs and .ENDIFs
2319  .IF "$(VERBOSE)" == "TRUE"
2320	@$(TYPE)  $(MISC)/$(TARGET).$(@:b)_9.cmd
2321  .ENDIF
2322	@+source $(MISC)/$(TARGET).$(@:b)_9.cmd
2323	@ls -l $@
2324.ELSE	# "$(COM)" == "GCC"
2325.IF "$(linkinc)" == ""
2326	$(COMMAND_ECHO)$(APP9LINKER) @$(mktmp \
2327		$(APP9LINKFLAGS) \
2328		$(LINKFLAGSAPP) $(APP9BASEX) \
2329		$(APP9STACKN) \
2330		-out:$@ \
2331		-map:$(MISC)/{$(subst,/,_ $(APP9TARGET)).map} \
2332		$(STDOBJ) \
2333		$(APP9LINKRES) \
2334		$(APP9RES) \
2335		$(APP9OBJS) \
2336		$(APP9LIBS) \
2337		$(APP9STDLIBS) \
2338		$(APP9STDLIB) $(STDLIB9) \
2339		)
2340	@-echo linking $@.manifest ...
2341.IF "$(VISTA_MANIFEST)"!=""
2342	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
2343	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);1 $(FI)
2344.ELSE
2345	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);1 $(FI)
2346.ENDIF # "$(VISTA_MANIFEST)"!=""
2347	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
2348	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
2349.ELSE
2350		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP9TARGET).lnk
2351		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP9TARGET).lst
2352		$(COMMAND_ECHO)-$(RM) $(MISC)\linkobj.lst
2353		for %_i in ($(MISC)\*.obj) do type %_i >> $(MISC)\linkobj.lst
2354	type $(mktmp,$(MISC)\$(APP9TARGET).lst
2355		$(APP9LINKFLAGS) \
2356		$(LINKFLAGSAPP) $(APP9BASEX) \
2357		$(APP9STACKN) \
2358		-out:$@ \
2359		$(STDOBJ) \
2360		$(APP9LINKRES) \
2361		$(APP9RES) \
2362		$(APP9OBJS) \
2363		$(APP9LIBS) \
2364		$(APP9STDLIBS) \
2365		$(APP9STDLIB) $(STDLIB9))
2366		$(COMMAND_ECHO)$(SED)$(SED) -e 's/\(\.\.\\\)\{2,4\}/..\\/g' $(MISC)\$(APP9TARGETN:b)_linkobj.lst >> $(MISC)\$(APP9TARGET).lst
2367		$(COMMAND_ECHO)$(SED)$(IFEXIST) $(MISC)/$(APP9TARGET).lst $(THEN) type $(MISC)/$(APP9TARGET).lst  >> $(MISC)/$(APP9TARGET).lnk $(FI)
2368		$(COMMAND_ECHO)$(SED)$(APP9LINKER) @$(MISC)\$(APP9TARGET).lnk
2369.ENDIF		# "$(linkinc)" == ""
2370.ENDIF		# "$(COM)" == "GCC"
2371.IF "$(APP9TARGET)" == "loader"
2372	$(COMMAND_ECHO)$(PERL) loader.pl $@
2373	$(COMMAND_ECHO)$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
2374	$(COMMAND_ECHO)$(RM) $@
2375	$(COMMAND_ECHO)$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
2376.ENDIF			# "$(TARGET)" == "setup"
2377
2378.ENDIF			# "$(GUI)" == "WNT"
2379
2380.IF "$(GUI)" == "OS2"
2381	@+-$(MKDIR) $(@:d:d) > $(NULLDEV)
2382.IF "$(APP9LINKRES)" != ""
2383	@+-$(RM) $(MISC)/$(APP9LINKRES:b).rc > $(NULLDEV)
2384.IF "$(APP9ICON)" != ""
2385	@-+echo ICON 1 $(EMQ)"$(APP9ICON:s#/#\\\\#)$(EMQ)" >> $(MISC)$/$(APP9LINKRES:b).rc
2386.ENDIF		# "$(APP9ICON)" != ""
2387.IF "$(APP9VERINFO)" != ""
2388	@-+echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP9LINKRES:b).rc
2389	@-+echo $(EMQ)#include  $(EMQ)"$(APP9VERINFO)$(EMQ)" >> $(MISC)/$(APP9LINKRES:b).rc
2390.ENDIF		# "$(APP9VERINFO)" != ""
2391	$(COMMAND_ECHO)$(RC) -r -DOS2 $(APP9PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP9LINKRES:b).rc
2392.ENDIF			# "$(APP9LINKRES)" != ""
2393
2394.IF "$(TARGETTYPE)" == "GUI"
2395	@echo NAME $(APP9TARGET) WINDOWAPI > $(MISC)/$(APP9TARGET).def
2396.ENDIF
2397
2398	$(COMMAND_ECHO)$(APP9LINKER) -v \
2399		$(APP9LINKFLAGS) \
2400		$(LINKFLAGSAPP) $(APP9BASEX) \
2401		$(APP9STACKN) \
2402		-o $@ \
2403		-Zmap -L$(LB) \
2404		-L$(SOLARVERSION)/$(INPATH)/lib \
2405		$(STDOBJ) \
2406		$(APP9LINKRES) \
2407		$(APP9RES) \
2408		$(APP9DEF) \
2409		$(APP9OBJS) \
2410		$(APP9LIBS) \
2411		$(APP9STDLIBS) \
2412		$(APP9STDLIB) $(STDLIB9)
2413
2414
2415.IF "$(APP9TARGET)" == "loader"
2416	$(COMMAND_ECHO)+$(PERL) loader.pl $@
2417	$(COMMAND_ECHO)+$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
2418	$(COMMAND_ECHO)+$(RM) $@
2419	$(COMMAND_ECHO)+$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
2420.ENDIF			# "$(TARGET)" == "setup"
2421
2422.ENDIF			# "$(GUI)" == "OS2"
2423
2424.ENDIF			# "$(APP9TARGETN)"!=""
2425
2426# New rule for automatic run targets of unit test targets
2427.IF "$(APP9TEST)" == "enabled" &&  "$(APP9TARGET)" != ""
2428
2429$(APP9TARGET)_run: $(APP9TARGETN)
2430	$(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP9TARGETN) --gtest_output="xml:$(BIN)/$(APP9TARGET)_result.xml"
2431
2432.ENDIF
2433
2434
2435# Instruction for linking
2436# unroll begin
2437
2438.IF "$(GUI)" == "OS2" && "$(TARGETTYPE)" == "GUI"
2439APP10DEF = $(MISC)/$(APP10TARGET).def
2440.ENDIF
2441
2442.IF "$(APP10LINKTYPE)" != ""
2443#must be either STATIC or SHARED
2444APP10LINKTYPEFLAG=$(APPLINK$(APP10LINKTYPE))
2445.ENDIF
2446
2447# decide how to link
2448.IF "$(APP10CODETYPE)"=="C"
2449APP10LINKER=$(LINKC)
2450APP10STDLIB=$(subst,CPPRUNTIME, $(STDLIB))
2451APP10LINKFLAGS+=$(LINKCFLAGS)
2452.ELSE			# "$(APP10CODETYPE)"=="C"
2453APP10LINKER=$(LINK)
2454APP10STDLIB=$(subst,CPPRUNTIME,$(STDLIBCPP) $(STDLIB))
2455APP10LINKFLAGS+=$(LINKFLAGS)
2456.ENDIF			# "$(APP10CODETYPE)"=="C"
2457
2458APP10RPATH*=OOO
2459LINKFLAGSRUNPATH_$(APP10RPATH)*=/ERROR:/Bad_APP10RPATH_value
2460.IF "$(OS)" != "MACOSX"
2461APP10LINKFLAGS+=$(LINKFLAGSRUNPATH_$(APP10RPATH))
2462.ENDIF
2463
2464.IF "$(APP10STACK)" != ""
2465.IF "$(LINKFLAGSTACK)" != ""
2466APP10STACKN=$(LINKFLAGSTACK)$(APP10STACK)
2467.ENDIF
2468.ELSE
2469APP10STACKN=
2470.ENDIF
2471
2472.IF "$(APP10NOSAL)"==""
2473.IF "$(TARGETTYPE)" == "GUI"
2474APP10OBJS+= $(STDOBJVCL)
2475.ENDIF
2476.ENDIF
2477
2478.IF "$(GUI)$(COM)" == "WNTGCC"
2479APP10RESO=
2480.IF "$(APP10LINKRES)" != "" || "$(APP10RES)" != ""
2481APP10RESO=$(MISC)/$(APP10TARGET:b)_res.o
2482.ENDIF
2483.ENDIF
2484
2485.IF "$(GUI)" == "UNX"
2486APP10DEPN+:=$(APP10DEPNU)
2487USE_APP10DEF=
2488.ENDIF
2489
2490.IF "$(APP10TARGETN)"!=""
2491
2492.IF "$(APP10PRODUCTNAME)"!=""
2493APP10PRODUCTDEF+:=-DPRODUCT_NAME=\"$(APP10PRODUCTNAME)\"
2494.ENDIF			# "$(APP10PRODUCTNAME)"!=""
2495
2496.IF "$(linkinc)"!=""
2497.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
2498.IF "$(APP10LIBS)"!=""
2499$(MISC)/$(APP10TARGET)_linkinc.ls .PHONY:
2500	@@-$(RM) $@
2501	sed -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(APP10LIBS) $(i:s/.lib/.lin/)) >> $@
2502.ENDIF          #"$(APP10LIBS)"!=""
2503.ENDIF
2504
2505LINKINCTARGETS+=$(MISC)/$(APP10TARGETN:b)_linkinc.ls
2506$(APP10TARGETN) : $(LINKINCTARGETS)
2507.ENDIF          # "$(linkinc)"!=""
2508
2509# Allow for target specific LIBSALCPPRT override
2510APP10LIBSALCPPRT*=$(LIBSALCPPRT)
2511
2512$(APP10TARGETN): $(APP10OBJS) $(APP10LIBS) \
2513	$(APP10RES) \
2514	$(APP10ICON) $(APP10DEPN) $(USE_APP10DEF)
2515	@echo "Making:   " $(@:f)
2516.IF "$(GUI)"=="UNX"
2517.IF "$(OS)"=="MACOSX"
2518	@echo unx
2519	@-$(RM) $(MISC)/$(@:b).list
2520	@-$(RM) $(MISC)/$(TARGET).$(@:b)_10.cmd
2521	@-$(RM) $(MISC)/$(@:b).strip
2522	@echo $(STDSLO) $(APP10OBJS:s/.obj/.o/) \
2523	`cat /dev/null $(APP10LIBS) | sed s\#$(ROUT)\#$(OUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list
2524	@echo -n $(APP10LINKER) $(APP10LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) -o $@ \
2525	$(APP10LINKTYPEFLAG) $(APP10STDLIBS) $(APP10STDLIB) $(STDLIB10) -filelist $(MISC)/$(@:b).list > $(MISC)/$(TARGET).$(@:b)_10.cmd
2526    @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \
2527        `cat $(MISC)/$(TARGET).$(@:b)_10.cmd` \
2528        >> $(MISC)/$(TARGET).$(@:b)_10.cmd
2529  .IF "$(VERBOSE)" == "TRUE"
2530	@cat $(MISC)/$(TARGET).$(@:b)_10.cmd
2531  .ENDIF
2532	@+source $(MISC)/$(TARGET).$(@:b)_10.cmd
2533# Need to strip __objcInit symbol to avoid duplicate symbols when loading
2534# libraries at runtime
2535	@-$(CC_PATH)nm $@ | grep -v ' U ' | $(AWK) '{ print $$NF }' | grep -F -x '__objcInit' > $(MISC)/$(@:b).strip
2536	@$(CC_PATH)strip -i -R $(MISC)/$(@:b).strip -X $@
2537	@ls -l $@
2538    @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \
2539        app $(APP10RPATH) $@
2540.IF "$(TARGETTYPE)"=="GUI"
2541	@echo "Making:   " $(@:f).app
2542	@macosx-create-bundle $@
2543.ENDIF		# "$(TARGETTYPE)"=="GUI"
2544.ELSE		# "$(OS)"=="MACOSX"
2545	@echo unx
2546	@-$(RM) $(MISC)/$(TARGET).$(@:b)_10.cmd
2547	@echo $(APP10LINKER) $(APP10LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
2548	$(APP10OBJS:s/.obj/.o/) '\' >  $(MISC)/$(TARGET).$(@:b)_10.cmd
2549	@cat $(mktmp /dev/null $(APP10LIBS)) | xargs -n 1 cat | sed s\#$(ROUT)\#$(OUT)\#g | sed 's#$$# \\#'  >> $(MISC)/$(TARGET).$(@:b)_10.cmd
2550	@echo $(APP10LINKTYPEFLAG) $(APP10LIBSALCPPRT) $(APP10STDLIBS) $(APP10STDLIB) $(STDLIB10) -o $@ >> $(MISC)/$(TARGET).$(@:b)_10.cmd
2551  .IF "$(VERBOSE)" == "TRUE"
2552	@cat $(MISC)/$(TARGET).$(@:b)_10.cmd
2553  .ENDIF
2554	@+source $(MISC)/$(TARGET).$(@:b)_10.cmd
2555  .IF "$(VERBOSE)" == "TRUE"
2556	@ls -l $@
2557  .ENDIF
2558.ENDIF		# "$(OS)"=="MACOSX"
2559.ENDIF
2560.IF "$(GUI)" == "WNT"
2561	@@-$(MKDIR) $(@:d:d)
2562.IF "$(APP10LINKRES)" != ""
2563	@@-$(RM) $(MISC)/$(APP10LINKRES:b).rc
2564.IF "$(APP10ICON)" != ""
2565	@-echo 1 ICON $(EMQ)"$(APP10ICON:s/\/\\/)$(EMQ)" >> $(MISC)/$(APP10LINKRES:b).rc
2566.ENDIF		# "$(APP10ICON)" != ""
2567.IF "$(APP10VERINFO)" != ""
2568	@-echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP10LINKRES:b).rc
2569	@-echo $(EMQ)#include  $(EMQ)"$(APP10VERINFO)$(EMQ)" >> $(MISC)/$(APP10LINKRES:b).rc
2570.ENDIF		# "$(APP10VERINFO)" != ""
2571	$(COMMAND_ECHO)$(RC) -DWIN32 $(APP10PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP10LINKRES:b).rc
2572.ENDIF			# "$(APP10LINKRES)" != ""
2573.IF "$(COM)" == "GCC"
2574	@echo mingw
2575.IF "$(APP10LINKRES)" != "" || "$(APP10RES)" != ""
2576	@cat $(APP10LINKRES) $(subst,/res/,/res{$(subst,$(BIN), $(@:d))} $(APP10RES)) >  $(MISC)/$(@:b)_all.res
2577	windres $(MISC)/$(@:b)_all.res $(APP10RESO)
2578.ENDIF
2579	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSAPP) $(MINGWSSTDOBJ) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
2580		$(APP10BASEX) $(APP10STACKN) -o $@ $(APP10OBJS) \
2581		-Wl,-Map,$(MISC)/$(@:b).map $(STDOBJ) $(APP10RESO) \
2582		`$(TYPE) /dev/null $(APP10LIBS) | sed s#$(ROUT)#$(OUT)#g` \
2583		$(APP_LINKTYPE) $(APP10LIBSALCPPRT) \
2584		-Wl,--start-group $(APP10STDLIBS) -Wl,--end-group $(APP10STDLIB) \
2585		$(STDLIB10) $(MINGWSSTDENDOBJ) > $(MISC)/$(TARGET).$(@:b)_10.cmd
2586  # need this empty line, else dmake somehow gets confused by the .IFs and .ENDIFs
2587  .IF "$(VERBOSE)" == "TRUE"
2588	@$(TYPE)  $(MISC)/$(TARGET).$(@:b)_10.cmd
2589  .ENDIF
2590	@+source $(MISC)/$(TARGET).$(@:b)_10.cmd
2591	@ls -l $@
2592.ELSE	# "$(COM)" == "GCC"
2593.IF "$(linkinc)" == ""
2594	$(COMMAND_ECHO)$(APP10LINKER) @$(mktmp \
2595		$(APP10LINKFLAGS) \
2596		$(LINKFLAGSAPP) $(APP10BASEX) \
2597		$(APP10STACKN) \
2598		-out:$@ \
2599		-map:$(MISC)/{$(subst,/,_ $(APP10TARGET)).map} \
2600		$(STDOBJ) \
2601		$(APP10LINKRES) \
2602		$(APP10RES) \
2603		$(APP10OBJS) \
2604		$(APP10LIBS) \
2605		$(APP10STDLIBS) \
2606		$(APP10STDLIB) $(STDLIB10) \
2607		)
2608	@-echo linking $@.manifest ...
2609.IF "$(VISTA_MANIFEST)"!=""
2610	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
2611	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);1 $(FI)
2612.ELSE
2613	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);1 $(FI)
2614.ENDIF # "$(VISTA_MANIFEST)"!=""
2615	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
2616	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
2617.ELSE
2618		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP10TARGET).lnk
2619		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP10TARGET).lst
2620		$(COMMAND_ECHO)-$(RM) $(MISC)\linkobj.lst
2621		for %_i in ($(MISC)\*.obj) do type %_i >> $(MISC)\linkobj.lst
2622	type $(mktmp,$(MISC)\$(APP10TARGET).lst
2623		$(APP10LINKFLAGS) \
2624		$(LINKFLAGSAPP) $(APP10BASEX) \
2625		$(APP10STACKN) \
2626		-out:$@ \
2627		$(STDOBJ) \
2628		$(APP10LINKRES) \
2629		$(APP10RES) \
2630		$(APP10OBJS) \
2631		$(APP10LIBS) \
2632		$(APP10STDLIBS) \
2633		$(APP10STDLIB) $(STDLIB10))
2634		$(COMMAND_ECHO)$(SED)$(SED) -e 's/\(\.\.\\\)\{2,4\}/..\\/g' $(MISC)\$(APP10TARGETN:b)_linkobj.lst >> $(MISC)\$(APP10TARGET).lst
2635		$(COMMAND_ECHO)$(SED)$(IFEXIST) $(MISC)/$(APP10TARGET).lst $(THEN) type $(MISC)/$(APP10TARGET).lst  >> $(MISC)/$(APP10TARGET).lnk $(FI)
2636		$(COMMAND_ECHO)$(SED)$(APP10LINKER) @$(MISC)\$(APP10TARGET).lnk
2637.ENDIF		# "$(linkinc)" == ""
2638.ENDIF		# "$(COM)" == "GCC"
2639.IF "$(APP10TARGET)" == "loader"
2640	$(COMMAND_ECHO)$(PERL) loader.pl $@
2641	$(COMMAND_ECHO)$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
2642	$(COMMAND_ECHO)$(RM) $@
2643	$(COMMAND_ECHO)$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
2644.ENDIF			# "$(TARGET)" == "setup"
2645
2646.ENDIF			# "$(GUI)" == "WNT"
2647
2648.IF "$(GUI)" == "OS2"
2649	@+-$(MKDIR) $(@:d:d) > $(NULLDEV)
2650.IF "$(APP10LINKRES)" != ""
2651	@+-$(RM) $(MISC)/$(APP10LINKRES:b).rc > $(NULLDEV)
2652.IF "$(APP10ICON)" != ""
2653	@-+echo ICON 1 $(EMQ)"$(APP10ICON:s#/#\\\\#)$(EMQ)" >> $(MISC)$/$(APP10LINKRES:b).rc
2654.ENDIF		# "$(APP10ICON)" != ""
2655.IF "$(APP10VERINFO)" != ""
2656	@-+echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP10LINKRES:b).rc
2657	@-+echo $(EMQ)#include  $(EMQ)"$(APP10VERINFO)$(EMQ)" >> $(MISC)/$(APP10LINKRES:b).rc
2658.ENDIF		# "$(APP10VERINFO)" != ""
2659	$(COMMAND_ECHO)$(RC) -r -DOS2 $(APP10PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP10LINKRES:b).rc
2660.ENDIF			# "$(APP10LINKRES)" != ""
2661
2662.IF "$(TARGETTYPE)" == "GUI"
2663	@echo NAME $(APP10TARGET) WINDOWAPI > $(MISC)/$(APP10TARGET).def
2664.ENDIF
2665
2666	$(COMMAND_ECHO)$(APP10LINKER) -v \
2667		$(APP10LINKFLAGS) \
2668		$(LINKFLAGSAPP) $(APP10BASEX) \
2669		$(APP10STACKN) \
2670		-o $@ \
2671		-Zmap -L$(LB) \
2672		-L$(SOLARVERSION)/$(INPATH)/lib \
2673		$(STDOBJ) \
2674		$(APP10LINKRES) \
2675		$(APP10RES) \
2676		$(APP10DEF) \
2677		$(APP10OBJS) \
2678		$(APP10LIBS) \
2679		$(APP10STDLIBS) \
2680		$(APP10STDLIB) $(STDLIB10)
2681
2682
2683.IF "$(APP10TARGET)" == "loader"
2684	$(COMMAND_ECHO)+$(PERL) loader.pl $@
2685	$(COMMAND_ECHO)+$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
2686	$(COMMAND_ECHO)+$(RM) $@
2687	$(COMMAND_ECHO)+$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
2688.ENDIF			# "$(TARGET)" == "setup"
2689
2690.ENDIF			# "$(GUI)" == "OS2"
2691
2692.ENDIF			# "$(APP10TARGETN)"!=""
2693
2694# New rule for automatic run targets of unit test targets
2695.IF "$(APP10TEST)" == "enabled" &&  "$(APP10TARGET)" != ""
2696
2697$(APP10TARGET)_run: $(APP10TARGETN)
2698	$(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP10TARGETN) --gtest_output="xml:$(BIN)/$(APP10TARGET)_result.xml"
2699
2700.ENDIF
2701
2702
2703# Instruction for linking
2704