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