xref: /aoo41x/main/solenv/inc/tg_app.mk (revision 7871dc3e)
1*7871dc3eSAndrew Rist#**************************************************************
2*7871dc3eSAndrew Rist#
3*7871dc3eSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
4*7871dc3eSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
5*7871dc3eSAndrew Rist#  distributed with this work for additional information
6*7871dc3eSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
7*7871dc3eSAndrew Rist#  to you under the Apache License, Version 2.0 (the
8*7871dc3eSAndrew Rist#  "License"); you may not use this file except in compliance
9*7871dc3eSAndrew Rist#  with the License.  You may obtain a copy of the License at
10*7871dc3eSAndrew Rist#
11*7871dc3eSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
12*7871dc3eSAndrew Rist#
13*7871dc3eSAndrew Rist#  Unless required by applicable law or agreed to in writing,
14*7871dc3eSAndrew Rist#  software distributed under the License is distributed on an
15*7871dc3eSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*7871dc3eSAndrew Rist#  KIND, either express or implied.  See the License for the
17*7871dc3eSAndrew Rist#  specific language governing permissions and limitations
18*7871dc3eSAndrew Rist#  under the License.
19*7871dc3eSAndrew Rist#
20*7871dc3eSAndrew Rist#**************************************************************
21*7871dc3eSAndrew Rist
22*7871dc3eSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir#######################################################
25cdf0e10cSrcweir# instructions for linking
26cdf0e10cSrcweir# unroll begin
27cdf0e10cSrcweir
28cdf0e10cSrcweir.IF "$(GUI)" == "OS2" && "$(TARGETTYPE)" == "GUI"
29cdf0e10cSrcweirAPP$(TNR)DEF = $(MISC)/$(APP$(TNR)TARGET).def
30cdf0e10cSrcweir.ENDIF
31cdf0e10cSrcweir
32cdf0e10cSrcweir.IF "$(APP$(TNR)LINKTYPE)" != ""
33cdf0e10cSrcweir#must be either STATIC or SHARED
34cdf0e10cSrcweirAPP$(TNR)LINKTYPEFLAG=$(APPLINK$(APP$(TNR)LINKTYPE))
35cdf0e10cSrcweir.ENDIF
36cdf0e10cSrcweir
37cdf0e10cSrcweir# decide how to link
38cdf0e10cSrcweir.IF "$(APP$(TNR)CODETYPE)"=="C"
39cdf0e10cSrcweirAPP$(TNR)LINKER=$(LINKC)
40cdf0e10cSrcweirAPP$(TNR)STDLIB=$(subst,CPPRUNTIME, $(STDLIB))
41cdf0e10cSrcweirAPP$(TNR)LINKFLAGS+=$(LINKCFLAGS)
42cdf0e10cSrcweir.ELSE			# "$(APP$(TNR)CODETYPE)"=="C"
43cdf0e10cSrcweirAPP$(TNR)LINKER=$(LINK)
44cdf0e10cSrcweirAPP$(TNR)STDLIB=$(subst,CPPRUNTIME,$(STDLIBCPP) $(STDLIB))
45cdf0e10cSrcweirAPP$(TNR)LINKFLAGS+=$(LINKFLAGS)
46cdf0e10cSrcweir.ENDIF			# "$(APP$(TNR)CODETYPE)"=="C"
47cdf0e10cSrcweir
48cdf0e10cSrcweirAPP$(TNR)RPATH*=OOO
49cdf0e10cSrcweirLINKFLAGSRUNPATH_$(APP$(TNR)RPATH)*=/ERROR:/Bad_APP$(TNR)RPATH_value
50cdf0e10cSrcweir.IF "$(OS)" != "MACOSX"
51cdf0e10cSrcweirAPP$(TNR)LINKFLAGS+=$(LINKFLAGSRUNPATH_$(APP$(TNR)RPATH))
52cdf0e10cSrcweir.ENDIF
53cdf0e10cSrcweir
54cdf0e10cSrcweir.IF "$(APP$(TNR)STACK)" != ""
55cdf0e10cSrcweir.IF "$(LINKFLAGSTACK)" != ""
56cdf0e10cSrcweirAPP$(TNR)STACKN=$(LINKFLAGSTACK)$(APP$(TNR)STACK)
57cdf0e10cSrcweir.ENDIF
58cdf0e10cSrcweir.ELSE
59cdf0e10cSrcweirAPP$(TNR)STACKN=
60cdf0e10cSrcweir.ENDIF
61cdf0e10cSrcweir
62cdf0e10cSrcweir.IF "$(APP$(TNR)NOSAL)"==""
63cdf0e10cSrcweir.IF "$(TARGETTYPE)" == "GUI"
64cdf0e10cSrcweirAPP$(TNR)OBJS+= $(STDOBJVCL)
65cdf0e10cSrcweir.ENDIF
66cdf0e10cSrcweir.ENDIF
67cdf0e10cSrcweir
68cdf0e10cSrcweir.IF "$(GUI)$(COM)" == "WNTGCC"
69cdf0e10cSrcweirAPP$(TNR)RESO=
70cdf0e10cSrcweir.IF "$(APP$(TNR)LINKRES)" != "" || "$(APP$(TNR)RES)" != ""
71cdf0e10cSrcweirAPP$(TNR)RESO=$(MISC)/$(APP$(TNR)TARGET:b)_res.o
72cdf0e10cSrcweir.ENDIF
73cdf0e10cSrcweir.ENDIF
74cdf0e10cSrcweir
75cdf0e10cSrcweir.IF "$(GUI)" == "UNX"
76cdf0e10cSrcweirAPP$(TNR)DEPN+:=$(APP$(TNR)DEPNU)
77cdf0e10cSrcweirUSE_APP$(TNR)DEF=
78cdf0e10cSrcweir.ENDIF
79cdf0e10cSrcweir
80cdf0e10cSrcweir.IF "$(APP$(TNR)TARGETN)"!=""
81cdf0e10cSrcweir
82cdf0e10cSrcweir.IF "$(APP$(TNR)PRODUCTNAME)"!=""
83cdf0e10cSrcweirAPP$(TNR)PRODUCTDEF+:=-DPRODUCT_NAME=\"$(APP$(TNR)PRODUCTNAME)\"
84cdf0e10cSrcweir.ENDIF			# "$(APP$(TNR)PRODUCTNAME)"!=""
85cdf0e10cSrcweir
86cdf0e10cSrcweir.IF "$(linkinc)"!=""
87cdf0e10cSrcweir.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
88cdf0e10cSrcweir.IF "$(APP$(TNR)LIBS)"!=""
89cdf0e10cSrcweir$(MISC)/$(APP$(TNR)TARGET)_linkinc.ls .PHONY:
90cdf0e10cSrcweir	@@-$(RM) $@
91cdf0e10cSrcweir	sed -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(APP$(TNR)LIBS) $(i:s/.lib/.lin/)) >> $@
92cdf0e10cSrcweir.ENDIF          #"$(APP$(TNR)LIBS)"!=""
93cdf0e10cSrcweir.ENDIF
94cdf0e10cSrcweir
95cdf0e10cSrcweirLINKINCTARGETS+=$(MISC)/$(APP$(TNR)TARGETN:b)_linkinc.ls
96cdf0e10cSrcweir$(APP$(TNR)TARGETN) : $(LINKINCTARGETS)
97cdf0e10cSrcweir.ENDIF          # "$(linkinc)"!=""
98cdf0e10cSrcweir
99cdf0e10cSrcweir# Allow for target specific LIBSALCPPRT override
100cdf0e10cSrcweirAPP$(TNR)LIBSALCPPRT*=$(LIBSALCPPRT)
101cdf0e10cSrcweir
102cdf0e10cSrcweir.IF "$(GUI)" == "OS2"
103cdf0e10cSrcweir_APP$(TNR)IMP_ORD = $(APP$(TNR)STDLIBS:^"$(SOLARVERSION)/$(INPATH)/lib/") $(APP$(TNR)STDLIBS:^"$(LB)/")
104cdf0e10cSrcweirAPP$(TNR)IMP_ORD = $(foreach,i,$(_APP$(TNR)IMP_ORD) $(shell @-ls $i))
105cdf0e10cSrcweir.ELSE
106cdf0e10cSrcweirAPP$(TNR)IMP_ORD =
107cdf0e10cSrcweir.ENDIF
108cdf0e10cSrcweir
109cdf0e10cSrcweir$(APP$(TNR)TARGETN): $(APP$(TNR)OBJS) $(APP$(TNR)LIBS) \
110cdf0e10cSrcweir	$(APP$(TNR)RES) \
111cdf0e10cSrcweir	$(APP$(TNR)IMP_ORD) \
112cdf0e10cSrcweir	$(APP$(TNR)ICON) $(APP$(TNR)DEPN) $(USE_APP$(TNR)DEF)
113cdf0e10cSrcweir	@echo "Making:   " $(@:f)
114cdf0e10cSrcweir.IF "$(GUI)"=="UNX"
115cdf0e10cSrcweir.IF "$(OS)"=="MACOSX"
116cdf0e10cSrcweir	@echo unx
117cdf0e10cSrcweir	@-$(RM) $(MISC)/$(@:b).list
118cdf0e10cSrcweir	@-$(RM) $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
119cdf0e10cSrcweir	@-$(RM) $(MISC)/$(@:b).strip
120cdf0e10cSrcweir	@echo $(STDSLO) $(APP$(TNR)OBJS:s/.obj/.o/) \
121cdf0e10cSrcweir	`cat /dev/null $(APP$(TNR)LIBS) | sed s\#$(ROUT)\#$(OUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list
122cdf0e10cSrcweir	@echo -n $(APP$(TNR)LINKER) $(APP$(TNR)LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) -o $@ \
123cdf0e10cSrcweir	$(APP$(TNR)LINKTYPEFLAG) $(APP$(TNR)STDLIBS) $(APP$(TNR)STDLIB) $(STDLIB$(TNR)) -filelist $(MISC)/$(@:b).list > $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
124cdf0e10cSrcweir    @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \
125cdf0e10cSrcweir        `cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd` \
126cdf0e10cSrcweir        >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
127cdf0e10cSrcweir  .IF "$(VERBOSE)" == "TRUE"
128cdf0e10cSrcweir	@cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
129cdf0e10cSrcweir  .ENDIF
130cdf0e10cSrcweir	@+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
131cdf0e10cSrcweir# Need to strip __objcInit symbol to avoid duplicate symbols when loading
132cdf0e10cSrcweir# libraries at runtime
133cdf0e10cSrcweir	@-nm $@ | grep -v ' U ' | $(AWK) '{ print $$NF }' | grep -F -x '__objcInit' > $(MISC)/$(@:b).strip
134cdf0e10cSrcweir	@strip -i -R $(MISC)/$(@:b).strip -X $@
135cdf0e10cSrcweir	@ls -l $@
136cdf0e10cSrcweir    @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \
137cdf0e10cSrcweir        app $(APP$(TNR)RPATH) $@
138cdf0e10cSrcweir.IF "$(TARGETTYPE)"=="GUI"
139cdf0e10cSrcweir	@echo "Making:   " $(@:f).app
140cdf0e10cSrcweir	@macosx-create-bundle $@
141cdf0e10cSrcweir.ENDIF		# "$(TARGETTYPE)"=="GUI"
142cdf0e10cSrcweir.ELSE		# "$(OS)"=="MACOSX"
143cdf0e10cSrcweir	@echo unx
144cdf0e10cSrcweir	@-$(RM) $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
145cdf0e10cSrcweir	@echo $(APP$(TNR)LINKER) $(APP$(TNR)LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
146cdf0e10cSrcweir	$(APP$(TNR)OBJS:s/.obj/.o/) '\' >  $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
147cdf0e10cSrcweir	@cat $(mktmp /dev/null $(APP$(TNR)LIBS)) | xargs -n 1 cat | sed s\#$(ROUT)\#$(OUT)\#g | sed 's#$$# \\#'  >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
148cdf0e10cSrcweir	@echo $(APP$(TNR)LINKTYPEFLAG) $(APP$(TNR)LIBSALCPPRT) $(APP$(TNR)STDLIBS) $(APP$(TNR)STDLIB) $(STDLIB$(TNR)) -o $@ >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
149cdf0e10cSrcweir  .IF "$(VERBOSE)" == "TRUE"
150cdf0e10cSrcweir	@cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
151cdf0e10cSrcweir  .ENDIF
152cdf0e10cSrcweir	@+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
153cdf0e10cSrcweir  .IF "$(VERBOSE)" == "TRUE"
154cdf0e10cSrcweir	@ls -l $@
155cdf0e10cSrcweir  .ENDIF
156cdf0e10cSrcweir.ENDIF		# "$(OS)"=="MACOSX"
157cdf0e10cSrcweir.ENDIF
158cdf0e10cSrcweir.IF "$(GUI)" == "WNT"
159cdf0e10cSrcweir	@@-$(MKDIR) $(@:d:d)
160cdf0e10cSrcweir.IF "$(APP$(TNR)LINKRES)" != ""
161cdf0e10cSrcweir	@@-$(RM) $(MISC)/$(APP$(TNR)LINKRES:b).rc
162cdf0e10cSrcweir.IF "$(APP$(TNR)ICON)" != ""
163cdf0e10cSrcweir	@-echo 1 ICON $(EMQ)"$(APP$(TNR)ICON:s/\/\\/)$(EMQ)" >> $(MISC)/$(APP$(TNR)LINKRES:b).rc
164cdf0e10cSrcweir.ENDIF		# "$(APP$(TNR)ICON)" != ""
165cdf0e10cSrcweir.IF "$(APP$(TNR)VERINFO)" != ""
166cdf0e10cSrcweir	@-echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP$(TNR)LINKRES:b).rc
167cdf0e10cSrcweir	@-echo $(EMQ)#include  $(EMQ)"$(APP$(TNR)VERINFO)$(EMQ)" >> $(MISC)/$(APP$(TNR)LINKRES:b).rc
168cdf0e10cSrcweir.ENDIF		# "$(APP$(TNR)VERINFO)" != ""
169cdf0e10cSrcweir	$(COMMAND_ECHO)$(RC) -DWIN32 $(APP$(TNR)PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP$(TNR)LINKRES:b).rc
170cdf0e10cSrcweir.ENDIF			# "$(APP$(TNR)LINKRES)" != ""
171cdf0e10cSrcweir.IF "$(COM)" == "GCC"
172cdf0e10cSrcweir	@echo mingw
173cdf0e10cSrcweir.IF "$(APP$(TNR)LINKRES)" != "" || "$(APP$(TNR)RES)" != ""
174cdf0e10cSrcweir	@cat $(APP$(TNR)LINKRES) $(subst,/res/,/res{$(subst,$(BIN), $(@:d))} $(APP$(TNR)RES)) >  $(MISC)/$(@:b)_all.res
175cdf0e10cSrcweir	windres $(MISC)/$(@:b)_all.res $(APP$(TNR)RESO)
176cdf0e10cSrcweir.ENDIF
177cdf0e10cSrcweir	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSAPP) $(MINGWSSTDOBJ) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \
178cdf0e10cSrcweir		$(APP$(TNR)BASEX) $(APP$(TNR)STACKN) -o $@ $(APP$(TNR)OBJS) \
179cdf0e10cSrcweir		-Wl,-Map,$(MISC)/$(@:b).map $(STDOBJ) $(APP$(TNR)RESO) \
180cdf0e10cSrcweir		`$(TYPE) /dev/null $(APP$(TNR)LIBS) | sed s#$(ROUT)#$(OUT)#g` \
181cdf0e10cSrcweir		$(APP_LINKTYPE) $(APP$(TNR)LIBSALCPPRT) \
182cdf0e10cSrcweir		-Wl,--start-group $(APP$(TNR)STDLIBS) -Wl,--end-group $(APP$(TNR)STDLIB) \
183cdf0e10cSrcweir		$(STDLIB$(TNR)) $(MINGWSSTDENDOBJ) > $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
184cdf0e10cSrcweir  # need this empty line, else dmake somehow gets confused by the .IFs and .ENDIFs
185cdf0e10cSrcweir  .IF "$(VERBOSE)" == "TRUE"
186cdf0e10cSrcweir	@$(TYPE)  $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
187cdf0e10cSrcweir  .ENDIF
188cdf0e10cSrcweir	@+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
189cdf0e10cSrcweir	@ls -l $@
190cdf0e10cSrcweir.ELSE	# "$(COM)" == "GCC"
191cdf0e10cSrcweir.IF "$(linkinc)" == ""
192cdf0e10cSrcweir	$(COMMAND_ECHO)$(APP$(TNR)LINKER) @$(mktmp \
193cdf0e10cSrcweir		$(APP$(TNR)LINKFLAGS) \
194cdf0e10cSrcweir		$(LINKFLAGSAPP) $(APP$(TNR)BASEX) \
195cdf0e10cSrcweir		$(APP$(TNR)STACKN) \
196cdf0e10cSrcweir		-out:$@ \
197cdf0e10cSrcweir		-map:$(MISC)/{$(subst,/,_ $(APP$(TNR)TARGET)).map} \
198cdf0e10cSrcweir		$(STDOBJ) \
199cdf0e10cSrcweir		$(APP$(TNR)LINKRES) \
200cdf0e10cSrcweir		$(APP$(TNR)RES) \
201cdf0e10cSrcweir		$(APP$(TNR)OBJS) \
202cdf0e10cSrcweir		$(APP$(TNR)LIBS) \
203cdf0e10cSrcweir		$(APP$(TNR)STDLIBS) \
204cdf0e10cSrcweir		$(APP$(TNR)STDLIB) $(STDLIB$(TNR)) \
205cdf0e10cSrcweir		)
206cdf0e10cSrcweir	@-echo linking $@.manifest ...
207cdf0e10cSrcweir.IF "$(VISTA_MANIFEST)"!=""
208cdf0e10cSrcweir	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
209cdf0e10cSrcweir	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);1 $(FI)
210cdf0e10cSrcweir.ELSE
211cdf0e10cSrcweir	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);1 $(FI)
212cdf0e10cSrcweir.ENDIF # "$(VISTA_MANIFEST)"!=""
213cdf0e10cSrcweir	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
214cdf0e10cSrcweir	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
215cdf0e10cSrcweir.ELSE
216cdf0e10cSrcweir		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP$(TNR)TARGET).lnk
217cdf0e10cSrcweir		$(COMMAND_ECHO)-$(RM) $(MISC)\$(APP$(TNR)TARGET).lst
218cdf0e10cSrcweir		$(COMMAND_ECHO)-$(RM) $(MISC)\linkobj.lst
219cdf0e10cSrcweir		for %_i in ($(MISC)\*.obj) do type %_i >> $(MISC)\linkobj.lst
220cdf0e10cSrcweir	type $(mktmp,$(MISC)\$(APP$(TNR)TARGET).lst
221cdf0e10cSrcweir		$(APP$(TNR)LINKFLAGS) \
222cdf0e10cSrcweir		$(LINKFLAGSAPP) $(APP$(TNR)BASEX) \
223cdf0e10cSrcweir		$(APP$(TNR)STACKN) \
224cdf0e10cSrcweir		-out:$@ \
225cdf0e10cSrcweir		$(STDOBJ) \
226cdf0e10cSrcweir		$(APP$(TNR)LINKRES) \
227cdf0e10cSrcweir		$(APP$(TNR)RES) \
228cdf0e10cSrcweir		$(APP$(TNR)OBJS) \
229cdf0e10cSrcweir		$(APP$(TNR)LIBS) \
230cdf0e10cSrcweir		$(APP$(TNR)STDLIBS) \
231cdf0e10cSrcweir		$(APP$(TNR)STDLIB) $(STDLIB$(TNR)))
232cdf0e10cSrcweir		$(COMMAND_ECHO)$(SED)$(SED) -e 's/\(\.\.\\\)\{2,4\}/..\\/g' $(MISC)\$(APP$(TNR)TARGETN:b)_linkobj.lst >> $(MISC)\$(APP$(TNR)TARGET).lst
233cdf0e10cSrcweir		$(COMMAND_ECHO)$(SED)$(IFEXIST) $(MISC)/$(APP$(TNR)TARGET).lst $(THEN) type $(MISC)/$(APP$(TNR)TARGET).lst  >> $(MISC)/$(APP$(TNR)TARGET).lnk $(FI)
234cdf0e10cSrcweir		$(COMMAND_ECHO)$(SED)$(APP$(TNR)LINKER) @$(MISC)\$(APP$(TNR)TARGET).lnk
235cdf0e10cSrcweir.ENDIF		# "$(linkinc)" == ""
236cdf0e10cSrcweir.ENDIF		# "$(COM)" == "GCC"
237cdf0e10cSrcweir.IF "$(APP$(TNR)TARGET)" == "loader"
238cdf0e10cSrcweir	$(COMMAND_ECHO)$(PERL) loader.pl $@
239cdf0e10cSrcweir	$(COMMAND_ECHO)$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
240cdf0e10cSrcweir	$(COMMAND_ECHO)$(RM) $@
241cdf0e10cSrcweir	$(COMMAND_ECHO)$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
242cdf0e10cSrcweir.ENDIF			# "$(TARGET)" == "setup"
243cdf0e10cSrcweir
244cdf0e10cSrcweir.ENDIF			# "$(GUI)" == "WNT"
245cdf0e10cSrcweir
246cdf0e10cSrcweir.IF "$(GUI)" == "OS2"
247cdf0e10cSrcweir	@+-$(MKDIR) $(@:d:d) >& $(NULLDEV)
248cdf0e10cSrcweir.IF "$(APP$(TNR)LINKRES)" != ""
249cdf0e10cSrcweir	@+-$(RM) $(MISC)/$(APP$(TNR)LINKRES:b).rc >& $(NULLDEV)
250cdf0e10cSrcweir.IF "$(APP$(TNR)ICON)" != ""
251cdf0e10cSrcweir	@-+$(WRAPCMD) echo 1 ICON $(EMQ)"$(APP$(TNR)ICON)$(EMQ)" | $(SED) 'sX\\X\\\\Xg' >> $(MISC)/$(APP$(TNR)LINKRES:b).rc
252cdf0e10cSrcweir.ENDIF		# "$(APP$(TNR)ICON)" != ""
253cdf0e10cSrcweir.IF "$(APP$(TNR)VERINFO)" != ""
254cdf0e10cSrcweir	@-+echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(APP$(TNR)LINKRES:b).rc
255cdf0e10cSrcweir	@-+echo $(EMQ)#include  $(EMQ)"$(APP$(TNR)VERINFO)$(EMQ)" >> $(MISC)/$(APP$(TNR)LINKRES:b).rc
256cdf0e10cSrcweir.ENDIF		# "$(APP$(TNR)VERINFO)" != ""
257cdf0e10cSrcweir	$(COMMAND_ECHO)$(RC) -r -DOS2 $(APP$(TNR)PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP$(TNR)LINKRES:b).rc
258cdf0e10cSrcweir.ENDIF			# "$(APP$(TNR)LINKRES)" != ""
259cdf0e10cSrcweir
260cdf0e10cSrcweir.IF "$(TARGETTYPE)" == "GUI"
261cdf0e10cSrcweir	@echo NAME $(APP$(TNR)TARGET) WINDOWAPI > $(MISC)/$(APP$(TNR)TARGET).def
262cdf0e10cSrcweir.ENDIF
263cdf0e10cSrcweir
264cdf0e10cSrcweir  .IF "$(VERBOSE)" == "TRUE"
265cdf0e10cSrcweir	@+echo	$(APP$(TNR)LINKFLAGS) \
266cdf0e10cSrcweir		$(LINKFLAGSAPP) $(APP$(TNR)BASEX) \
267cdf0e10cSrcweir		$(APP$(TNR)STACKN) \
268cdf0e10cSrcweir		-o $@ \
269cdf0e10cSrcweir		-Zmap -L$(LB) \
270cdf0e10cSrcweir		-L$(SOLARVERSION)/$(INPATH)/lib \
271cdf0e10cSrcweir		$(STDOBJ) \
272cdf0e10cSrcweir		$(APP$(TNR)LINKRES) \
273cdf0e10cSrcweir		$(APP$(TNR)RES) \
274cdf0e10cSrcweir		$(APP$(TNR)DEF) \
275cdf0e10cSrcweir		$(APP$(TNR)OBJS) \
276cdf0e10cSrcweir		$(APP$(TNR)LIBS) \
277cdf0e10cSrcweir		$(APP$(TNR)STDLIBS:^"-l") \
278cdf0e10cSrcweir		$(APP$(TNR)STDLIB:^"-l") $(STDLIB$(TNR):^"-l")
279cdf0e10cSrcweir  .ENDIF
280cdf0e10cSrcweir	$(COMMAND_ECHO)$(APP$(TNR)LINKER) -v \
281cdf0e10cSrcweir		$(APP$(TNR)LINKFLAGS) \
282cdf0e10cSrcweir		$(LINKFLAGSAPP) $(APP$(TNR)BASEX) \
283cdf0e10cSrcweir		$(APP$(TNR)STACKN) \
284cdf0e10cSrcweir		-o $@ \
285cdf0e10cSrcweir		-Zmap -L$(LB) \
286cdf0e10cSrcweir		-L$(SOLARVERSION)/$(INPATH)/lib \
287cdf0e10cSrcweir		$(STDOBJ) \
288cdf0e10cSrcweir		$(APP$(TNR)LINKRES) \
289cdf0e10cSrcweir		$(APP$(TNR)RES) \
290cdf0e10cSrcweir		$(APP$(TNR)DEF) \
291cdf0e10cSrcweir		$(APP$(TNR)OBJS) \
292cdf0e10cSrcweir		$(APP$(TNR)LIBS) \
293cdf0e10cSrcweir		$(APP$(TNR)STDLIBS:^"-l") \
294cdf0e10cSrcweir		$(APP$(TNR)STDLIB:^"-l") $(STDLIB$(TNR):^"-l")
295cdf0e10cSrcweir
296cdf0e10cSrcweir
297cdf0e10cSrcweir.IF "$(APP$(TNR)TARGET)" == "loader"
298cdf0e10cSrcweir	$(COMMAND_ECHO)+$(PERL) loader.pl $@
299cdf0e10cSrcweir	$(COMMAND_ECHO)+$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe
300cdf0e10cSrcweir	$(COMMAND_ECHO)+$(RM) $@
301cdf0e10cSrcweir	$(COMMAND_ECHO)+$(RENAME) $(@:d)_new.exe $(@:d)loader.exe
302cdf0e10cSrcweir.ENDIF			# "$(TARGET)" == "setup"
303cdf0e10cSrcweir
304cdf0e10cSrcweir.ENDIF			# "$(GUI)" == "OS2"
305cdf0e10cSrcweir
306cdf0e10cSrcweir.ENDIF			# "$(APP$(TNR)TARGETN)"!=""
307cdf0e10cSrcweir
308cdf0e10cSrcweir
309cdf0e10cSrcweir# Instruction for linking
310cdf0e10cSrcweir# unroll end
311cdf0e10cSrcweir#######################################################
312cdf0e10cSrcweir
313