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