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