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