OSDN Git Service

PR libstdc++/45990
[pf3gnuchains/gcc-fork.git] / libobjc / Makefile.in
1 # Makefile for GNU Objective C runtime library.
2 # Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004,
3 # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
4
5 #This file is part of GCC.
6
7 #GCC is free software; you can redistribute it and/or modify
8 #it under the terms of the GNU General Public License as published by
9 #the Free Software Foundation; either version 3, or (at your option)
10 #any later version.
11
12 #GCC is distributed in the hope that it will be useful,
13 #but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #GNU General Public License for more details.
16
17 #You should have received a copy of the GNU General Public License
18 #along with GCC; see the file COPYING3.  If not see
19 #<http://www.gnu.org/licenses/>.
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 = @SHELL@
26 MAKEOVERRIDES=
27
28 #### Start of system configuration section. ####
29
30 srcdir = @glibcpp_srcdir@
31 VPATH = @glibcpp_srcdir@
32 prefix = @prefix@
33 exec_prefix = @exec_prefix@
34 target_noncanonical = @target_noncanonical@
35 gcc_version := $(shell cat $(srcdir)/../gcc/BASE-VER)
36 host_subdir = @host_subdir@
37 top_srcdir = @top_srcdir@
38 multi_basedir = @multi_basedir@
39 toolexecdir = @toolexecdir@
40 # Toolexecdir is used only by toolexeclibdir
41 toolexeclibdir = @toolexeclibdir@
42
43 includedirname = @includedirname@
44 libsuffix = @libsuffix@
45
46 extra_ldflags_libobjc = @extra_ldflags_libobjc@
47
48 top_builddir = .
49
50 -include ../boehm-gc/threads.mk
51
52 libdir = $(exec_prefix)/lib
53 libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
54
55 # Multilib support variables.
56 MULTISRCTOP =
57 MULTIBUILDTOP =
58 MULTIDIRS =
59 MULTISUBDIR =
60 MULTIDO = true
61 MULTICLEAN = true
62
63 # Not configured per top-level version, since that doesn't get passed
64 # down at configure time, but overrridden by the top-level install
65 # target.
66 INSTALL = @INSTALL@
67 INSTALL_PROGRAM = @INSTALL_PROGRAM@
68 INSTALL_DATA = @INSTALL_DATA@
69
70 AR = @AR@
71 AR_FLAGS = rc
72
73 RANLIB = @RANLIB@
74
75 CC = @CC@
76 CFLAGS = @CFLAGS@
77 WARN_CFLAGS = -W -Wall -Wwrite-strings -Wstrict-prototypes
78 ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(WARN_CFLAGS) \
79         -DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing -fexceptions
80
81 # Libtool
82 # The following strings describe the version of the obj-C library 
83 # begin compiled and compatibility issues.
84 # Please refer to Libtool documentation about how to manage these 
85 # numbers.
86 LIBOBJC_VERSION = @VERSION@
87 LIBOBJC_GC_VERSION = @VERSION@
88 LIBTOOL = @LIBTOOL@ $(LIBTOOLFLAGS)
89 LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
90 LIBTOOL_LINK    = $(LIBTOOL) --mode=link 
91 LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
92 LIBTOOL_CLEAN   = $(LIBTOOL) --mode=clean
93 #LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
94
95 OBJC_GCFLAGS=-DOBJC_WITH_GC=1
96 OBJC_BOEHM_GC=@OBJC_BOEHM_GC@
97 OBJC_BOEHM_GC_INCLUDES=@OBJC_BOEHM_GC_INCLUDES@
98 OBJC_BOEHM_GC_LIBS=../boehm-gc/libgcjgc_convenience.la $(thread_libs_and_flags)
99
100 INCLUDES = -I$(srcdir)/$(MULTISRCTOP)../gcc \
101   -I$(srcdir)/$(MULTISRCTOP)../gcc/config \
102   -I$(MULTIBUILDTOP)../../$(host_subdir)/gcc \
103   -I$(srcdir)/$(MULTISRCTOP)../include \
104   $(OBJC_BOEHM_GC_INCLUDES)
105
106 ##
107 ## The list of header/source files
108 ##
109
110 # User-visible header files, from the objc/ directory
111 OBJC_H = \
112   objc.h \
113   objc-exception.h \
114   objc-sync.h \
115   \
116   NXConstStr.h \
117   Object.h \
118   Protocol.h \
119   encoding.h \
120   message.h \
121   objc-api.h \
122   objc-decls.h \
123   runtime.h \
124   thr.h \
125   \
126   hash.h \
127   objc-list.h \
128   sarray.h \
129   typedstream.h
130
131 # User-visible header files containing deprecated APIs, from the
132 # objc/deprecated directory
133 OBJC_DEPRECATED_H = \
134   METHOD_NULL.h \
135   MetaClass.h \
136   Object.h \
137   STR.h \
138   hash.h \
139   objc-list.h \
140   objc_error.h \
141   objc_get_uninstalled_dtable.h \
142   objc_malloc.h \
143   objc_object_alloc.h \
144   objc_unexpected_exception.h \
145   objc_valloc.h \
146   sarray.h \
147   struct_objc_category.h \
148   struct_objc_class.h \
149   struct_objc_ivar.h \
150   struct_objc_ivar_list.h \
151   struct_objc_method.h \
152   struct_objc_method_list.h \
153   struct_objc_module.h \
154   struct_objc_protocol.h \
155   struct_objc_protocol_list.h \
156   struct_objc_selector.h \
157   struct_objc_static_instances.h \
158   struct_objc_symtab.h \
159   typedstream.h 
160
161 # Objective-C source files to compile
162 OBJC_SOURCE_FILES = \
163    NXConstStr.m \
164    Object.m \
165    Protocol.m \
166    linking.m
167
168 # C source files to compile
169 C_SOURCE_FILES = \
170    archive.c \
171    class.c \
172    encoding.c \
173    error.c \
174    gc.c \
175    hash.c \
176    init.c \
177    ivars.c \
178    memory.c \
179    methods.c \
180    nil_method.c \
181    objc-foreach.c \
182    objc-sync.c \
183    objects.c \
184    protocols.c \
185    sarray.c \
186    selector.c \
187    sendmsg.c \
188    thr.c \
189    exception.c
190
191 # Object files to link (when the library is linked with no GC (Garbage Collection))
192 OBJS = \
193   $(patsubst %.m,%.lo,$(OBJC_SOURCE_FILES)) \
194   $(patsubst %.c,%.lo,$(C_SOURCE_FILES))
195
196 # Object files to link (when the library is linked with GC (Garbage Collection))
197 OBJS_GC = \
198   $(patsubst %.m,%_gc.lo,$(OBJC_SOURCE_FILES)) \
199   $(patsubst %.c,%_gc.lo,$(C_SOURCE_FILES))
200
201
202 ##
203 ## The rules to build
204 ##
205
206 # Flags to pass to a recursive make.
207 FLAGS_TO_PASS = \
208         "AR=$(AR)" \
209         "AR_FLAGS=$(AR_FLAGS)" \
210         "CC=$(CC)" \
211         "CFLAGS=$(CFLAGS)" \
212         "DESTDIR=$(DESTDIR)" \
213         "LIBCFLAGS=$(LIBCFLAGS)" \
214         "EXTRA_OFILES=$(EXTRA_OFILES)" \
215         "HDEFINES=$(HDEFINES)" \
216         "INSTALL=$(INSTALL)" \
217         "INSTALL_DATA=$(INSTALL_DATA)" \
218         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
219         "LDFLAGS=$(LDFLAGS)" \
220         "LIBTOOL=$(LIBTOOL)" \
221         "LOADLIBES=$(LOADLIBES)" \
222         "PICFLAG=$(PICFLAG)" \
223         "RANLIB=$(RANLIB)" \
224         "SHELL=$(SHELL)" \
225         "prefix=$(prefix)" \
226         "exec_prefix=$(exec_prefix)" \
227         "libdir=$(libdir)" \
228         "libsubdir=$(libsubdir)" \
229         "tooldir=$(tooldir)"
230
231 # The 'all' rule must be the first one so that it is executed if
232 # nothing is specified on the command-line.
233 all: libobjc$(libsuffix).la $(OBJC_BOEHM_GC)
234         : $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
235
236 .SUFFIXES:
237 .SUFFIXES: .c .m .lo
238
239 %.lo: %.c
240         $(LIBTOOL_COMPILE) $(CC) $< -c \
241            $(ALL_CFLAGS) $(INCLUDES) \
242            -o $@
243
244 %_gc.lo: %.c
245         $(LIBTOOL_COMPILE) $(CC) $< -c \
246            $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
247            -o $@
248
249 %.lo: %.m
250         $(LIBTOOL_COMPILE) $(CC) $< -c \
251            $(ALL_CFLAGS) $(INCLUDES) -fgnu-runtime \
252            -o $@
253
254 %_gc.lo: %.m
255         $(LIBTOOL_COMPILE) $(CC) $< -c \
256            $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fgnu-runtime \
257            -o $@
258
259 # sendmsg has a special rule because it depends on runtime-info.h.
260 runtime-info.h: 
261         echo "" > tmp-runtime.m
262         echo "/* This file is automatically generated */" > $@
263         $(CC) $(MULTIFLAGS) -print-objc-runtime-info -S tmp-runtime.m >> $@
264         rm -f tmp-runtime.m tmp-runtime.s
265
266 sendmsg.lo: sendmsg.c runtime-info.h
267         $(LIBTOOL_COMPILE) $(CC) $< -c \
268            $(ALL_CFLAGS) $(INCLUDES) \
269            -o $@
270
271 sendmsg_gc.lo: sendmsg.c runtime-info.h
272         $(LIBTOOL_COMPILE) $(CC) $< -c \
273            $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
274            -o $@
275
276 # These files have separate rules because they require special
277 # compiler flags.
278 archive.lo: archive.c
279         $(LIBTOOL_COMPILE) $(CC) $< -c \
280            $(ALL_CFLAGS) $(INCLUDES) -Wno-deprecated-declarations \
281            -o $@
282
283 archive_gc.lo: archive.c
284         $(LIBTOOL_COMPILE) $(CC) $< -c \
285            $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -Wno-deprecated-declarations \
286            -o $@
287
288 # -Wno-deprecated-declarations is for the objc/typedstream.h functions.
289 Object.lo: Object.m
290         $(LIBTOOL_COMPILE) $(CC) $< -c \
291            $(ALL_CFLAGS) $(INCLUDES) -fgnu-runtime -Wno-deprecated-declarations \
292            -o $@
293
294 # -Wno-deprecated-declarations is for the objc/typedstream.h functions.
295 Object_gc.lo: Object.m
296         $(LIBTOOL_COMPILE) $(CC) $< -c \
297            $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fgnu-runtime -Wno-deprecated-declarations \
298            -o $@
299
300 # -Wno-deprecated-declarations is to silence warnings from using 
301 # _objc_unexpected_exception.
302 exception.lo: exception.c
303         $(LIBTOOL_COMPILE) $(CC) $< -c \
304            $(ALL_CFLAGS) $(INCLUDES) -fexceptions -Wno-deprecated-declarations \
305            -o $@
306
307 exception_gc.lo: exception.c
308         $(LIBTOOL_COMPILE) $(CC) $< -c \
309            $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fexceptions -Wno-deprecated-declarations \
310            -o $@
311
312 doc: info dvi pdf html
313
314 # No install-html or install-pdf support
315 .PHONY: install-html install-pdf install-info
316 install-html:
317 install-pdf:
318 install-info:
319
320 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
321
322 libobjc$(libsuffix).la: $(OBJS)
323         $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) \
324                 -rpath $(toolexeclibdir) \
325                 -version-info $(LIBOBJC_VERSION) $(extra_ldflags_libobjc) \
326                 $(LTLDFLAGS)
327
328 libobjc_gc$(libsuffix).la: $(OBJS_GC)
329         $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) $(OBJC_BOEHM_GC_LIBS) \
330                 -rpath $(toolexeclibdir) \
331                 -version-info $(LIBOBJC_GC_VERSION) $(extra_ldflags_libobjc) \
332                 $(LTLDFLAGS)
333
334 info:
335 dvi:
336 pdf:
337 html:
338
339 Makefile: Makefile.in config.status
340         $(SHELL) config.status
341
342 config.status: configure
343         rm -f config.cache
344         CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
345         CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
346
347 AUTOCONF = autoconf
348 ACLOCAL = aclocal
349 ACLOCAL_AMFLAGS = -I ../config -I ..
350 aclocal_deps = \
351         $(srcdir)/../config/multi.m4 \
352         $(srcdir)/../config/override.m4 \
353         $(srcdir)/../config/proginstall.m4 \
354         $(srcdir)/../ltoptions.m4 \
355         $(srcdir)/../ltsugar.m4 \
356         $(srcdir)/../ltversion.m4 \
357         $(srcdir)/../lt~obsolete.m4 \
358         $(srcdir)/acinclude.m4
359
360 $(srcdir)/configure: @MAINT@ configure.ac $(srcdir)/aclocal.m4
361         rm -f config.cache
362         cd $(srcdir) && $(AUTOCONF)
363
364 $(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps)
365         cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
366
367 install: install-libs install-headers
368
369 install-libs: installdirs
370         $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(toolexeclibdir)
371         $(LIBTOOL_INSTALL) $(INSTALL) libobjc$(libsuffix).la $(DESTDIR)$(toolexeclibdir);
372         if [ "$(OBJC_BOEHM_GC)" ]; then \
373           $(LIBTOOL_INSTALL) $(INSTALL) libobjc_gc$(libsuffix).la \
374                                 $(DESTDIR)$(toolexeclibdir);\
375         fi
376         $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
377         @-$(LIBTOOL) --mode=finish $(DESTDIR)$(toolexeclibdir)
378
379 # Copy Objective-C headers to installation include directory.
380 install-headers:
381         $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/objc
382         for file in $(OBJC_H); do \
383           realfile=$(srcdir)/objc/$${file}; \
384           $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc; \
385         done
386         $(multi_basedir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/objc/deprecated
387         for file in $(OBJC_DEPRECATED_H); do \
388           realfile=$(srcdir)/objc/deprecated/$${file}; \
389           $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc/deprecated; \
390         done
391
392 check uninstall install-strip dist installcheck installdirs:
393
394 mostlyclean:
395         -$(LIBTOOL_CLEAN) rm -f libobjc$(libsuffix).la libobjc_gc$(libsuffix).la *.lo
396         -rm -f runtime-info.h tmp-runtime.s *.o *.lo libobjc* xforward \
397                 fflags *.aux *.cp *.dvi *.pdf *.fn *.info *.ky *.log *.pg \
398                 *.toc *.tp *.vr *.html libobj.exp
399         @$(MULTICLEAN) multi-clean DO=mostlyclean
400
401 clean: mostlyclean
402         rm -f config.log
403         @$(MULTICLEAN) multi-clean DO=clean
404
405 distclean: clean
406         @$(MULTICLEAN) multi-clean DO=distclean
407         rm -f config.cache config.status Makefile configure
408
409 maintainer-clean realclean: distclean
410
411 .PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \
412         install-strip dist installcheck installdirs 
413
414 # Don't export variables to the environment, in order to not confuse
415 # configure.
416 .NOEXPORT: