OSDN Git Service

2011-09-27 Richard Guenther <rguenther@suse.de>
[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, 2010 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=@OBJC_GCFLAGS@
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)../libgcc \
105   -I$(srcdir)/$(MULTISRCTOP)../include \
106   $(OBJC_BOEHM_GC_INCLUDES)
107
108 ##
109 ## The list of header/source files
110 ##
111
112 # User-visible header files, from the objc/ directory
113 OBJC_H = \
114   objc.h \
115   objc-exception.h \
116   objc-sync.h \
117   \
118   NXConstStr.h \
119   Object.h \
120   Protocol.h \
121   message.h \
122   objc-decls.h \
123   runtime.h \
124   thr.h
125
126 # Objective-C source files to compile
127 OBJC_SOURCE_FILES = \
128    NXConstStr.m \
129    Object.m \
130    Protocol.m \
131    accessors.m \
132    linking.m
133
134 # C source files to compile
135 C_SOURCE_FILES = \
136    class.c \
137    encoding.c \
138    error.c \
139    gc.c \
140    hash.c \
141    init.c \
142    ivars.c \
143    memory.c \
144    methods.c \
145    nil_method.c \
146    objc-foreach.c \
147    objc-sync.c \
148    objects.c \
149    protocols.c \
150    sarray.c \
151    selector.c \
152    sendmsg.c \
153    thr.c \
154    exception.c
155
156 # Object files to link (when the library is linked with no GC (Garbage Collection))
157 OBJS = \
158   $(patsubst %.m,%.lo,$(OBJC_SOURCE_FILES)) \
159   $(patsubst %.c,%.lo,$(C_SOURCE_FILES))
160
161 # Object files to link (when the library is linked with GC (Garbage Collection))
162 OBJS_GC = \
163   $(patsubst %.m,%_gc.lo,$(OBJC_SOURCE_FILES)) \
164   $(patsubst %.c,%_gc.lo,$(C_SOURCE_FILES))
165
166
167 ##
168 ## The rules to build
169 ##
170
171 # Flags to pass to a recursive make.
172 FLAGS_TO_PASS = \
173         "AR=$(AR)" \
174         "AR_FLAGS=$(AR_FLAGS)" \
175         "CC=$(CC)" \
176         "CFLAGS=$(CFLAGS)" \
177         "DESTDIR=$(DESTDIR)" \
178         "LIBCFLAGS=$(LIBCFLAGS)" \
179         "EXTRA_OFILES=$(EXTRA_OFILES)" \
180         "HDEFINES=$(HDEFINES)" \
181         "INSTALL=$(INSTALL)" \
182         "INSTALL_DATA=$(INSTALL_DATA)" \
183         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
184         "LDFLAGS=$(LDFLAGS)" \
185         "LIBTOOL=$(LIBTOOL)" \
186         "LOADLIBES=$(LOADLIBES)" \
187         "PICFLAG=$(PICFLAG)" \
188         "RANLIB=$(RANLIB)" \
189         "SHELL=$(SHELL)" \
190         "prefix=$(prefix)" \
191         "exec_prefix=$(exec_prefix)" \
192         "libdir=$(libdir)" \
193         "libsubdir=$(libsubdir)" \
194         "tooldir=$(tooldir)"
195
196 # The 'all' rule must be the first one so that it is executed if
197 # nothing is specified on the command-line.
198 all: libobjc$(libsuffix).la $(OBJC_BOEHM_GC)
199         : $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
200
201 .SUFFIXES:
202 .SUFFIXES: .c .m .lo
203
204 %.lo: %.c
205         $(LIBTOOL_COMPILE) $(CC) $< -c \
206            $(ALL_CFLAGS) $(INCLUDES) \
207            -o $@
208
209 %_gc.lo: %.c
210         $(LIBTOOL_COMPILE) $(CC) $< -c \
211            $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
212            -o $@
213
214 %.lo: %.m
215         $(LIBTOOL_COMPILE) $(CC) $< -c \
216            $(ALL_CFLAGS) $(INCLUDES) -fgnu-runtime \
217            -o $@
218
219 %_gc.lo: %.m
220         $(LIBTOOL_COMPILE) $(CC) $< -c \
221            $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fgnu-runtime \
222            -o $@
223
224 # sendmsg has a special rule because it depends on runtime-info.h.
225 runtime-info.h: 
226         echo "" > tmp-runtime.m
227         echo "/* This file is automatically generated */" > $@
228         $(CC) $(MULTIFLAGS) -print-objc-runtime-info -S tmp-runtime.m >> $@
229         rm -f tmp-runtime.m tmp-runtime.s
230
231 sendmsg.lo: sendmsg.c runtime-info.h
232         $(LIBTOOL_COMPILE) $(CC) $< -c \
233            $(ALL_CFLAGS) $(INCLUDES) \
234            -o $@
235
236 sendmsg_gc.lo: sendmsg.c runtime-info.h
237         $(LIBTOOL_COMPILE) $(CC) $< -c \
238            $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
239            -o $@
240
241 # These files have separate rules because they require special
242 # compiler flags.
243
244 exception.lo: exception.c
245         $(LIBTOOL_COMPILE) $(CC) $< -c \
246            $(ALL_CFLAGS) $(INCLUDES) -fexceptions \
247            -o $@
248
249 exception_gc.lo: exception.c
250         $(LIBTOOL_COMPILE) $(CC) $< -c \
251            $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fexceptions \
252            -o $@
253
254 doc: info dvi pdf html
255
256 # No install-html or install-pdf support
257 .PHONY: install-html install-pdf install-info
258 install-html:
259 install-pdf:
260 install-info:
261
262 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
263
264 libobjc$(libsuffix).la: $(OBJS)
265         $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) \
266                 -Wc,-shared-libgcc -rpath $(toolexeclibdir) \
267                 -version-info $(LIBOBJC_VERSION) $(extra_ldflags_libobjc) \
268                 $(LTLDFLAGS)
269
270 libobjc_gc$(libsuffix).la: $(OBJS_GC)
271         $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) $(OBJC_BOEHM_GC_LIBS) \
272                 -Wc,-shared-libgcc -rpath $(toolexeclibdir) \
273                 -version-info $(LIBOBJC_GC_VERSION) $(extra_ldflags_libobjc) \
274                 $(LTLDFLAGS)
275
276 info:
277 dvi:
278 pdf:
279 html:
280
281 Makefile: Makefile.in config.status
282         $(SHELL) config.status
283
284 config.status: configure
285         rm -f config.cache
286         CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
287         CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
288
289 AUTOCONF = autoconf
290 ACLOCAL = aclocal
291 ACLOCAL_AMFLAGS = -I ../config -I ..
292 aclocal_deps = \
293         $(srcdir)/../config/multi.m4 \
294         $(srcdir)/../config/override.m4 \
295         $(srcdir)/../config/proginstall.m4 \
296         $(srcdir)/../ltoptions.m4 \
297         $(srcdir)/../ltsugar.m4 \
298         $(srcdir)/../ltversion.m4 \
299         $(srcdir)/../lt~obsolete.m4 \
300         $(srcdir)/acinclude.m4
301
302 $(srcdir)/configure: @MAINT@ configure.ac $(srcdir)/aclocal.m4
303         rm -f config.cache
304         cd $(srcdir) && $(AUTOCONF)
305
306 $(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps)
307         cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
308
309 install: install-libs install-headers
310
311 install-libs: installdirs
312         $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(toolexeclibdir)
313         $(LIBTOOL_INSTALL) $(INSTALL) libobjc$(libsuffix).la $(DESTDIR)$(toolexeclibdir);
314         if [ "$(OBJC_BOEHM_GC)" ]; then \
315           $(LIBTOOL_INSTALL) $(INSTALL) libobjc_gc$(libsuffix).la \
316                                 $(DESTDIR)$(toolexeclibdir);\
317         fi
318         $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
319         @-$(LIBTOOL) --mode=finish $(DESTDIR)$(toolexeclibdir)
320
321 # Copy Objective-C headers to installation include directory.
322 install-headers:
323         $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/objc
324         for file in $(OBJC_H); do \
325           realfile=$(srcdir)/objc/$${file}; \
326           $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc; \
327         done
328
329 check uninstall install-strip dist installcheck installdirs:
330
331 mostlyclean:
332         -$(LIBTOOL_CLEAN) rm -f libobjc$(libsuffix).la libobjc_gc$(libsuffix).la *.lo
333         -rm -f runtime-info.h tmp-runtime.s *.o *.lo libobjc* xforward \
334                 fflags *.aux *.cp *.dvi *.pdf *.fn *.info *.ky *.log *.pg \
335                 *.toc *.tp *.vr *.html libobj.exp
336         @$(MULTICLEAN) multi-clean DO=mostlyclean
337
338 clean: mostlyclean
339         rm -f config.log
340         @$(MULTICLEAN) multi-clean DO=clean
341
342 distclean: clean
343         @$(MULTICLEAN) multi-clean DO=distclean
344         rm -f config.cache config.status Makefile configure
345
346 maintainer-clean realclean: distclean
347
348 .PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \
349         install-strip dist installcheck installdirs 
350
351 # Don't export variables to the environment, in order to not confuse
352 # configure.
353 .NOEXPORT: