OSDN Git Service

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