xref: /aoo4110/main/solenv/inc/tg_shl.mk (revision b1cdbd2c)
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)"=="" || "$(GUI)"=="OS2"
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.cmd $(SHL$(TNR)TARGET))
270.ENDIF
271
272
273$(SHL$(TNR)TARGETN) : \
274					$(SHL$(TNR)OBJS)\
275					$(SHL$(TNR)LIBS)\
276					$(USE_$(TNR)IMPLIB_DEPS)\
277					$(USE_SHL$(TNR)DEF)\
278					$(USE_SHL$(TNR)VERSIONMAP)\
279					$(SHL$(TNR)RES)\
280					$(SHL$(TNR)DEPN) \
281					$(SHL$(TNR)LINKLIST)
282	@echo "Making:   " $(@:f)
283.IF "$(GUI)" == "WNT"
284.IF "$(SHL$(TNR)DEFAULTRES)"!=""
285	@@-$(RM) $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
286.IF "$(SHL$(TNR)ICON)" != ""
287	@echo 1 ICON $(SHL$(TNR)ICON) >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
288.ENDIF
289.IF "$(use_shl_versions)" != ""
290.IF "$(SHL$(TNR)ADD_VERINFO)"!=""
291	@echo $(EMQ)#include $(EMQ)"$(SHL$(TNR)ADD_VERINFO)$(EMQ)" >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
292.ELSE			# "$(SHL$(TNR)ADD_VERINFO)"!=""
293	@echo $(EMQ)#define ADDITIONAL_VERINFO1 >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
294	@echo $(EMQ)#define ADDITIONAL_VERINFO2 >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
295	@echo $(EMQ)#define ADDITIONAL_VERINFO3 >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
296.ENDIF			# "$(SHL$(TNR)ADD_VERINFO)"!=""
297	@echo $(EMQ)#define VERVARIANT	$(BUILD) >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
298	@echo $(EMQ)#define ORG_NAME	$(SHL$(TNR)TARGET)$(DLLPOST) >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
299	@echo $(EMQ)#define INTERNAL_NAME $(SHL$(TNR)TARGET:b) >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
300	@echo $(EMQ)#include $(EMQ)"shlinfo.rc$(EMQ)" >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
301.ENDIF			# "$(use_shl_versions)" != ""
302	$(COMMAND_ECHO)$(RC) -DWIN32 $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
303.ENDIF			# "$(SHL$(TNR)DEFAULTRES)"!=""
304.IF "$(SHL$(TNR)ALLRES)"!=""
305	$(COMMAND_ECHO)$(TYPE) $(SHL$(TNR)ALLRES) > $(SHL$(TNR)LINKRES)
306.IF "$(COM)"=="GCC"
307	windres $(SHL$(TNR)LINKRES) $(SHL$(TNR)LINKRESO)
308.ENDIF			# "$(COM)"=="GCC"
309.ENDIF			# "$(SHL$(TNR)ALLRES)"!=""
310.IF "$(COM)"=="GCC"	# always have to call dlltool explicitly as ld cannot handle # comment in .def
311	@echo dlltool --dllname $(SHL$(TNR)TARGET)$(DLLPOST) \
312		--kill-at \\ > $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
313	@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))
314.IF "$(DEFLIB$(TNR)NAME)"!=""	# do not have to include objs
315	@noop $(assign DEF$(TNR)OBJLIST:=$(shell $(TYPE) $(foreach,i,$(DEFLIB$(TNR)NAME) $(SLB)/$(i).lib) | sed s?$(ROUT)?$(PRJ)/$(ROUT)?g))
316	@noop $(foreach,i,$(DEF$(TNR)OBJLIST) $(assign ALL$(TNR)OBJLIST:=$(ALL$(TNR)OBJLIST:s?$i??)))
317.ENDIF			# "$(DEFLIB$(TNR)NAME)"!=""
318	@echo	--output-exp $(MISC)/$(@:b)_exp.o \\ >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
319.IF "$(SHL$(TNR)DEF)"!=""
320	@echo	--input-def $(SHL$(TNR)DEF) \\ >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
321.ELSE
322	@echo	$(SHL$(TNR)VERSIONOBJ) $(SHL$(TNR)DESCRIPTIONOBJ) \\ >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
323.ENDIF
324	@echo	$(ALL$(TNR)OBJLIST) >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
325	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSSHL) $(MINGWSSTDOBJ) -o $@ \
326		$(STDOBJ) $(SHL$(TNR)VERSIONOBJ) $(SHL$(TNR)DESCRIPTIONOBJ) $(SHL$(TNR)OBJS) $(SHL$(TNR)LINKRESO) \
327		`$(TYPE) /dev/null $(SHL$(TNR)LIBS) | $(SED) s\#$(ROUT)\#$(PRJ)/$(ROUT)\#g` \
328		-Wl,--exclude-libs,ALL,--start-group $(SHL$(TNR)STDLIBS) -Wl,--end-group \
329		$(SHL$(TNR)STDSHL) $(STDSHL$(TNR)) $(MISC)/$(@:b)_exp.o $(MINGWSSTDENDOBJ) \
330		-Wl,-Map,$(MISC)/$(@:b).map >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
331  .IF "$(VERBOSE)" == "TRUE"
332	@$(TYPE)  $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
333  .ENDIF
334	@+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
335.ELSE
336.IF "$(linkinc)"==""
337.IF "$(SHL$(TNR)USE_EXPORTS)"!="name"
338.IF "$(USE_DEFFILE)"!=""
339	$(COMMAND_ECHO)$(SHL$(TNR)LINKER) @$(mktmp \
340		$(SHL$(TNR)LINKFLAGS) \
341		$(LINKFLAGSSHL) \
342		$(SHL$(TNR)STACK) $(SHL$(TNR)BASEX)	\
343		-out:$@ \
344		-map:$(MISC)/$(@:b).map \
345		-def:$(SHL$(TNR)DEF) \
346		$(USE_$(TNR)IMPLIB) \
347		$(STDOBJ) \
348		$(SHL$(TNR)VERSIONOBJ) $(SHL$(TNR)OBJS) \
349		$(SHL$(TNR)LIBS) \
350		$(SHL$(TNR)STDLIBS) \
351		$(SHL$(TNR)STDSHL) $(STDSHL$(TNR)) \
352		$(SHL$(TNR)LINKRES) \
353	)
354# double check if target was really written... still making sense?
355    @@$(LS) $@
356	@echo linking $@.manifest ...
357.IF "$(VISTA_MANIFEST)"!=""
358	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
359	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);2 $(FI)
360.ELSE
361	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);2 $(FI)
362.ENDIF # "$(VISTA_MANIFEST)"!=""
363	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
364	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
365.ELSE			# "$(USE_DEFFILE)"!=""
366	$(COMMAND_ECHO)$(SHL$(TNR)LINKER) @$(mktmp	$(SHL$(TNR)LINKFLAGS)			\
367		$(LINKFLAGSSHL) $(SHL$(TNR)BASEX)		\
368		$(SHL$(TNR)STACK) -out:$(SHL$(TNR)TARGETN)	\
369		-map:$(MISC)/$(@:B).map				\
370		$(LB)/$(SHL$(TNR)IMPLIB).exp				\
371		$(STDOBJ)							\
372		$(SHL$(TNR)OBJS) $(SHL$(TNR)VERSIONOBJ) \
373		$(SHL$(TNR)LIBS)                         \
374		$(SHL$(TNR)STDLIBS)                      \
375		$(SHL$(TNR)STDSHL) $(STDSHL$(TNR))                           \
376		$(SHL$(TNR)LINKRES) \
377	)
378# double check if target was really written... still making sense?
379    @@$(LS) $@
380	@echo linking $@.manifest ...
381.IF "$(VISTA_MANIFEST)"!=""
382	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
383	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);2 $(FI)
384.ELSE
385	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);2 $(FI)
386.ENDIF # "$(VISTA_MANIFEST)"!=""
387	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
388	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
389.ENDIF			# "$(USE_DEFFILE)"!=""
390.ELSE			# "$(SHL$(TNR)USE_EXPORTS)"!="name"
391	$(COMMAND_ECHO)$(SHL$(TNR)LINKER) @$(mktmp	$(SHL$(TNR)LINKFLAGS)			\
392		$(LINKFLAGSSHL) $(SHL$(TNR)BASEX)		\
393		$(SHL$(TNR)STACK) -out:$(SHL$(TNR)TARGETN)	\
394		-map:$(MISC)/$(@:B).map				\
395		$(USE_$(TNR)IMPLIB) \
396		$(STDOBJ)							\
397		$(SHL$(TNR)OBJS) $(SHL$(TNR)VERSIONOBJ))   \
398		$(SHL$(TNR)LINKLISTPARAM) \
399		@$(mktmp $(SHL$(TNR)STDLIBS)                      \
400		$(SHL$(TNR)STDSHL) $(STDSHL$(TNR))                           \
401		$(SHL$(TNR)LINKRES) \
402	)
403	@echo linking $@.manifest ...
404.IF "$(VISTA_MANIFEST)"!=""
405	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
406	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);2 $(FI)
407.ELSE
408	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);2 $(FI)
409.ENDIF # "$(VISTA_MANIFEST)"!=""
410	$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
411	$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
412.ENDIF			# "$(SHL$(TNR)USE_EXPORTS)"!="name"
413.ELSE			# "$(linkinc)"==""
414		$(COMMAND_ECHO)-$(RM) del $(MISC)/$(SHL$(TNR)TARGET).lnk
415		$(COMMAND_ECHO)-$(RM) $(MISC)/$(SHL$(TNR)TARGET).lst
416		$(COMMAND_ECHO)$(TYPE) $(mktmp \
417		$(SHL$(TNR)LINKFLAGS) \
418		$(LINKFLAGSSHL) $(SHL$(TNR)BASEX) \
419		$(SHL$(TNR)STACK) $(MAPFILE) \
420		-out:$@ \
421		$(LB)/$(SHL$(TNR)IMPLIB).exp \
422		$(STDOBJ) \
423		$(SHL$(TNR)OBJS) \
424		$(SHL$(TNR)STDLIBS) \
425		$(SHL$(TNR)STDSHL) $(STDSHL$(TNR)) \
426		$(SHL$(TNR)LINKRES) \
427		) >> $(MISC)/$(SHL$(TNR)TARGET).lnk
428		$(COMMAND_ECHO)$(TYPE) $(MISC)/$(SHL$(TNR)TARGETN:b)_linkinc.ls  >> $(MISC)/$(SHL$(TNR)TARGET).lnk
429		$(COMMAND_ECHO)$(SHL$(TNR)LINKER) @$(MISC)/$(SHL$(TNR)TARGET).lnk
430		@echo linking $@.manifest ...
431.IF "$(VISTA_MANIFEST)"!=""
432		$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
433		$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);2 $(FI)
434.ELSE
435		$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);2 $(FI)
436.ENDIF # "$(VISTA_MANIFEST)"!=""
437		$(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
438		$(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
439.ENDIF			# "$(linkinc)"==""
440.ENDIF			# "$(COM)"=="GCC"
441.ENDIF			# "$(GUI)" == "WNT"
442.IF "$(GUI)"=="UNX"
443.IF "$(OS)"=="MACOSX"
444	@-$(RM) $(MISC)/$(@:b).list
445	@-$(RM) $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
446	@echo $(STDSLO) $(SHL$(TNR)OBJS:s/.obj/.o/) \
447	$(SHL$(TNR)VERSIONOBJ) \
448	`cat /dev/null $(SHL$(TNR)LIBS) | sed s\#$(ROUT)\#$(PRJ)/$(ROUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list
449	@echo -n $(SHL$(TNR)LINKER) $(SHL$(TNR)LINKFLAGS) $(SHL$(TNR)VERSIONMAPPARA) $(LINKFLAGSSHL) -L$(PRJ)/$(ROUT)/lib $(SOLARLIB) -o $@ \
450	$(SHL$(TNR)STDLIBS) $(SHL$(TNR)ARCHIVES) $(SHL$(TNR)STDSHL) $(STDSHL$(TNR)) -filelist $(MISC)/$(@:b).list $(LINKOUTPUT_FILTER) > $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
451    @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \
452        `cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd` \
453        >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
454  .IF "$(VERBOSE)" == "TRUE"
455	@cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
456  .ENDIF
457	@+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
458    @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \
459        shl $(SHL$(TNR)RPATH) $@
460.IF "$(SHL$(TNR)CREATEJNILIB)"!=""
461	@echo "Making:   " $(@:f).jnilib
462	@macosx-create-bundle $@
463.ENDIF          # "$(SHL$(TNR)CREATEJNILIB)"!=""
464.IF "$(UPDATER)"=="YES"
465.IF "$(SHL$(TNR)NOCHECK)"==""
466	$(SOLARENV)/bin/checkdll.sh -L$(LB) -L$(SOLARLIBDIR) $(EXTRALIBPATHS$(TNR)) $(SHL$(TNR)TARGETN)
467.ENDIF				# "$(SHL$(TNR)NOCHECK)"!=""
468.ENDIF
469.ELSE			# "$(OS)"=="MACOSX"
470	@-$(RM) $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
471	@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/) \
472	$(SHL$(TNR)VERSIONOBJ) -o $@ \
473	`cat /dev/null $(SHL$(TNR)LIBS) | tr -s " " "\n" | $(SED) s\#$(ROUT)\#$(PRJ)/$(ROUT)\#g` \
474	$(SHL$(TNR)STDLIBS) $(SHL$(TNR)ARCHIVES) $(SHL$(TNR)STDSHL) $(STDSHL$(TNR)) $(LINKOUTPUT_FILTER) > $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
475  .IF "$(VERBOSE)" == "TRUE"
476	@cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
477  .ENDIF
478	@+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd
479.IF "$(UPDATER)"=="YES"
480.IF "$(SHL$(TNR)NOCHECK)"==""
481	$(COMMAND_ECHO)-$(RM) $(SHL$(TNR)TARGETN:d)check_$(SHL$(TNR)TARGETN:f)
482	$(COMMAND_ECHO)$(RENAME) $(SHL$(TNR)TARGETN) $(SHL$(TNR)TARGETN:d)check_$(SHL$(TNR)TARGETN:f)
483.IF "$(VERBOSE)"=="TRUE"
484	$(COMMAND_ECHO)$(SOLARENV)/bin/checkdll.sh -L$(LB) -L$(SOLARLIBDIR) $(EXTRALIBPATHS$(TNR)) $(SHL$(TNR)TARGETN:d)check_$(SHL$(TNR)TARGETN:f)
485.ELSE
486	$(COMMAND_ECHO)$(SOLARENV)/bin/checkdll.sh -L$(LB) -L$(SOLARLIBDIR) $(EXTRALIBPATHS$(TNR)) -- -s $(SHL$(TNR)TARGETN:d)check_$(SHL$(TNR)TARGETN:f)
487.ENDIF
488.ENDIF				# "$(SHL$(TNR)NOCHECK)"!=""
489.ENDIF			# "$(UPDATER)"=="YES"
490.ENDIF			# "$(OS)"=="MACOSX"
491.IF "$(UNIXVERSIONNAMES)"!=""
492	$(COMMAND_ECHO)$(RM) $(LB)/$(SHL$(TNR)TARGETN:b)
493	$(COMMAND_ECHO)cd $(LB) && ln -s $(SHL$(TNR)TARGETN:f) $(SHL$(TNR)TARGETN:b)
494.ENDIF			# "$(UNIXVERSIONNAMES)"!=""
495.IF "$(VERBOSE)" == "TRUE"
496	@ls -l $@
497.ENDIF
498.ENDIF			# "$(GUI)" == "UNX"
499
500.IF "$(GUI)" == "OS2"
501
502.IF "$(SHL$(TNR)DEFAULTRES)"!=""
503	@+-$(RM) $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc > $(NULLDEV)
504.IF "$(SHL$(TNR)ICON)" != ""
505	@-+echo 1 ICON $(SHL$(TNR)ICON) >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
506.ENDIF
507.IF "$(use_shl_versions)" != ""
508.IF "$(SHL$(TNR)ADD_VERINFO)"!=""
509	@-+echo $(EMQ)#include $(EMQ)"$(SHL$(TNR)ADD_VERINFO)$(EMQ)" >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
510.ENDIF			# "$(SHL$(TNR)ADD_VERINFO)"!=""
511	@-+echo MENU 1 BEGIN END >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
512#	@-+echo $(EMQ)RCDATA 1 { "Build string here" }$(EMQ) >> $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
513.ENDIF			# "$(use_shl_versions)" != ""
514# YD 04/07/06 seems null, confuses rc cli: -i $(SOLARTESDIR)
515	$(COMMAND_ECHO)$(RC) -r -DOS2 $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(SHL$(TNR)DEFAULTRES:b).rc
516.ENDIF			# "$(SHL$(TNR)DEFAULTRES)"!=""
517
518.IF "$(SHL$(TNR)ALLRES)"!=""
519	$(COMMAND_ECHO)+$(TYPE) $(SHL$(TNR)ALLRES) > $(SHL$(TNR)LINKRES)
520.ENDIF			# "$(SHL$(TNR)ALLRES)"!=""
521
522.IF "$(USE_DEFFILE)"!=""
523
524	$(COMMAND_ECHO)$(SHL$(TNR)LINKER) $(SHL$(TNR)LINKFLAGS) $(LINKFLAGSSHL) -o $@ \
525		$(SHL$(TNR)DEF) \
526		$(STDOBJ) \
527		-L$(LB) \
528		-L$(SOLARVERSION)/$(INPATH)/lib \
529		$(SHL$(TNR)OBJS) $(SHL$(TNR)VERSIONOBJ) \
530		$(SHL$(TNR)LIBS) \
531		$(SHL$(TNR)LINKRES) \
532		$(SHL$(TNR)STDLIBS) \
533		$(SHL$(TNR)STDSHL) $(STDSHL$(TNR))
534
535.ELSE			# "$(USE_DEFFILE)"!=""
536
537	$(COMMAND_ECHO)$(SHL$(TNR)LINKER) $(SHL$(TNR)LINKFLAGS)			\
538		$(LINKFLAGSSHL) $(SHL$(TNR)BASEX)		\
539		$(SHL$(TNR)STACK) -o $(SHL$(TNR)TARGETN)	\
540		$(SHL$(TNR)DEF) \
541		$(STDOBJ)							\
542		-L$(LB) \
543		-L$(SOLARVERSION)/$(INPATH)/lib \
544		$(SHL$(TNR)OBJS) $(SHL$(TNR)VERSIONOBJ) \
545		$(SHL$(TNR)LIBS) \
546		$(SHL$(TNR)LINKRES) \
547		$(SHL$(TNR)STDLIBS) \
548		$(SHL$(TNR)STDSHL) $(STDSHL$(TNR))
549
550.ENDIF			# "$(USE_DEFFILE)"!=""
551
552.IF "$(SHL$(TNR)USE_EXPORTS)"=="name"
553#03/11/2012  if 'name' is used, export from DLL file (only names, no ordinals)
554	@echo Build import library from DLL file.
555	$(COMMAND_ECHO)+$(IMPLIB) $(IMPLIBFLAGS) $(LB)/$(SHL$(TNR)TARGETN:b).lib $@
556.ENDIF			# "$(SHL$(TNR)USE_EXPORTS)"==""
557
558.IF "$(SHL$(TNR)TARGET8)" != "$(SHL$(TNR)TARGET)"
559	$(COMMAND_ECHO)+$(COPY) $@ $(@:d)$(SHL$(TNR)TARGET8).dll
560.ENDIF
561
562.ENDIF			# "$(GUI)" == "OS2"
563
564.ENDIF			# "$(SHL$(TNR)TARGETN)"!=""
565
566# unroll end
567#######################################################
568
569#-------------------------------------------------------------------------
570
571#######################################################
572# Anweisungen fuer das Linken
573# unroll begin
574
575.IF "$(SHL$(TNR)IMPLIBN)" != ""
576
577.IF "$(UPDATER)"=="YES"
578USELIB$(TNR)DEPN+=$(SHL$(TNR)LIBS)
579.ELSE
580.ENDIF
581
582.IF "$(USE_DEFFILE)"!=""
583USE_SHL$(TNR)TARGET=$(SHL$(TNR)TARGETN)
584.ENDIF
585
586.IF "$(GUI)" != "UNX"
587$(SHL$(TNR)IMPLIBN):	\
588					$(SHL$(TNR)DEF) \
589					$(USE_SHL$(TNR)TARGET) \
590					$(USELIB$(TNR)DEPN) \
591					$(USELIBDEPN)
592.ELSE
593$(SHL$(TNR)IMPLIBN):	\
594					$(SHL$(TNR)LIBS)
595.ENDIF
596	@echo "Making:   " $(@:f)
597.IF "$(GUI)" == "WNT"
598.IF "$(COM)"=="GCC"
599	@echo no ImportLibs on mingw
600	@-$(RM) $@
601	@$(TOUCH) $@
602.ELSE			# "$(COM)=="GCC"
603# bei use_deffile implib von linker erstellt
604.IF "$(USE_DEFFILE)"==""
605	$(IMPLIB) $(IMPLIBFLAGS) @$(mktmp -out:$(SHL$(TNR)IMPLIBN) \
606	-def:$(SHL$(TNR)DEF) )
607.ELSE			# "$(USE_DEFFILE)==""
608	@echo build of $(SHL$(TNR)TARGETN) creates $@
609	@$(TOUCH) $@
610.ENDIF			# "$(USE_DEFFILE)==""
611.ENDIF			# "$(COM)"=="GCC"
612
613.ELIF "$(GUI)" == "OS2"
614
615	@echo Import libs generated with .def file or with .dll file.
616# make 'dmake' happy
617	@-$(RM) $@
618	@$(TOUCH) $@
619
620.ELSE
621	@echo no ImportLibs on Mac and *ix
622	@-$(RM) $@
623	@$(TOUCH) $@
624.ENDIF
625.ENDIF
626
627# unroll end
628#######################################################
629
630