1 # Makefile for GNU Objective C runtime library.
2 # Copyright (C) 1993-2013 Free Software Foundation, Inc.
4 #This file is part of GCC.
6 #GCC 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 3, or (at your option)
11 #GCC 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.
16 #You should have received a copy of the GNU General Public License
17 #along with GCC; see the file COPYING3. If not see
18 #<http://www.gnu.org/licenses/>.
20 #This was cribbed from the libchill, libiberty and libstdc++
21 #Makefile.in files. Some of this stuff may be unnecessary and
27 #### Start of system configuration section. ####
29 srcdir = @glibcpp_srcdir@
30 VPATH = @glibcpp_srcdir@
32 exec_prefix = @exec_prefix@
33 target_noncanonical = @target_noncanonical@
34 gcc_version := $(shell cat $(srcdir)/../gcc/BASE-VER)
35 host_subdir = @host_subdir@
36 top_srcdir = @top_srcdir@
37 multi_basedir = @multi_basedir@
38 toolexecdir = @toolexecdir@
39 # Toolexecdir is used only by toolexeclibdir
40 toolexeclibdir = @toolexeclibdir@
42 includedirname = @includedirname@
43 libsuffix = @libsuffix@
45 lt_host_flags = @lt_host_flags@
46 extra_ldflags_libobjc = @extra_ldflags_libobjc@
50 -include ../boehm-gc/threads.mk
52 libdir = $(exec_prefix)/lib
53 libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
55 # Multilib support variables.
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
67 INSTALL_PROGRAM = @INSTALL_PROGRAM@
68 INSTALL_DATA = @INSTALL_DATA@
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
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
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
95 OBJC_GCFLAGS=@OBJC_GCFLAGS@
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)
100 INCLUDES = -I$(srcdir)/$(MULTISRCTOP)../gcc \
101 -I$(srcdir)/$(MULTISRCTOP)../gcc/config \
102 -I$(MULTIBUILDTOP)../../$(host_subdir)/gcc \
103 -I$(srcdir)/$(MULTISRCTOP)../libgcc \
104 -I$(MULTIBUILDTOP)../libgcc \
105 -I$(srcdir)/$(MULTISRCTOP)../include \
106 $(OBJC_BOEHM_GC_INCLUDES)
109 ## The list of header/source files
112 # User-visible header files, from the objc/ directory
126 # Objective-C source files to compile
127 OBJC_SOURCE_FILES = \
134 # C source files to compile
156 # Object files to link (when the library is linked with no GC (Garbage Collection))
158 $(patsubst %.m,%.lo,$(OBJC_SOURCE_FILES)) \
159 $(patsubst %.c,%.lo,$(C_SOURCE_FILES))
161 # Object files to link (when the library is linked with GC (Garbage Collection))
163 $(patsubst %.m,%_gc.lo,$(OBJC_SOURCE_FILES)) \
164 $(patsubst %.c,%_gc.lo,$(C_SOURCE_FILES))
168 ## The rules to build
171 # Flags to pass to a recursive make.
174 "AR_FLAGS=$(AR_FLAGS)" \
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)" \
191 "exec_prefix=$(exec_prefix)" \
193 "libsubdir=$(libsubdir)" \
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
205 $(LIBTOOL_COMPILE) $(CC) $< -c \
206 $(ALL_CFLAGS) $(INCLUDES) \
210 $(LIBTOOL_COMPILE) $(CC) $< -c \
211 $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
215 $(LIBTOOL_COMPILE) $(CC) $< -c \
216 $(ALL_CFLAGS) $(INCLUDES) -fgnu-runtime \
220 $(LIBTOOL_COMPILE) $(CC) $< -c \
221 $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fgnu-runtime \
224 # sendmsg has a special rule because it depends on 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
231 sendmsg.lo: sendmsg.c runtime-info.h
232 $(LIBTOOL_COMPILE) $(CC) $< -c \
233 $(ALL_CFLAGS) $(INCLUDES) \
236 sendmsg_gc.lo: sendmsg.c runtime-info.h
237 $(LIBTOOL_COMPILE) $(CC) $< -c \
238 $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
241 # These files have separate rules because they require special
244 exception.lo: exception.c
245 $(LIBTOOL_COMPILE) $(CC) $< -c \
246 $(ALL_CFLAGS) $(INCLUDES) -fexceptions \
249 exception_gc.lo: exception.c
250 $(LIBTOOL_COMPILE) $(CC) $< -c \
251 $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fexceptions \
254 doc: info dvi pdf html
256 # No install-html or install-pdf support
257 .PHONY: install-html install-pdf install-info
262 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
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) \
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) \
281 Makefile: Makefile.in config.status
282 $(SHELL) config.status
284 config.status: configure
286 CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
287 CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
291 ACLOCAL_AMFLAGS = -I ../config -I ..
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
302 $(srcdir)/configure: @MAINT@ configure.ac $(srcdir)/aclocal.m4
304 cd $(srcdir) && $(AUTOCONF)
306 $(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps)
307 cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
309 install: install-libs install-headers
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);\
318 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
319 @-$(LIBTOOL) --mode=finish $(DESTDIR)$(toolexeclibdir)
321 # Copy Objective-C headers to installation include directory.
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; \
329 check uninstall install-strip dist installcheck installdirs:
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
340 @$(MULTICLEAN) multi-clean DO=clean
343 @$(MULTICLEAN) multi-clean DO=distclean
344 rm -f config.cache config.status Makefile configure
346 maintainer-clean realclean: distclean
348 .PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \
349 install-strip dist installcheck installdirs
351 # Don't export variables to the environment, in order to not confuse