xref: /aoo42x/main/solenv/inc/tg_def.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# 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 $(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 DESCRIPTION	'StarView 3.00 $(DEF$(TNR)DES) $(UPD) $(UPDMINOR)' >>$@.tmpfile
212	@echo EXPORTS													>>$@.tmpfile
213.IF "$(VERSIONOBJ)"!=""
214#	getversioninfo fuer alle!!
215	@echo _GetVersionInfo		>$@.tmp_ord
216.ENDIF
217
218.IF "$(DEFLIB$(TNR)NAME)"!=""
219	@+echo $(SLB)/$(DEFLIB$(TNR)NAME).lib
220	@+emxexpr $(DEF$(TNR)NAMELIST) | fix_exp_file >> $@.tmp_ord
221.ENDIF				# "$(DEFLIB$(TNR)NAME)"!=""
222
223.IF "$(DEF$(TNR)EXPORT1)"!=""
224	@echo $(DEF$(TNR)EXPORT1)										>>$@.tmpfile
225.ENDIF
226.IF "$(DEF$(TNR)EXPORT2)"!=""
227	@echo $(DEF$(TNR)EXPORT2)										>>$@.tmpfile
228.ENDIF
229.IF "$(DEF$(TNR)EXPORT3)"!=""
230	@echo $(DEF$(TNR)EXPORT3)										>>$@.tmpfile
231.ENDIF
232.IF "$(DEF$(TNR)EXPORT4)"!=""
233	@echo $(DEF$(TNR)EXPORT4)										>>$@.tmpfile
234.ENDIF
235.IF "$(DEF$(TNR)EXPORT5)"!=""
236	@echo $(DEF$(TNR)EXPORT5)										>>$@.tmpfile
237.ENDIF
238.IF "$(DEF$(TNR)EXPORT6)"!=""
239	@echo $(DEF$(TNR)EXPORT6)										>>$@.tmpfile
240.ENDIF
241.IF "$(DEF$(TNR)EXPORT7)"!=""
242	@echo $(DEF$(TNR)EXPORT7)										>>$@.tmpfile
243.ENDIF
244.IF "$(DEF$(TNR)EXPORT8)"!=""
245	@echo $(DEF$(TNR)EXPORT8)										>>$@.tmpfile
246.ENDIF
247.IF "$(DEF$(TNR)EXPORT9)"!=""
248	@echo $(DEF$(TNR)EXPORT9)										>>$@.tmpfile
249.ENDIF
250.IF "$(DEF$(TNR)EXPORT10)"!=""
251	@echo $(DEF$(TNR)EXPORT10)										>>$@.tmpfile
252.ENDIF
253.IF "$(DEF$(TNR)EXPORT11)"!=""
254	@echo $(DEF$(TNR)EXPORT11)										>>$@.tmpfile
255.ENDIF
256.IF "$(DEF$(TNR)EXPORT12)"!=""
257	@echo $(DEF$(TNR)EXPORT12)										>>$@.tmpfile
258.ENDIF
259.IF "$(DEF$(TNR)EXPORT13)"!=""
260	@echo $(DEF$(TNR)EXPORT13)										>>$@.tmpfile
261.ENDIF
262.IF "$(DEF$(TNR)EXPORT14)"!=""
263	@echo $(DEF$(TNR)EXPORT14)										>>$@.tmpfile
264.ENDIF
265.IF "$(DEF$(TNR)EXPORT15)"!=""
266	@echo $(DEF$(TNR)EXPORT15)										>>$@.tmpfile
267.ENDIF
268.IF "$(DEF$(TNR)EXPORT16)"!=""
269	@echo $(DEF$(TNR)EXPORT16)										>>$@.tmpfile
270.ENDIF
271.IF "$(DEF$(TNR)EXPORT17)"!=""
272	@echo $(DEF$(TNR)EXPORT17)										>>$@.tmpfile
273.ENDIF
274.IF "$(DEF$(TNR)EXPORT18)"!=""
275	@echo $(DEF$(TNR)EXPORT18)										>>$@.tmpfile
276.ENDIF
277.IF "$(DEF$(TNR)EXPORT19)"!=""
278	@echo $(DEF$(TNR)EXPORT19)										>>$@.tmpfile
279.ENDIF
280.IF "$(DEF$(TNR)EXPORT20)"!=""
281	@echo $(DEF$(TNR)EXPORT20)										>>$@.tmpfile
282.ENDIF
283.IF "$(DEF$(TNR)EXPORTFILE)"!=""
284	@fix_def_file < $(DEF$(TNR)EXPORTFILE) >> $@.tmp_ord
285.ENDIF
286	@sort < $@.tmp_ord | uniq > $@.exptmpfile
287	@fix_def_ord < $@.exptmpfile >> $@.tmpfile
288	@+-$(RM) $@
289	$(COMMAND_ECHO)+$(RENAME) $@.tmpfile $@
290	@+-$(RM) $@.tmp_ord
291	@+-$(RM) $@.exptmpfile
292	$(COMMAND_ECHO)+$(IMPLIB) $(IMPLIBFLAGS) $(SHL$(TNR)IMPLIBN:s/.lib/.a/) $@
293	$(COMMAND_ECHO)+emxomf -o $(SHL$(TNR)IMPLIBN) $(SHL$(TNR)IMPLIBN:s/.lib/.a/)
294
295.ENDIF			# "$(GUI)"=="OS2"
296
297.IF "$(GUI)"=="UNX"
298$(DEF$(TNR)TARGETN): \
299		$(DEF$(TNR)DEPN) \
300		$(DEF$(TNR)EXPORTFILE)
301	@echo just a dummy for UNIX > $@
302.ENDIF
303.ENDIF			# "$(DEF$(TNR)TARGETN)"!=""
304
305
306# Anweisungen fuer das Linken
307# unroll end
308#######################################################
309
310