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