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