xref: /aoo41x/main/solenv/inc/tg_shl.mk (revision 7871dc3e)
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
22
23
24#######################################################
25# targets for linking
26# unroll begin
27
28.IF "$(SHL$(TNR)TARGETN)"!=""
29
30.IF "$(OS)"=="AIX"
31SHL$(TNR)STDLIBS=
32.ENDIF
33
34.IF "$(SHLLINKARCONLY)" != ""
35SHL$(TNR)STDLIBS=
36STDSHL=
37.ELSE
38SHL$(TNR)ARCHIVES=
39.ENDIF
40
41# decide how to link
42.IF "$(SHL$(TNR)CODETYPE)"=="C"
43SHL$(TNR)LINKER=$(LINKC)
44SHL$(TNR)STDSHL=$(subst,CPPRUNTIME, $(STDSHL))
45SHL$(TNR)LINKFLAGS+=$(LINKCFLAGS)
46.ELSE			# "$(SHL$(TNR)CODETYPE)"=="C"
47SHL$(TNR)LINKER=$(LINK)
48SHL$(TNR)STDSHL=$(subst,CPPRUNTIME,$(STDLIBCPP) $(STDSHL))
49SHL$(TNR)LINKFLAGS+=$(LINKFLAGS)
50.ENDIF			# "$(SHL$(TNR)CODETYPE)"=="C"
51
52SHL$(TNR)RPATH*=OOO
53LINKFLAGSRUNPATH_$(SHL$(TNR)RPATH)*=/ERROR:/Bad_SHL$(TNR)RPATH_value
54SHL$(TNR)LINKFLAGS+=$(LINKFLAGSRUNPATH_$(SHL$(TNR)RPATH))
55
56.IF "$(SHL$(TNR)USE_EXPORTS)"==""
57SHL$(TNR)DEF*=$(MISC)/$(SHL$(TNR)TARGET).def
58.ENDIF			# "$(SHL$(TNR)USE_EXPORTS)"==""
59
60EXTRALIBPATHS$(TNR)=$(EXTRALIBPATHS)
61.IF "$(UPDATER)"=="YES"
62.IF "$(SHL$(TNR)NOCHECK)"==""
63.IF "$(SOLAR_STLLIBPATH)"!=""
64EXTRALIBPATHS$(TNR)+=-L$(SOLAR_STLLIBPATH)
65.ENDIF
66.ENDIF				# "$(SHL$(TNR)NOCHECK)"!=""
67.ENDIF
68#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
69#+++++++++++    version object      ++++++++++++++++++++++++++++++++++++++++
70#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
71
72.IF "$(L10N_framework)"==""
73.IF "$(VERSIONOBJ)"!=""
74SHL$(TNR)VERSIONOBJ:=$(VERSIONOBJ:d){$(subst,$(DLLPOSTFIX),_dflt $(SHL$(TNR)TARGET))}$(VERSIONOBJ:f)
75USE_VERSIONH:=$(INCCOM)/$(SHL$(TNR)VERSIONOBJ:b).h
76.IF "$(GUI)" == "UNX"
77SHL$(TNR)VERSIONOBJDEP:=$(VERSIONOBJ:d){$(subst,$(DLLPOSTFIX),_dflt $(SHL$(TNR)TARGET))}$(VERSIONOBJ:f:s/.o/.obj/)
78.ELSE           # "$(GUI)" == "UNX"
79SHL$(TNR)VERSIONOBJDEP:=$(VERSIONOBJ:d){$(subst,$(DLLPOSTFIX),_dflt $(SHL$(TNR)TARGET))}$(VERSIONOBJ:f)
80.ENDIF          # "$(GUI)" == "UNX"
81$(MISC)/$(SHL$(TNR)VERSIONOBJ:b).c : $(SOLARENV)/src/version.c $(INCCOM)/$(SHL$(TNR)VERSIONOBJ:b).h
82#    $(COPY) $(SOLARENV)/src/version.c $@
83	$(COMMAND_ECHO)$(TYPE) $(SOLARENV)/src/version.c | $(SED) s/_version.h/$(SHL$(TNR)VERSIONOBJ:b).h/ > $@
84
85.INIT : $(SHL$(TNR)VERSIONOBJDEP)
86.ENDIF			# "$(VERSIONOBJ)"!=""
87.ENDIF
88
89.IF "$(GUI)" != "UNX"
90.IF "$(GUI)" == "WNT" || "$(GUI)" == "OS2"
91.IF "$(SHL$(TNR)IMPLIB)" == ""
92SHL$(TNR)IMPLIB=i$(TARGET)_t$(TNR)
93.ENDIF			# "$(SHL$(TNR)IMPLIB)" == ""
94.IF "$(COM)" != "GCC"
95USE_$(TNR)IMPLIB=-implib:$(LB)/$(SHL$(TNR)IMPLIB).lib
96.ENDIF			# "$(COM)" != "GCC"
97SHL$(TNR)IMPLIBN=$(LB)/$(SHL$(TNR)IMPLIB).lib
98ALLTAR : $(SHL$(TNR)IMPLIBN)
99
100.IF "$(USE_DEFFILE)"==""
101USE_$(TNR)IMPLIB_DEPS=$(LB)/$(SHL$(TNR)IMPLIB).lib
102.ENDIF			# "$(USE_DEFFILE)"==""
103.ENDIF			# "$(GUI)" == "WNT" || "$(GUI)" == "OS2"
104USE_SHL$(TNR)DEF=$(SHL$(TNR)DEF)
105.ELSE			# "$(GUI)" != "UNX"
106USE_SHL$(TNR)DEF=
107SHL$(TNR)DEPN+:=$(SHL$(TNR)DEPNU)
108
109.IF "$(SHL$(TNR)VERSIONMAP)"==""
110# to activate vmaps remove "#"
111USE_SHL$(TNR)VERSIONMAP=$(MISC)/$(SHL$(TNR)TARGET).vmap
112.ENDIF			# "$(SHL$(TNR)VERSIONMAP)"==""
113
114.IF "$(USE_SHL$(TNR)VERSIONMAP)"!=""
115
116.IF "$(SHL$(TNR)FILTERFILE)"!=""
117.IF "$(SHL$(TNR)VERSIONMAP)"!=""
118#eine von beiden ist zuviel
119USE_SHL$(TNR)VERSIONMAP=$(MISC)/$(SHL$(TNR)TARGET).vmap
120$(USE_SHL$(TNR)VERSIONMAP) .PHONY:
121	@echo -----------------------------
122	@echo you should only use versionmap OR exportfile
123	@echo -----------------------------
124#	force_dmake_to_error
125
126.ENDIF			# "$(SHL$(TNR)VERSIONMAP)"!=""
127
128SHL$(TNR)VERSIONMAPPARA=$(LINKVERSIONMAPFLAG) $(USE_SHL$(TNR)VERSIONMAP)
129
130$(USE_SHL$(TNR)VERSIONMAP): \
131					$(SHL$(TNR)OBJS)\
132					$(SHL$(TNR)LIBS)\
133					$(SHL$(TNR)FILTERFILE)
134	@$(RM) $@.dump
135.IF "$(SHL$(TNR)OBJS)"!=""
136# dump remaining objects on the fly
137.IF "$(OS)"=="MACOSX"
138	@-nm $(SHL$(TNR)OBJS:s/.obj/.o/) > $@.dump
139.ELSE
140	@nm $(SHL$(TNR)OBJS:s/.obj/.o/) > $@.dump
141.ENDIF
142.ENDIF			# "$(SHL$(TNR)OBJS)!"=""
143	@$(TYPE) /dev/null $(SHL$(TNR)LIBS:s/.lib/.dump/) >> $@.dump
144	$(COMMAND_ECHO) $(PERL) $(SOLARENV)/bin/mapgen.pl -d $@.dump -s $(SHL$(TNR)INTERFACE) -f $(SHL$(TNR)FILTERFILE) -m $@
145
146.ELSE			# "$(SHL$(TNR)FILTERFILE)"!=""
147USE_SHL$(TNR)VERSIONMAP=$(MISC)/$(SHL$(TNR)TARGET).vmap
148$(USE_SHL$(TNR)VERSIONMAP) :
149.IF "$(VERBOSE)" == "TRUE"
150	@echo -----------------------------
151	@echo SHL$(TNR)FILTERFILE not set!
152	@echo -----------------------------
153	@$(TOUCH) $@
154	@echo dummy file to keep the dependencies for later use.
155.ELSE
156	@$(TOUCH) $@
157.ENDIF
158#	force_dmake_to_error
159.ENDIF			# "$(SHL$(TNR)FILTERFILE)"!=""
160.ELSE			# "$(USE_SHL$(TNR)VERSIONMAP)"!=""
161
162#and now for the plain non-generic way...
163.IF "$(SHL$(TNR)VERSIONMAP)"!=""
164USE_SHL$(TNR)VERSIONMAP=$(MISC)/$(SHL$(TNR)VERSIONMAP:b)_$(SHL$(TNR)TARGET)$(SHL$(TNR)VERSIONMAP:e)
165SHL$(TNR)VERSIONMAPPARA=$(LINKVERSIONMAPFLAG) $(USE_SHL$(TNR)VERSIONMAP)
166
167.IF "$(OS)"=="MACOSX"
168$(USE_SHL$(TNR)VERSIONMAP): $(SHL$(TNR)OBJS) $(SHL$(TNR)LIBS)
169.ENDIF
170
171# .ERRREMOVE is needed as a recipe line like "$(AWK) ... > $@" would create $@
172# even if the $(AWK) part fails:
173$(USE_SHL$(TNR)VERSIONMAP) .ERRREMOVE: $(SHL$(TNR)VERSIONMAP)
174	@@-$(RM) -f $@
175# The following files will only be generated and needed on Mac OS X as temporary files
176# in order to generate exported symbols list out of Linux/Solaris map files
177.IF "$(OS)"=="MACOSX"
178	@-$(RM) -f $@.symregexp >& $(NULLDEV)
179	@-$(RM) -f $@.expsymlist >& $(NULLDEV)
180.ENDIF
181# Its questionable if the following condition '.IF "$(COMID)"=="gcc3"' makes sense and what
182# happens if somebody will change it in the future
183.IF "$(COMID)"=="gcc3"
184	$(COMMAND_ECHO) tr -d "\015" < $(SHL$(TNR)VERSIONMAP) | $(AWK) -f $(SOLARENV)/bin/addsym.awk > $@
185.ELIF "$(COMNAME)"=="sunpro5"
186	$(COMMAND_ECHO) tr -d "\015" < $(SHL$(TNR)VERSIONMAP) | $(GREP) -v $(IGNORE_SYMBOLS) > $@
187.ELSE           # "$(COMID)"=="gcc3"
188	$(COMMAND_ECHO) tr -d "\015" < $(SHL$(TNR)VERSIONMAP) > $@
189.ENDIF          # "$(COMID)"=="gcc3"
190	@chmod a+w $@
191# Mac OS X post-processing generate an exported symbols list from the generated map file
192# for details on exported symbols list see man ld on Mac OS X
193.IF "$(OS)"=="MACOSX"
194	@-cat $@ | $(AWK) -f $(SOLARENV)/bin/unxmap-to-macosx-explist.awk | grep -v "\*\|?" > $@.exported-symbols
195	@-cat $@ | $(AWK) -f $(SOLARENV)/bin/unxmap-to-macosx-explist.awk | grep "\*\|?" > $@.symbols-regexp
196# Shared libraries will be build out of the *.obj files specified in SHL?OBJS and SHL?LIBS
197# Extract RTTI symbols from all the objects that will be used to build a shared library
198.IF "$(SHL$(TNR)OBJS)"!=""
199	-echo $(foreach,i,$(SHL$(TNR)OBJS:s/.obj/.o/) $i) | xargs -n1 nm -gx | $(SOLARENV)/bin/addsym-macosx.sh $@.symbols-regexp $@.symbols-regexp.tmp >> $@.exported-symbols
200.ENDIF
201.IF "$(SHL$(TNR)LIBS)"!=""
202	$(COMMAND_ECHO)-$(TYPE) $(foreach,j,$(SHL$(TNR)LIBS) $j) | $(SED) s\#$(ROUT)\#$(PRJ)/$(ROUT)\#g | xargs -n1 nm -gx | $(SOLARENV)/bin/addsym-macosx.sh $@.symbols-regexp $@.symbols-regexp.tmp >> $@.exported-symbols
203.ENDIF
204# overwrite the map file generate into the local output tree with the generated
205# exported symbols list
206	cp $@.exported-symbols $@
207.ENDIF # .IF "$(OS)"=="MACOSX"
208.ENDIF			# "$(SHL$(TNR)VERSIONMAP)"!=""
209.ENDIF			# "$(USE_SHL$(TNR)VERSIONMAP)"!=""
210.ENDIF			# "$(GUI)" != "UNX"
211
212.IF "$(UNIXVERSIONNAMES)"!=""
213.IF "$(OS)"!="MACOSX"
214.IF "$(GUI)"=="UNX"
215SHL$(TNR)SONAME=\"$(SONAME_SWITCH)$(SHL$(TNR)TARGETN:f)\"
216.ENDIF			# "$(GUI)"!="UNX"
217.ENDIF			# "$(OS)"!="MACOSX"
218.ENDIF			# "$(UNIXVERSIONNAMES)"!=""
219
220.IF "$(SHL$(TNR)RES)"!=""
221SHL$(TNR)ALLRES+=$(SHL$(TNR)RES)
222SHL$(TNR)LINKRES*=$(MISC)/$(SHL$(TNR)TARGET).res
223SHL$(TNR)LINKRESO*=$(MISC)/$(SHL$(TNR)TARGET)_res.o
224.ENDIF			# "$(SHL$(TNR)RES)"!=""
225
226.IF "$(SHL$(TNR)DEFAULTRES)$(use_shl_versions)"!=""
227SHL$(TNR)DEFAULTRES*=$(MISC)/$(SHL$(TNR)TARGET)_def.res
228SHL$(TNR)ALLRES+=$(SHL$(TNR)DEFAULTRES)
229SHL$(TNR)LINKRES*=$(MISC)/$(SHL$(TNR)TARGET).res
230SHL$(TNR)LINKRESO*=$(MISC)/$(SHL$(TNR)TARGET)_res.o
231.ENDIF			# "$(SHL$(TNR)DEFAULTRES)$(use_shl_versions)"!=""
232
233#.IF "$(SHL$(TNR)TARGETN)"!=""
234
235.IF "$(linkinc)"!=""
236.IF "$(GUI)"=="WNT" || "$(GUI)" == "OS2"
237.IF "$(SHL$(TNR)LIBS)"!=""
238$(MISC)/$(SHL$(TNR)TARGET)_linkinc.ls .PHONY:
239	@@-$(RM) $@
240	$(COMMAND_ECHO)$(SED) -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(SHL$(TNR)LIBS) $(i:s/.lib/.lin/)) >> $@
241.ENDIF          # "$(SHL$(TNR)LIBS)"!=""
242.ENDIF
243
244LINKINCTARGETS+=$(MISC)/$(SHL$(TNR)TARGETN:b)_linkinc.ls
245$(SHL$(TNR)TARGETN) : $(LINKINCTARGETS)
246
247.ELSE
248.IF "$(SHL$(TNR)USE_EXPORTS)"=="name"
249.IF "$(GUI)"=="WNT" || "$(GUI)" == "OS2"
250.IF "$(COM)"!="GCC"
251.IF "$(SHL$(TNR)LIBS)"!=""
252SHL$(TNR)LINKLIST=$(MISC)/$(SHL$(TNR)TARGET)_link.lst
253SHL$(TNR)LINKLISTPARAM=@$(SHL$(TNR)LINKLIST)
254$(SHL$(TNR)LINKLIST) : $(SHL$(TNR)LIBS)
255    @@-$(RM) $@
256	$(COMMAND_ECHO)$(SED) -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(SHL$(TNR)LIBS) $(i:s/.lib/.lin/)) >> $@
257.ENDIF          # "$(SHL$(TNR)LIBS)"!=""
258.ENDIF          # "$(COM)"!="GCC"
259.ENDIF
260.ENDIF			# "$(SHL$(TNR)USE_EXPORTS)"=="name"
261
262$(MISC)/%linkinc.ls:
263	@echo . > $@
264.ENDIF          # "$(linkinc)"!=""
265
266.IF "$(GUI)" == "OS2"
267#21/02/2006 YD dll names must be 8.3, invoke fix script
268#check osl/os2/module.c/osl_loadModule()
269SHL$(TNR)TARGET8=$(shell @fix_shl $(SHL$(TNR)TARGET))
270.ENDIF
271
272.IF "$(GUI)" == "OS2"
273_SHL$(TNR)IMP_ORD = $(SHL$(TNR)STDLIBS:^"$(SOLARVERSION)/$(INPATH)/lib/") $(SHL$(TNR)STDLIBS:^"$(LB)/")
274SHL$(TNR)IMP_ORD = $(foreach,i,$(_SHL$(TNR)IMP_ORD) $(shell @-ls $i))
275.ELSE
276SHL$(TNR)IMP_ORD =
277.ENDIF
278
279
280$(SHL$(TNR)TARGETN) : \
281					$(SHL$(TNR)OBJS)\
282					$(SHL$(TNR)LIBS)\
283					$(USE_$(TNR)IMPLIB_DEPS)\
284					$(USE_SHL$(TNR)DEF)\
285					$(USE_SHL$(TNR)VERSIONMAP)\
286					$(SHL$(TNR)RES)\
287					$(SHL$(TNR)DEPN) \
288					$(SHL$(TNR)IMP_ORD) \
289					$(SHL$(TNR)LINKLIST)
290	@echo "Making:   " $(@:f)
291.IF "$(GUI)" == "WNT"
292.IF "$(SHL$(TNR)DEFAULTRES)"!=""
293	@@-$(RM) $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
294.IF "$(SHL$(TNR)ICON)" != ""
295	@echo 1 ICON $(SHL$(TNR)ICON) >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
296.ENDIF
297.IF "$(use_shl_versions)" != ""
298.IF "$(SHL$(TNR)ADD_VERINFO)"!=""
299	@echo $(EMQ)#include $(EMQ)"$(SHL$(TNR)ADD_VERINFO)$(EMQ)" >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
300.ELSE			# "$(SHL$(TNR)ADD_VERINFO)"!=""
301	@echo $(EMQ)#define ADDITIONAL_VERINFO1 >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
302	@echo $(EMQ)#define ADDITIONAL_VERINFO2 >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
303	@echo $(EMQ)#define ADDITIONAL_VERINFO3 >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
304.ENDIF			# "$(SHL$(TNR)ADD_VERINFO)"!=""
305	@echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
306	@echo $(EMQ)#define ORG_NAME	$(SHL$(TNR)TARGET)$(DLLPOST) >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
307	@echo $(EMQ)#define INTERNAL_NAME $(SHL$(TNR)TARGET:b) >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
308	@echo $(EMQ)#include $(EMQ)"shlinfo.rc$(EMQ)" >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
309.ENDIF			# "$(use_shl_versions)" != ""
310	$(COMMAND_ECHO)$(RC) -DWIN32 $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
311.ENDIF			# "$(SHL$(TNR)DEFAULTRES)"!=""
312.IF "$(SHL$(TNR)ALLRES)"!=""
313	$(COMMAND_ECHO)$(TYPE) $(SHL$(TNR)ALLRES) > $(SHL$(TNR)LINKRES)
314.IF "$(COM)"=="GCC"
315	windres $(SHL$(TNR)LINKRES) $(SHL$(TNR)LINKRESO)
316.ENDIF			# "$(COM)"=="GCC"
317.ENDIF			# "$(SHL$(TNR)ALLRES)"!=""
318.IF "$(COM)"=="GCC"	# always have to call dlltool explicitly as ld cannot handle # comment in .def
319	@echo dlltool --dllname $(SHL$(TNR)TARGET)$(DLLPOST) \
320		--kill-at \\ > $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
321	@noop $(assign ALL$(TNR)OBJLIST:=$(STDOBJ) $(SHL$(TNR)OBJS) $(SHL$(TNR)LINKRESO) $(shell $(TYPE) /dev/null $(SHL$(TNR)LIBS) | $(SED) s?$(ROUT)?$(PRJ)/$(ROUT)?g))
322.IF "$(DEFLIB$(TNR)NAME)"!=""	# do not have to include objs
323	@noop $(assign DEF$(TNR)OBJLIST:=$(shell $(TYPE) $(foreach,i,$(DEFLIB$(TNR)NAME) $(SLB)/$(i).lib) | sed s?$(ROUT)?$(PRJ)/$(ROUT)?g))
324	@noop $(foreach,i,$(DEF$(TNR)OBJLIST) $(assign ALL$(TNR)OBJLIST:=$(ALL$(TNR)OBJLIST:s?$i??)))
325.ENDIF			# "$(DEFLIB$(TNR)NAME)"!=""
326	@echo	--output-exp $(MISC)/$(@:b)_exp.o \\ >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
327.IF "$(SHL$(TNR)DEF)"!=""
328	@echo	--input-def $(SHL$(TNR)DEF) \\ >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
329.ELSE
330	@echo	$(SHL$(TNR)VERSIONOBJ) $(SHL$(TNR)DESCRIPTIONOBJ) \\ >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
331.ENDIF
332	@echo	$(ALL$(TNR)OBJLIST) >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
333	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSSHL) $(MINGWSSTDOBJ) -o $@ \
334		$(STDOBJ) $(SHL$(TNR)VERSIONOBJ) $(SHL$(TNR)DESCRIPTIONOBJ) $(SHL$(TNR)OBJS) $(SHL$(TNR)LINKRESO) \
335		`$(TYPE) /dev/null $(SHL$(TNR)LIBS) | $(SED) s\#$(ROUT)\#$(PRJ)/$(ROUT)\#g` \
336		-Wl,--exclude-libs,ALL,--start-group $(SHL$(TNR)STDLIBS) -Wl,--end-group \
337		$(SHL$(TNR)STDSHL) $(STDSHL$(TNR)) $(MISC)/$(@:b)_exp.o $(MINGWSSTDENDOBJ) \
338		-Wl,-Map,$(MISC)/$(@:b).map >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
339  .IF "$(VERBOSE)" == "TRUE"
340	@$(TYPE)  $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
341  .ENDIF
342	@+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
343.ELSE
344.IF "$(linkinc)"==""
345.IF "$(SHL$(TNR)USE_EXPORTS)"!="name"
346.IF "$(USE_DEFFILE)"!=""
347	$(COMMAND_ECHO)$(SHL$(TNR)LINKER) @$(mktmp \
348		$(SHL$(TNR)LINKFLAGS) \
349		$(LINKFLAGSSHL) \
350		$(SHL$(TNR)STACK) $(SHL$(TNR)BASEX)	\
351		-out:$@ \
352		-map:$(MISC)/$(@:b).map \
353		-def:$(SHL$(TNR)DEF) \
354		$(USE_$(TNR)IMPLIB) \
355		$(STDOBJ) \
356		$(SHL$(TNR)VERSIONOBJ) $(SHL$(TNR)OBJS) \
357		$(SHL$(TNR)LIBS) \
358		$(SHL$(TNR)STDLIBS) \
359		$(SHL$(TNR)STDSHL) $(STDSHL$(TNR)) \
360		$(SHL$(TNR)LINKRES) \
361	)
362# double check if target was really written... still making sense?
363    @@$(LS) $@
364	@echo linking $@.manifest ...
365.IF "$(VISTA_MANIFEST)"!=""
366	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
367	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);2 $(FI)
368.ELSE
369	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);2 $(FI)
370.ENDIF # "$(VISTA_MANIFEST)"!=""
371	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
372	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
373.ELSE			# "$(USE_DEFFILE)"!=""
374	$(COMMAND_ECHO)$(SHL$(TNR)LINKER) @$(mktmp	$(SHL$(TNR)LINKFLAGS)			\
375		$(LINKFLAGSSHL) $(SHL$(TNR)BASEX)		\
376		$(SHL$(TNR)STACK) -out:$(SHL$(TNR)TARGETN)	\
377		-map:$(MISC)/$(@:B).map				\
378		$(LB)/$(SHL$(TNR)IMPLIB).exp				\
379		$(STDOBJ)							\
380		$(SHL$(TNR)OBJS) $(SHL$(TNR)VERSIONOBJ) \
381		$(SHL$(TNR)LIBS)                         \
382		$(SHL$(TNR)STDLIBS)                      \
383		$(SHL$(TNR)STDSHL) $(STDSHL$(TNR))                           \
384		$(SHL$(TNR)LINKRES) \
385	)
386# double check if target was really written... still making sense?
387    @@$(LS) $@
388	@echo linking $@.manifest ...
389.IF "$(VISTA_MANIFEST)"!=""
390	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
391	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);2 $(FI)
392.ELSE
393	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);2 $(FI)
394.ENDIF # "$(VISTA_MANIFEST)"!=""
395	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
396	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
397.ENDIF			# "$(USE_DEFFILE)"!=""
398.ELSE			# "$(SHL$(TNR)USE_EXPORTS)"!="name"
399	$(COMMAND_ECHO)$(SHL$(TNR)LINKER) @$(mktmp	$(SHL$(TNR)LINKFLAGS)			\
400		$(LINKFLAGSSHL) $(SHL$(TNR)BASEX)		\
401		$(SHL$(TNR)STACK) -out:$(SHL$(TNR)TARGETN)	\
402		-map:$(MISC)/$(@:B).map				\
403		$(USE_$(TNR)IMPLIB) \
404		$(STDOBJ)							\
405		$(SHL$(TNR)OBJS) $(SHL$(TNR)VERSIONOBJ))   \
406		$(SHL$(TNR)LINKLISTPARAM) \
407		@$(mktmp $(SHL$(TNR)STDLIBS)                      \
408		$(SHL$(TNR)STDSHL) $(STDSHL$(TNR))                           \
409		$(SHL$(TNR)LINKRES) \
410	)
411	@echo linking $@.manifest ...
412.IF "$(VISTA_MANIFEST)"!=""
413	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
414	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);2 $(FI)
415.ELSE
416	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);2 $(FI)
417.ENDIF # "$(VISTA_MANIFEST)"!=""
418	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
419	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
420.ENDIF			# "$(SHL$(TNR)USE_EXPORTS)"!="name"
421.ELSE			# "$(linkinc)"==""
422		$(COMMAND_ECHO)-$(RM) del $(MISC)/$(SHL$(TNR)TARGET).lnk
423		$(COMMAND_ECHO)-$(RM) $(MISC)/$(SHL$(TNR)TARGET).lst
424		$(COMMAND_ECHO)$(TYPE) $(mktmp \
425		$(SHL$(TNR)LINKFLAGS) \
426		$(LINKFLAGSSHL) $(SHL$(TNR)BASEX) \
427		$(SHL$(TNR)STACK) $(MAPFILE) \
428		-out:$@ \
429		$(LB)/$(SHL$(TNR)IMPLIB).exp \
430		$(STDOBJ) \
431		$(SHL$(TNR)OBJS) \
432		$(SHL$(TNR)STDLIBS) \
433		$(SHL$(TNR)STDSHL) $(STDSHL$(TNR)) \
434		$(SHL$(TNR)LINKRES) \
435		) >> $(MISC)/$(SHL$(TNR)TARGET).lnk
436		$(COMMAND_ECHO)$(TYPE) $(MISC)/$(SHL$(TNR)TARGETN:b)_linkinc.ls  >> $(MISC)/$(SHL$(TNR)TARGET).lnk
437		$(COMMAND_ECHO)$(SHL$(TNR)LINKER) @$(MISC)/$(SHL$(TNR)TARGET).lnk
438		@echo linking $@.manifest ...
439.IF "$(VISTA_MANIFEST)"!=""
440		$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
441		$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);2 $(FI)
442.ELSE
443		$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);2 $(FI)
444.ENDIF # "$(VISTA_MANIFEST)"!=""
445		$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
446		$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
447.ENDIF			# "$(linkinc)"==""
448.ENDIF			# "$(COM)"=="GCC"
449.ENDIF			# "$(GUI)" == "WNT"
450.IF "$(GUI)"=="UNX"
451.IF "$(OS)"=="MACOSX"
452	@-$(RM) $(MISC)/$(@:b).list
453	@-$(RM) $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
454	@echo $(STDSLO) $(SHL$(TNR)OBJS:s/.obj/.o/) \
455	$(SHL$(TNR)VERSIONOBJ) \
456	`cat /dev/null $(SHL$(TNR)LIBS) | sed s\#$(ROUT)\#$(PRJ)/$(ROUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list
457	@echo -n $(SHL$(TNR)LINKER) $(SHL$(TNR)LINKFLAGS) $(SHL$(TNR)VERSIONMAPPARA) $(LINKFLAGSSHL) -L$(PRJ)/$(ROUT)/lib $(SOLARLIB) -o $@ \
458	$(SHL$(TNR)STDLIBS) $(SHL$(TNR)ARCHIVES) $(SHL$(TNR)STDSHL) $(STDSHL$(TNR)) -filelist $(MISC)/$(@:b).list $(LINKOUTPUT_FILTER) > $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
459    @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \
460        `cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd` \
461        >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
462  .IF "$(VERBOSE)" == "TRUE"
463	@cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
464  .ENDIF
465	@+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
466    @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \
467        shl $(SHL$(TNR)RPATH) $@
468.IF "$(SHL$(TNR)CREATEJNILIB)"!=""
469	@echo "Making:   " $(@:f).jnilib
470	@macosx-create-bundle $@
471.ENDIF          # "$(SHL$(TNR)CREATEJNILIB)"!=""
472.IF "$(UPDATER)"=="YES"
473.IF "$(SHL$(TNR)NOCHECK)"==""
474	$(SOLARENV)/bin/checkdll.sh -L$(LB) -L$(SOLARLIBDIR) $(EXTRALIBPATHS$(TNR)) $(SHL$(TNR)TARGETN)
475.ENDIF				# "$(SHL$(TNR)NOCHECK)"!=""
476.ENDIF
477.ELSE			# "$(OS)"=="MACOSX"
478	@-$(RM) $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
479	@echo $(SHL$(TNR)LINKER) $(SHL$(TNR)LINKFLAGS) $(SHL$(TNR)SONAME) $(LINKFLAGSSHL) $(SHL$(TNR)VERSIONMAPPARA) -L$(PRJ)/$(ROUT)/lib $(SOLARLIB) $(STDSLO) $(SHL$(TNR)OBJS:s/.obj/.o/) \
480	$(SHL$(TNR)VERSIONOBJ) -o $@ \
481	`cat /dev/null $(SHL$(TNR)LIBS) | tr -s " " "\n" | $(SED) s\#$(ROUT)\#$(PRJ)/$(ROUT)\#g` \
482	$(SHL$(TNR)STDLIBS) $(SHL$(TNR)ARCHIVES) $(SHL$(TNR)STDSHL) $(STDSHL$(TNR)) $(LINKOUTPUT_FILTER) > $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
483  .IF "$(VERBOSE)" == "TRUE"
484	@cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
485  .ENDIF
486	@+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
487.IF "$(UPDATER)"=="YES"
488.IF "$(SHL$(TNR)NOCHECK)"==""
489	$(COMMAND_ECHO)-$(RM) $(SHL$(TNR)TARGETN:d)check_$(SHL$(TNR)TARGETN:f)
490	$(COMMAND_ECHO)$(RENAME) $(SHL$(TNR)TARGETN) $(SHL$(TNR)TARGETN:d)check_$(SHL$(TNR)TARGETN:f)
491.IF "$(VERBOSE)"=="TRUE"
492	$(COMMAND_ECHO)$(SOLARENV)/bin/checkdll.sh -L$(LB) -L$(SOLARLIBDIR) $(EXTRALIBPATHS$(TNR)) $(SHL$(TNR)TARGETN:d)check_$(SHL$(TNR)TARGETN:f)
493.ELSE
494	$(COMMAND_ECHO)$(SOLARENV)/bin/checkdll.sh -L$(LB) -L$(SOLARLIBDIR) $(EXTRALIBPATHS$(TNR)) -- -s $(SHL$(TNR)TARGETN:d)check_$(SHL$(TNR)TARGETN:f)
495.ENDIF
496.ENDIF				# "$(SHL$(TNR)NOCHECK)"!=""
497.ENDIF			# "$(UPDATER)"=="YES"
498.ENDIF			# "$(OS)"=="MACOSX"
499.IF "$(UNIXVERSIONNAMES)"!=""
500	$(COMMAND_ECHO)$(RM) $(LB)/$(SHL$(TNR)TARGETN:b)
501	$(COMMAND_ECHO)cd $(LB) && ln -s $(SHL$(TNR)TARGETN:f) $(SHL$(TNR)TARGETN:b)
502.ENDIF			# "$(UNIXVERSIONNAMES)"!=""
503.IF "$(VERBOSE)" == "TRUE"
504	@ls -l $@
505.ENDIF
506.ENDIF			# "$(GUI)" == "UNX"
507
508.IF "$(GUI)" == "OS2"
509
510.IF "$(SHL$(TNR)DEFAULTRES)"!=""
511	@+-$(RM) $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc >& $(NULLDEV)
512.IF "$(SHL$(TNR)ICON)" != ""
513	@-+echo 1 ICON $(SHL$(TNR)ICON) >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
514.ENDIF
515.IF "$(use_shl_versions)" != ""
516.IF "$(SHL$(TNR)ADD_VERINFO)"!=""
517	@-+echo $(EMQ)#include $(EMQ)"$(SHL$(TNR)ADD_VERINFO)$(EMQ)" >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
518.ENDIF			# "$(SHL$(TNR)ADD_VERINFO)"!=""
519	@-+echo MENU 1 BEGIN END >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
520#	@-+echo $(EMQ)RCDATA 1 { "Build string here" }$(EMQ) >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
521.ENDIF			# "$(use_shl_versions)" != ""
522# YD 04/07/06 seems null, confuses rc cli: -i $(SOLARTESDIR)
523	$(COMMAND_ECHO)$(RC) -r -DOS2 $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
524.ENDIF			# "$(SHL$(TNR)DEFAULTRES)"!=""
525
526.IF "$(SHL$(TNR)ALLRES)"!=""
527	$(COMMAND_ECHO)+$(TYPE) $(SHL$(TNR)ALLRES) > $(SHL$(TNR)LINKRES)
528.ENDIF			# "$(SHL$(TNR)ALLRES)"!=""
529
530.IF "$(USE_DEFFILE)"!=""
531
532	$(COMMAND_ECHO)$(SHL$(TNR)LINKER) $(SHL$(TNR)LINKFLAGS) $(LINKFLAGSSHL) -o $@ \
533		$(SHL$(TNR)DEF) \
534		$(STDOBJ) \
535		-L$(LB) \
536		-L$(SOLARVERSION)/$(INPATH)/lib \
537		$(SHL$(TNR)OBJS) $(SHL$(TNR)VERSIONOBJ) \
538		$(SHL$(TNR)LIBS) \
539		$(SHL$(TNR)STDLIBS:^"-l") \
540		$(SHL$(TNR)LINKRES) \
541		$(SHL$(TNR)STDSHL:^"-l") $(STDSHL$(TNR):^"-l")
542
543.ELSE			# "$(USE_DEFFILE)"!=""
544
545	$(COMMAND_ECHO)$(SHL$(TNR)LINKER) -v 	$(SHL$(TNR)LINKFLAGS)			\
546		$(LINKFLAGSSHL) $(SHL$(TNR)BASEX)		\
547		$(SHL$(TNR)STACK) -o $(SHL$(TNR)TARGETN)	\
548		$(SHL$(TNR)DEF) \
549		$(STDOBJ)							\
550		-L$(LB) \
551		-L$(SOLARVERSION)/$(INPATH)/lib \
552		$(SHL$(TNR)OBJS) $(SHL$(TNR)VERSIONOBJ) \
553		$(SHL$(TNR)LIBS) \
554		$(SHL$(TNR)STDLIBS:^"-l") \
555		$(SHL$(TNR)LINKRES) \
556		$(SHL$(TNR)STDSHL:^"-l") $(STDSHL$(TNR):^"-l")                           \
557	@$(LS) $@ >& $(NULLDEV)
558
559.ENDIF			# "$(USE_DEFFILE)"!=""
560
561.IF "$(SHL$(TNR)TARGET8)" != "$(SHL$(TNR)TARGET)"
562	$(COMMAND_ECHO)+$(COPY) $@ $(@:d)$(SHL$(TNR)TARGET8).dll
563.ENDIF
564
565.ENDIF			# "$(GUI)" == "OS2"
566
567.ENDIF			# "$(SHL$(TNR)TARGETN)"!=""
568
569# unroll end
570#######################################################
571
572#-------------------------------------------------------------------------
573
574#######################################################
575# Anweisungen fuer das Linken
576# unroll begin
577
578.IF "$(SHL$(TNR)IMPLIBN)" != ""
579
580.IF "$(UPDATER)"=="YES"
581USELIB$(TNR)DEPN+=$(SHL$(TNR)LIBS)
582.ELSE
583.ENDIF
584
585.IF "$(USE_DEFFILE)"!=""
586USE_SHL$(TNR)TARGET=$(SHL$(TNR)TARGETN)
587.ENDIF
588
589.IF "$(GUI)" != "UNX"
590$(SHL$(TNR)IMPLIBN):	\
591					$(SHL$(TNR)DEF) \
592					$(USE_SHL$(TNR)TARGET) \
593					$(USELIB$(TNR)DEPN) \
594					$(USELIBDEPN)
595.ELSE
596$(SHL$(TNR)IMPLIBN):	\
597					$(SHL$(TNR)LIBS)
598.ENDIF
599	@echo "Making:   " $(@:f)
600.IF "$(GUI)" == "WNT"
601.IF "$(COM)"=="GCC"
602	@echo no ImportLibs on mingw
603	@-$(RM) $@
604	@$(TOUCH) $@
605.ELSE			# "$(COM)=="GCC"
606# bei use_deffile implib von linker erstellt
607.IF "$(USE_DEFFILE)"==""
608	$(IMPLIB) $(IMPLIBFLAGS) @$(mktmp -out:$(SHL$(TNR)IMPLIBN) \
609	-def:$(SHL$(TNR)DEF) )
610.ELSE			# "$(USE_DEFFILE)==""
611	@echo build of $(SHL$(TNR)TARGETN) creates $@
612	@$(TOUCH) $@
613.ENDIF			# "$(USE_DEFFILE)==""
614.ENDIF			# "$(COM)"=="GCC"
615
616.ELIF "$(GUI)" == "OS2"
617
618# touch creates an empty file, but this is not good for emxomfar, so
619# create a dummy lib here
620	$(COMMAND_ECHO)-$(LIBMGR) $(LIBFLAGS) $@ $(SHL$(TNR)VERSIONOBJ)
621	+@echo build of $(SHL$(TNR)TARGETN) creates $@
622
623.ELSE
624	@echo no ImportLibs on Mac and *ix
625	@-$(RM) $@
626	@$(TOUCH) $@
627.ENDIF
628.ENDIF
629
630# unroll end
631#######################################################
632
633