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