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