xref: /aoo42x/main/solenv/inc/tg_def.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# Anweisungen fuer das Linken
30# unroll begin
31
32.IF "$(DEF$(TNR)TARGETN)"!=""
33
34#to make intuitiv naming work
35.IF "$(DEF$(TNR)LIBNAME)"!=""
36DEFLIB$(TNR)NAME*=$(DEF$(TNR)LIBNAME)
37.ENDIF			# "$(DEF$(TNR)LIBNAME)"!=""
38
39.IF "$(DEFLIB$(TNR)NAME)"!=""
40DEF$(TNR)DEPN+=$(foreach,i,$(DEFLIB$(TNR)NAME) $(SLB)/$(i).lib)
41.ENDIF
42
43.IF "$(SHL$(TNR)VERSIONMAP)"!=""
44.IF "$(DEF$(TNR)EXPORTFILE)"==""
45.IF "$(GUI)"=="WNT"
46DEF$(TNR)EXPORTFILE=$(MISC)/$(SHL$(TNR)VERSIONMAP:b)_$(SHL$(TNR)TARGET).dxp
47.IF "$(COM)"=="GCC"
48$(DEF$(TNR)EXPORTFILE) : $(SHL$(TNR)OBJS) $(SHL$(TNR)LIBS)
49.ENDIF # .IF "$(COM)"=="GCC"
50
51$(DEF$(TNR)EXPORTFILE) : $(SHL$(TNR)VERSIONMAP)
52	$(COMMAND_ECHO)$(TYPE) $< | $(AWK) -f $(SOLARENV)/bin/getcsym.awk > $@
53.IF "$(COM)"=="GCC"
54	$(COMMAND_ECHO)-$(GREP) -v "\*\|?" $@ | $(SED) -e 's@#.*@@' > $@.exported-symbols
55	$(COMMAND_ECHO)-$(GREP) "\*\|?" $@ > $@.symbols-regexp
56# Shared libraries will be build out of the *.obj files specified in SHL?OBJS and SHL?LIBS
57# Extract RTTI symbols from all the objects that will be used to build a shared library
58	$(COMMAND_ECHO)nm -gP $(SHL$(TNR)OBJS) \
59		`$(TYPE) /dev/null $(foreach,j,$(SHL$(TNR)LIBS) $j) | $(SED) s\#$(ROUT)\#$(PRJ)$/$(ROUT)\#g` \
60		| $(SOLARENV)/bin/addsym-mingw.sh $@.symbols-regexp $@.symbols-regexp.tmp >> $@.exported-symbols
61# overwrite the map file generate into the local output tree with the generated
62# exported symbols list
63	$(COMMAND_ECHO)$(RENAME) $@.exported-symbols $@
64.ENDIF # .IF "$(COM)"=="GCC"
65
66.ENDIF			# "$(GUI)"=="WNT"
67
68.IF "$(GUI)"=="OS2"
69DEF$(TNR)EXPORTFILE=$(MISC)/$(SHL$(TNR)VERSIONMAP:b)_$(SHL$(TNR)TARGET).dxp
70$(DEF$(TNR)EXPORTFILE) : $(SHL$(TNR)VERSIONMAP)
71	$(TYPE) $< | $(AWK) -f $(SOLARENV)/bin/getcsym.awk > $@
72.ENDIF			# "$(GUI)"=="OS2"
73
74.ENDIF			# "$(DEF$(TNR)EXPORTFILE)"==""
75.ENDIF			# "$(SHL$(TNR)VERSIONMAP)"!=""
76
77.IF "$(GUI)"=="WNT"
78
79DEF$(TNR)FILTER=$(SOLARENV)/inc/dummy.flt
80
81RMHACK$(TNR):=$(RM)
82
83.IF "$(DEF$(TNR)CEXP)"!=""
84EXPORT_ALL_SWITCH=-A $(DEF$(TNR)CEXP)
85.ENDIF
86
87.IF "$(link_always)"==""
88$(DEF$(TNR)TARGETN) : \
89		$(DEF$(TNR)DEPN) \
90		$(DEF$(TNR)EXPORTFILE)
91.ELSE			# "$(link_always)"==""
92$(DEF$(TNR)TARGETN) .PHONY :
93.ENDIF			# "$(link_always)"==""
94	@-$(RM) $@.tmpfile
95	@echo "Making:    module definition file" $(@:f)
96	@echo LIBRARY	  $(EMQ)"$(SHL$(TNR)TARGETN:f)$(EMQ)" 								 >$@.tmpfile
97.IF "$(COM)"!="GCC"
98	@echo HEAPSIZE	  0 											>>$@.tmpfile
99.ENDIF
100	@echo EXPORTS													>>$@.tmpfile
101.IF "$(VERSIONOBJ)"!=""
102#	getversioninfo fuer alle!!
103	@echo GetVersionInfo		>>$@.tmpfile
104.ENDIF
105.IF "$(DEFLIB$(TNR)NAME)"!=""
106.IF "$(COM)"=="GCC"
107	@-$(RM) $(MISC)/$(SHL$(TNR)TARGET).exp
108	$(COMMAND_ECHO)dlltool --output-def $(MISC)/$(SHL$(TNR)TARGET).exp --export-all-symbols \
109		`$(TYPE) $(foreach,i,$(DEFLIB$(TNR)NAME) $(SLB)/$(i).lib) | sed s#$(ROUT)#$(PRJ)/$(ROUT)#g`
110	$(COMMAND_ECHO)tail --lines +3 $(MISC)/$(SHL$(TNR)TARGET).exp | sed '/^;/d' >>$@.tmpfile
111	@-$(RM) $(MISC)/$(SHL$(TNR)TARGET).exp
112.ELSE
113.IF "$(SHL$(TNR)USE_EXPORTS)"==""
114	@-$(RMHACK$(TNR)) $(MISC)/$(SHL$(TNR)TARGET).exp
115	@$(LIBMGR) -EXTRACT:/ /OUT:$(MISC)/$(SHL$(TNR)TARGET).exp $(SLB)/$(DEFLIB$(TNR)NAME).lib
116	@$(LDUMP2) -N $(EXPORT_ALL_SWITCH) -F $(MISC)/$(SHL$(TNR)TARGET).flt $(MISC)/$(SHL$(TNR)TARGET).exp			   >>$@.tmpfile
117	$(COMMAND_ECHO)$(RMHACK$(TNR)) $(MISC)/$(SHL$(TNR)TARGET).exp
118.ELSE			# "$(SHL$(TNR)USE_EXPORTS)"==""
119	@$(DUMPBIN) -DIRECTIVES  $(foreach,i,$(DEFLIB$(TNR)NAME) $(SLB)/$(i).lib) | $(GREP) EXPORT: > $(MISC)/$(SHL$(TNR)TARGET).direct
120	@$(LDUMP2) -N -D $(EXPORT_ALL_SWITCH) -F $(DEF$(TNR)FILTER) $(MISC)/$(SHL$(TNR)TARGET).direct >>$@.tmpfile
121.ENDIF			# "$(SHL$(TNR)USE_EXPORTS)"==""
122.ENDIF
123.ENDIF				# "$(DEFLIB$(TNR)NAME)"!=""
124.IF "$(DEF$(TNR)EXPORT1)"!=""
125	@echo $(DEF$(TNR)EXPORT1)										>>$@.tmpfile
126.ENDIF
127.IF "$(DEF$(TNR)EXPORT2)"!=""
128	@echo $(DEF$(TNR)EXPORT2)										>>$@.tmpfile
129.ENDIF
130.IF "$(DEF$(TNR)EXPORT3)"!=""
131	@echo $(DEF$(TNR)EXPORT3)										>>$@.tmpfile
132.ENDIF
133.IF "$(DEF$(TNR)EXPORT4)"!=""
134	@echo $(DEF$(TNR)EXPORT4)										>>$@.tmpfile
135.ENDIF
136.IF "$(DEF$(TNR)EXPORT5)"!=""
137	@echo $(DEF$(TNR)EXPORT5)										>>$@.tmpfile
138.ENDIF
139.IF "$(DEF$(TNR)EXPORT6)"!=""
140	@echo $(DEF$(TNR)EXPORT6)										>>$@.tmpfile
141.ENDIF
142.IF "$(DEF$(TNR)EXPORT7)"!=""
143	@echo $(DEF$(TNR)EXPORT7)										>>$@.tmpfile
144.ENDIF
145.IF "$(DEF$(TNR)EXPORT8)"!=""
146	@echo $(DEF$(TNR)EXPORT8)										>>$@.tmpfile
147.ENDIF
148.IF "$(DEF$(TNR)EXPORT9)"!=""
149	@echo $(DEF$(TNR)EXPORT9)										>>$@.tmpfile
150.ENDIF
151.IF "$(DEF$(TNR)EXPORT10)"!=""
152	@echo $(DEF$(TNR)EXPORT10)										>>$@.tmpfile
153.ENDIF
154.IF "$(DEF$(TNR)EXPORT11)"!=""
155	@echo $(DEF$(TNR)EXPORT11)										>>$@.tmpfile
156.ENDIF
157.IF "$(DEF$(TNR)EXPORT12)"!=""
158	@echo $(DEF$(TNR)EXPORT12)										>>$@.tmpfile
159.ENDIF
160.IF "$(DEF$(TNR)EXPORT13)"!=""
161	@echo $(DEF$(TNR)EXPORT13)										>>$@.tmpfile
162.ENDIF
163.IF "$(DEF$(TNR)EXPORT14)"!=""
164	@echo $(DEF$(TNR)EXPORT14)										>>$@.tmpfile
165.ENDIF
166.IF "$(DEF$(TNR)EXPORT15)"!=""
167	@echo $(DEF$(TNR)EXPORT15)										>>$@.tmpfile
168.ENDIF
169.IF "$(DEF$(TNR)EXPORT16)"!=""
170	@echo $(DEF$(TNR)EXPORT16)										>>$@.tmpfile
171.ENDIF
172.IF "$(DEF$(TNR)EXPORT17)"!=""
173	@echo $(DEF$(TNR)EXPORT17)										>>$@.tmpfile
174.ENDIF
175.IF "$(DEF$(TNR)EXPORT18)"!=""
176	@echo $(DEF$(TNR)EXPORT18)										>>$@.tmpfile
177.ENDIF
178.IF "$(DEF$(TNR)EXPORT19)"!=""
179	@echo $(DEF$(TNR)EXPORT19)										>>$@.tmpfile
180.ENDIF
181.IF "$(DEF$(TNR)EXPORT20)"!=""
182	@echo $(DEF$(TNR)EXPORT20)										>>$@.tmpfile
183.ENDIF
184.IF "$(DEF$(TNR)EXPORTFILE)"!=""
185.IF "$(COM)"=="GCC"
186	$(COMMAND_ECHO)$(TYPE) $(DEF$(TNR)EXPORTFILE) | sed -e s:PRIVATE:: >> $@.tmpfile
187.ELSE
188	$(COMMAND_ECHO)$(TYPE) $(DEF$(TNR)EXPORTFILE) >> $@.tmpfile
189.ENDIF
190.ENDIF
191	@-$(RM) $@
192	@$(RENAME) $@.tmpfile $@
193.ENDIF			# "$(GUI)"=="WNT"
194
195.IF "$(GUI)"=="OS2"
196
197#21/02/2006 YD dll names must be 8.3, invoke fix script
198#check osl/os2/module.c/osl_loadModule()
199SHL$(TNR)TARGET8=$(shell @fix_shl $(SHL$(TNR)TARGETN:f))
200
201DEF$(TNR)FILTER=$(SOLARENV)/inc/dummy.flt
202DEF$(TNR)NAMELIST=$(foreach,i,$(DEFLIB$(TNR)NAME) $(SLB)/$(i).lib)
203
204.IF "$(link_always)"==""
205$(DEF$(TNR)TARGETN) : \
206		$(DEF$(TNR)DEPN) \
207		$(DEF$(TNR)EXPORTFILE)
208.ELSE			# "$(link_always)"==""
209$(DEF$(TNR)TARGETN) .PHONY :
210.ENDIF			# "$(link_always)"==""
211	@+-$(RM) $@.tmpfile
212	@echo "Making:    module definition file" $(@:f)
213	@echo LIBRARY	  $(SHL$(TNR)TARGET8) INITINSTANCE TERMINSTANCE	 >$@.tmpfile
214	@echo DATA MULTIPLE	 >>$@.tmpfile
215	@echo DESCRIPTION	'StarView 3.00 $(DEF$(TNR)DES) $(UPD) $(UPDMINOR)' >>$@.tmpfile
216	@echo EXPORTS													>>$@.tmpfile
217.IF "$(VERSIONOBJ)"!=""
218#	getversioninfo fuer alle!!
219	@echo _GetVersionInfo		>$@.tmp_ord
220.ENDIF
221
222.IF "$(DEFLIB$(TNR)NAME)"!=""
223	@+echo $(SLB)/$(DEFLIB$(TNR)NAME).lib
224	@+emxexpr $(DEF$(TNR)NAMELIST) | fix_exp_file >> $@.tmp_ord
225.ENDIF				# "$(DEFLIB$(TNR)NAME)"!=""
226
227.IF "$(DEF$(TNR)EXPORT1)"!=""
228	@echo $(DEF$(TNR)EXPORT1)										>>$@.tmpfile
229.ENDIF
230.IF "$(DEF$(TNR)EXPORT2)"!=""
231	@echo $(DEF$(TNR)EXPORT2)										>>$@.tmpfile
232.ENDIF
233.IF "$(DEF$(TNR)EXPORT3)"!=""
234	@echo $(DEF$(TNR)EXPORT3)										>>$@.tmpfile
235.ENDIF
236.IF "$(DEF$(TNR)EXPORT4)"!=""
237	@echo $(DEF$(TNR)EXPORT4)										>>$@.tmpfile
238.ENDIF
239.IF "$(DEF$(TNR)EXPORT5)"!=""
240	@echo $(DEF$(TNR)EXPORT5)										>>$@.tmpfile
241.ENDIF
242.IF "$(DEF$(TNR)EXPORT6)"!=""
243	@echo $(DEF$(TNR)EXPORT6)										>>$@.tmpfile
244.ENDIF
245.IF "$(DEF$(TNR)EXPORT7)"!=""
246	@echo $(DEF$(TNR)EXPORT7)										>>$@.tmpfile
247.ENDIF
248.IF "$(DEF$(TNR)EXPORT8)"!=""
249	@echo $(DEF$(TNR)EXPORT8)										>>$@.tmpfile
250.ENDIF
251.IF "$(DEF$(TNR)EXPORT9)"!=""
252	@echo $(DEF$(TNR)EXPORT9)										>>$@.tmpfile
253.ENDIF
254.IF "$(DEF$(TNR)EXPORT10)"!=""
255	@echo $(DEF$(TNR)EXPORT10)										>>$@.tmpfile
256.ENDIF
257.IF "$(DEF$(TNR)EXPORT11)"!=""
258	@echo $(DEF$(TNR)EXPORT11)										>>$@.tmpfile
259.ENDIF
260.IF "$(DEF$(TNR)EXPORT12)"!=""
261	@echo $(DEF$(TNR)EXPORT12)										>>$@.tmpfile
262.ENDIF
263.IF "$(DEF$(TNR)EXPORT13)"!=""
264	@echo $(DEF$(TNR)EXPORT13)										>>$@.tmpfile
265.ENDIF
266.IF "$(DEF$(TNR)EXPORT14)"!=""
267	@echo $(DEF$(TNR)EXPORT14)										>>$@.tmpfile
268.ENDIF
269.IF "$(DEF$(TNR)EXPORT15)"!=""
270	@echo $(DEF$(TNR)EXPORT15)										>>$@.tmpfile
271.ENDIF
272.IF "$(DEF$(TNR)EXPORT16)"!=""
273	@echo $(DEF$(TNR)EXPORT16)										>>$@.tmpfile
274.ENDIF
275.IF "$(DEF$(TNR)EXPORT17)"!=""
276	@echo $(DEF$(TNR)EXPORT17)										>>$@.tmpfile
277.ENDIF
278.IF "$(DEF$(TNR)EXPORT18)"!=""
279	@echo $(DEF$(TNR)EXPORT18)										>>$@.tmpfile
280.ENDIF
281.IF "$(DEF$(TNR)EXPORT19)"!=""
282	@echo $(DEF$(TNR)EXPORT19)										>>$@.tmpfile
283.ENDIF
284.IF "$(DEF$(TNR)EXPORT20)"!=""
285	@echo $(DEF$(TNR)EXPORT20)										>>$@.tmpfile
286.ENDIF
287.IF "$(DEF$(TNR)EXPORTFILE)"!=""
288	@fix_def_file < $(DEF$(TNR)EXPORTFILE) >> $@.tmp_ord
289.ENDIF
290	@sort < $@.tmp_ord | uniq > $@.exptmpfile
291	@fix_def_ord < $@.exptmpfile >> $@.tmpfile
292	@+-$(RM) $@
293	$(COMMAND_ECHO)+$(RENAME) $@.tmpfile $@
294	@+-$(RM) $@.tmp_ord
295	@+-$(RM) $@.exptmpfile
296	$(COMMAND_ECHO)+$(IMPLIB) $(IMPLIBFLAGS) $(SHL$(TNR)IMPLIBN:s/.lib/.a/) $@
297	$(COMMAND_ECHO)+emxomf -o $(SHL$(TNR)IMPLIBN) $(SHL$(TNR)IMPLIBN:s/.lib/.a/)
298
299.ENDIF			# "$(GUI)"=="OS2"
300
301.IF "$(GUI)"=="UNX"
302$(DEF$(TNR)TARGETN): \
303		$(DEF$(TNR)DEPN) \
304		$(DEF$(TNR)EXPORTFILE)
305	@echo just a dummy for UNIX > $@
306.ENDIF
307.ENDIF			# "$(DEF$(TNR)TARGETN)"!=""
308
309
310# Anweisungen fuer das Linken
311# unroll end
312#######################################################
313
314