OSDN Git Service

2002-02-11 Andrew Haley <aph@cambridge.redhat.com>
[pf3gnuchains/gcc-fork.git] / libobjc / Makefile.in
1 #Makefile for GNU Objective C runtime library.
2 #Copyright (C) 1993, 95-98, 1999, 2001 Free Software Foundation, Inc.
3
4 #This file is part of GNU CC.
5
6 #GNU CC is free software; you can redistribute it and/or modify
7 #it under the terms of the GNU General Public License as published by
8 #the Free Software Foundation; either version 2, or (at your option)
9 #any later version.
10
11 #GNU CC is distributed in the hope that it will be useful,
12 #but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 #GNU General Public License for more details.
15
16 #You should have received a copy of the GNU General Public License
17 #along with GNU CC; see the file COPYING.  If not, write to
18 #the Free Software Foundation, 59 Temple Place - Suite 330,
19 #Boston, MA 02111-1307, USA.  */
20
21 #This was cribbed from the libchill, libiberty and libstdc++
22 #Makefile.in files.  Some of this stuff may be unnecessary and
23 #worthless.
24
25 SHELL = /bin/sh
26
27 #### Start of system configuration section. ####
28
29 srcdir = @srcdir@
30 VPATH = @srcdir@
31 prefix = @prefix@
32 exec_prefix = @exec_prefix@
33 target_alias = @target_alias@
34 gcc_version = @gcc_version@
35 gcc_version_trigger = @gcc_version_trigger@
36
37 libdir = $(exec_prefix)/lib
38 libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
39 incinstalldir = $(libsubdir)/include
40
41 # Multilib support variables.
42 MULTISRCTOP =
43 MULTIBUILDTOP =
44 MULTIDIRS =
45 MULTISUBDIR =
46 MULTIDO = true
47 MULTICLEAN = true
48
49 # Not configured per top-level version, since that doesn't get passed
50 # down at configure time, but overrridden by the top-level install
51 # target.
52 INSTALL = @INSTALL@
53 INSTALL_PROGRAM = @INSTALL_PROGRAM@
54 INSTALL_DATA = @INSTALL_DATA@
55
56 AR = @AR@
57 AR_FLAGS = rc
58
59 RANLIB = @RANLIB@
60
61 CC = @CC@
62 CFLAGS = @CFLAGS@
63 GTHREAD_FLAGS=@GTHREAD_FLAGS@
64 ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) \
65         $(GTHREAD_FLAGS) -DIN_GCC -DIN_TARGET_LIBS
66
67 # Libtool
68 # The following strings describe the version of the obj-C library 
69 # begin compiled and compatibility issues.
70 # Please refer to Libtool documentation about how to manage these 
71 # numbers.
72 LIBOBJC_VERSION = 1:0:0
73 LIBOBJC_GC_VERSION = 1:0:0
74 # @LIBTOOL@ does not get it right, so we hack it in - FIXME
75 LIBTOOL = ./libtool
76 LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
77 LIBTOOL_LINK    = $(LIBTOOL) --mode=link 
78 LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
79 LIBTOOL_CLEAN   = $(LIBTOOL) --mode=clean
80 #LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
81
82 #
83 # Define the cc1obj in terms of the CC that is passed on from higher
84 # level make. This is needed to make sure we can create runtime-info.h
85 # when doing canadian cross builds where running ../../gcc/cc1obj 
86 # does not make any sense.
87 #
88 CC1OBJ = `$(CC) -print-prog-name=cc1obj`
89
90 INCLUDES = -I$(srcdir)/objc  -I$(srcdir)/$(MULTISRCTOP)../gcc \
91   -I$(srcdir)/$(MULTISRCTOP)../gcc/config -I$(MULTIBUILDTOP)../../gcc \
92   -I$(srcdir)/$(MULTISRCTOP)../include
93
94 OBJC_GCFLAGS=-DOBJC_WITH_GC=1
95 OBJC_THREAD_FILE=thr-objc
96 OBJC_BOEHM_GC=@OBJC_BOEHM_GC@
97
98 .SUFFIXES:
99 .SUFFIXES: .c .m .lo
100
101 .c.lo:
102         $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
103
104 .m.lo:
105         $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
106
107 # Flags to pass to a recursive make.
108 FLAGS_TO_PASS = \
109         "AR=$(AR)" \
110         "AR_FLAGS=$(AR_FLAGS)" \
111         "CC=$(CC)" \
112         "CFLAGS=$(CFLAGS)" \
113         "LIBCFLAGS=$(LIBCFLAGS)" \
114         "EXTRA_OFILES=$(EXTRA_OFILES)" \
115         "HDEFINES=$(HDEFINES)" \
116         "INSTALL=$(INSTALL)" \
117         "INSTALL_DATA=$(INSTALL_DATA)" \
118         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
119         "LDFLAGS=$(LDFLAGS)" \
120         "LIBTOOL=$(LIBTOOL)" \
121         "LOADLIBES=$(LOADLIBES)" \
122         "PICFLAG=$(PICFLAG)" \
123         "RANLIB=$(RANLIB)" \
124         "SHELL=$(SHELL)" \
125         "prefix=$(prefix)" \
126         "exec_prefix=$(exec_prefix)" \
127         "libdir=$(libdir)" \
128         "libsubdir=$(libsubdir)" \
129         "tooldir=$(tooldir)"
130
131 all: libobjc.la $(OBJC_BOEHM_GC)
132         $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
133
134 # User-visible header files.
135
136 OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \
137          NXConstStr.h Object.h Protocol.h encoding.h typedstream.h \
138          thr.h
139
140 # Modules that comprise the runtime library.
141
142 OBJS =    archive.lo class.lo encoding.lo gc.lo hash.lo init.lo linking.lo \
143           misc.lo nil_method.lo NXConstStr.lo Object.lo objects.lo \
144           Protocol.lo sarray.lo selector.lo sendmsg.lo thr.lo \
145           $(OBJC_THREAD_FILE).lo
146
147 OBJS_GC = archive_gc.lo class_gc.lo encoding_gc.lo gc_gc.lo hash_gc.lo \
148           init_gc.lo linking_gc.lo misc_gc.lo nil_method_gc.lo \
149           NXConstStr_gc.lo Object_gc.lo objects_gc.lo Protocol_gc.lo \
150           sarray_gc.lo selector_gc.lo sendmsg_gc.lo thr_gc.lo \
151           $(OBJC_THREAD_FILE)_gc.lo
152
153 runtime-info.h: 
154         echo "" > tmp-runtime
155         echo "/* This file is automatically generated */" > $@
156         $(CC1OBJ) -print-objc-runtime-info tmp-runtime >> $@
157         rm -f tmp-runtime
158
159 archive_gc.lo: archive.c
160         $(LIBTOOL_COMPILE) $(CC) -c  -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
161                 $(INCLUDES) $<
162
163 class_gc.lo: class.c
164         $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
165                 $(INCLUDES) $<
166
167 encoding_gc.lo: encoding.c
168         $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
169                 $(INCLUDES) $<
170
171 gc.lo: gc.c
172         $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
173
174 gc_gc.lo: gc.c
175         $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
176                 $(INCLUDES) $<
177
178 hash_gc.lo: hash.c
179         $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
180                 $(INCLUDES) $<
181
182 init_gc.lo: init.c
183         $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
184                 $(INCLUDES) $<
185
186 linking.lo: linking.m
187         $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
188                 $(INCLUDES) $<
189
190 linking_gc.lo: linking.m
191         $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
192                 $(OBJC_GCFLAGS) $(INCLUDES) $<
193
194 misc_gc.lo: misc.c
195         $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
196                 $(INCLUDES) $<
197
198 nil_method_gc.lo: nil_method.c
199         $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
200                 $(INCLUDES) $<
201
202 NXConstStr.lo: NXConstStr.m
203         $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
204                 $(INCLUDES) $<
205
206 NXConstStr_gc.lo: NXConstStr.m
207         $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
208                 $(OBJC_GCFLAGS) $(INCLUDES) $<
209
210 Object.lo: Object.m
211         $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
212                 $(INCLUDES) $<
213
214 Object_gc.lo: Object.m
215         $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
216                 $(OBJC_GCFLAGS) $(INCLUDES) $<
217
218 objects_gc.lo: objects.c
219         $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
220                 $(INCLUDES) $<
221
222 Protocol.lo: Protocol.m
223         $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
224                 $(INCLUDES) $<
225
226 Protocol_gc.lo: Protocol.m
227         $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
228                 $(OBJC_GCFLAGS) $(INCLUDES) $<
229
230 sarray_gc.lo: sarray.c
231         $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
232                 $(INCLUDES) $<
233
234 selector_gc.lo: selector.c
235         $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
236                 $(INCLUDES) $<
237
238 sendmsg.lo: sendmsg.c runtime-info.h
239         $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
240
241 sendmsg_gc.lo: sendmsg.c runtime-info.h
242         $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
243                 $(INCLUDES) $<
244
245 thr_gc.lo: thr.c
246         $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
247                 $(INCLUDES) $<
248
249 $(OBJC_THREAD_FILE)_gc.lo: $(OBJC_THREAD_FILE).c
250         $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
251                 $(INCLUDES) $<
252
253 doc: info dvi html
254
255 libobjc.la: $(OBJS)
256         $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) -rpath $(libsubdir) \
257                 -version-info $(LIBOBJC_VERSION)
258
259 libobjc_gc.la: $(OBJS_GC)
260         $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) -rpath $(libsubdir) \
261                 -version-info $(LIBOBJC_GC_VERSION)
262
263 #
264 # FIXME -- The following part does not fit in the libtool context. 
265 # Libtool is supposed to [going to] be able to create a win 32 DLL 
266 # without extra code but since I don't have a win machine to test 
267 # if it already works, I leave the old code here.
268 #
269 libobjc_s.a: libobjc.la
270         mv libobjc.a libobjc_s.a
271
272 # Create a relocatable DLL
273 libobjc.dll: libobjc_s.a libobjc_entry.o
274         $(CC) -mdll -Wl,--base-file -Wl,libobjc.base \
275                 -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
276         $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
277                 --base-file libobjc.base --output-exp libobjc.exp
278         $(GCC_FOR_TARGET) -mdll -Wl,--base-file libobjc.base libobjc.exp \
279                 -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
280         $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
281                 --base-file libobjc.base --output-exp libobjc.exp
282         $(GCC_FOR_TARGET) libobjc.exp -mdll \
283                 -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
284         $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
285                 --output-lib libobjc.a
286 #
287 #
288 #
289 #
290 #
291
292 info:
293 dvi:
294 html:
295
296 Makefile: Makefile.in config.status
297         $(SHELL) config.status
298
299 config.status: configure
300         rm -f config.cache
301         CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
302         CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
303
304 ${srcdir}/configure: configure.in
305         rm -f config.cache
306         cd ${srcdir} && autoconf
307
308 install: install-libs copy-headers
309
310 install-libs: installdirs
311         $(LIBTOOL_INSTALL) $(INSTALL_DATA) libobjc.la $(libsubdir)/libobjc.la;
312         if [ "$(OBJC_BOEHM_GC)" ]; then \
313           $(LIBTOOL_INSTALL) $(INSTALL_DATA) libobjc_gc.la \
314                                 $(libsubdir)/libobjc_gc.la;\
315         fi
316
317 # Copy Objective C headers to installation include directory.
318 copy-headers:
319         -rm -rf $(incinstalldir)/objc
320         -mkdir $(incinstalldir)/objc
321         -chmod a+rx $(incinstalldir)/objc
322         for file in $(OBJC_H); do \
323           realfile=$(srcdir)/objc/$${file}; \
324           cp $${realfile} $(incinstalldir)/objc; \
325           chmod a+r $(incinstalldir)/objc/$${file}; \
326         done
327
328 check uninstall install-strip dist installcheck installdirs:
329
330 mostlyclean:
331         -$(LIBTOOL_CLEAN) rm -f libobjc.la libobjc_gc.la *.lo
332         -rm -f runtime-info.h tmp-runtime.s *.o *.lo libobjc* xforward \
333                 fflags *.aux *.cp *.dvi *.fn *.info *.ky *.log *.pg \
334                 *.toc *.tp *.vr *.html libobj.exp
335         @$(MULTICLEAN) multi-clean DO=mostlyclean
336
337 clean: mostlyclean
338         rm -f config.log
339         @$(MULTICLEAN) multi-clean DO=clean
340
341 distclean: clean
342         @$(MULTICLEAN) multi-clean DO=distclean
343         rm -f config.cache config.status Makefile configure
344
345 maintainer-clean realclean: distclean
346
347 .PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \
348         install-strip dist installcheck installdirs