]>
Commit | Line | Data |
---|---|---|
05dcec66 | 1 | # Makefile for GNU Objective C runtime library. |
83ffe9cd | 2 | # Copyright (C) 1993-2023 Free Software Foundation, Inc. |
bce1b489 | 3 | |
6c82ad25 | 4 | #This file is part of GCC. |
bce1b489 | 5 | |
6c82ad25 | 6 | #GCC is free software; you can redistribute it and/or modify |
bce1b489 | 7 | #it under the terms of the GNU General Public License as published by |
748086b7 | 8 | #the Free Software Foundation; either version 3, or (at your option) |
bce1b489 BE |
9 | #any later version. |
10 | ||
6c82ad25 | 11 | #GCC is distributed in the hope that it will be useful, |
bce1b489 BE |
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 | |
748086b7 JJ |
17 | #along with GCC; see the file COPYING3. If not see |
18 | #<http://www.gnu.org/licenses/>. | |
bce1b489 BE |
19 | |
20 | #This was cribbed from the libchill, libiberty and libstdc++ | |
21 | #Makefile.in files. Some of this stuff may be unnecessary and | |
22 | #worthless. | |
23 | ||
9aa338ec | 24 | SHELL = @SHELL@ |
b150efee | 25 | MAKEOVERRIDES= |
bce1b489 BE |
26 | |
27 | #### Start of system configuration section. #### | |
28 | ||
b150efee FS |
29 | srcdir = @glibcpp_srcdir@ |
30 | VPATH = @glibcpp_srcdir@ | |
bce1b489 BE |
31 | prefix = @prefix@ |
32 | exec_prefix = @exec_prefix@ | |
9c01f395 | 33 | target_noncanonical = @target_noncanonical@ |
3c36aa6b | 34 | gcc_version := $(shell @get_gcc_base_ver@ $(srcdir)/../gcc/BASE-VER) |
215c351a | 35 | host_subdir = @host_subdir@ |
b150efee | 36 | top_srcdir = @top_srcdir@ |
5b043f08 | 37 | multi_basedir = @multi_basedir@ |
eb01299a | 38 | toolexecdir = @toolexecdir@ |
a42a57cb | 39 | # Toolexecdir is used only by toolexeclibdir |
608e1e0c | 40 | toolexeclibdir = @toolexeclibdir@ |
b150efee | 41 | |
7d34a5a9 | 42 | includedirname = @includedirname@ |
45d5f86c | 43 | libsuffix = @libsuffix@ |
ff65de76 | 44 | |
7de6ba7a | 45 | lt_host_flags = @lt_host_flags@ |
a5a813f8 AP |
46 | extra_ldflags_libobjc = @extra_ldflags_libobjc@ |
47 | ||
b150efee | 48 | top_builddir = . |
bce1b489 BE |
49 | |
50 | libdir = $(exec_prefix)/lib | |
9c01f395 | 51 | libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version) |
bce1b489 BE |
52 | |
53 | # Multilib support variables. | |
54 | MULTISRCTOP = | |
55 | MULTIBUILDTOP = | |
56 | MULTIDIRS = | |
57 | MULTISUBDIR = | |
58 | MULTIDO = true | |
59 | MULTICLEAN = true | |
60 | ||
61 | # Not configured per top-level version, since that doesn't get passed | |
62 | # down at configure time, but overrridden by the top-level install | |
63 | # target. | |
64 | INSTALL = @INSTALL@ | |
65 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |
66 | INSTALL_DATA = @INSTALL_DATA@ | |
67 | ||
68 | AR = @AR@ | |
69 | AR_FLAGS = rc | |
70 | ||
71 | RANLIB = @RANLIB@ | |
72 | ||
73 | CC = @CC@ | |
74 | CFLAGS = @CFLAGS@ | |
7b7168cf | 75 | XCFLAGS = @XCFLAGS@ |
9aa338ec | 76 | WARN_CFLAGS = -W -Wall -Wwrite-strings -Wstrict-prototypes |
7b7168cf IT |
77 | ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) \ |
78 | $(XCFLAGS) $(CFLAGS) $(WARN_CFLAGS) \ | |
84fd360d | 79 | -DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing -fexceptions |
bce1b489 | 80 | |
c161c99b NP |
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. | |
68a1af87 MH |
86 | LIBOBJC_VERSION = @VERSION@ |
87 | LIBOBJC_GC_VERSION = @VERSION@ | |
84fec8a5 | 88 | LIBTOOL = @LIBTOOL@ $(LIBTOOLFLAGS) |
c161c99b NP |
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 | ||
b98b952f | 95 | OBJC_GCFLAGS=@OBJC_GCFLAGS@ |
8c3e5222 DA |
96 | OBJC_BOEHM_GC=@OBJC_BOEHM_GC@ |
97 | OBJC_BOEHM_GC_INCLUDES=@OBJC_BOEHM_GC_INCLUDES@ | |
114bf3f1 | 98 | OBJC_BOEHM_GC_LIBS=@OBJC_BOEHM_GC_LIBS@ |
8c3e5222 | 99 | |
7e268280 | 100 | INCLUDES = -I$(srcdir)/$(MULTISRCTOP)../gcc \ |
215c351a PB |
101 | -I$(srcdir)/$(MULTISRCTOP)../gcc/config \ |
102 | -I$(MULTIBUILDTOP)../../$(host_subdir)/gcc \ | |
201cdb74 | 103 | -I$(srcdir)/$(MULTISRCTOP)../libgcc \ |
5d1c8e77 | 104 | -I$(MULTIBUILDTOP)../libgcc \ |
8c3e5222 DA |
105 | -I$(srcdir)/$(MULTISRCTOP)../include \ |
106 | $(OBJC_BOEHM_GC_INCLUDES) | |
bce1b489 | 107 | |
7e268280 NP |
108 | ## |
109 | ## The list of header/source files | |
110 | ## | |
bce1b489 | 111 | |
e976a775 | 112 | # User-visible header files, from the objc/ directory |
3d0d8739 NP |
113 | OBJC_H = \ |
114 | objc.h \ | |
115 | objc-exception.h \ | |
fd312537 | 116 | objc-sync.h \ |
3d0d8739 | 117 | \ |
3d0d8739 NP |
118 | NXConstStr.h \ |
119 | Object.h \ | |
120 | Protocol.h \ | |
7b869986 | 121 | message.h \ |
7b869986 | 122 | objc-decls.h \ |
f05b9d93 | 123 | runtime.h \ |
dd3dba52 | 124 | thr.h |
bce1b489 | 125 | |
7e268280 NP |
126 | # Objective-C source files to compile |
127 | OBJC_SOURCE_FILES = \ | |
128 | NXConstStr.m \ | |
129 | Object.m \ | |
130 | Protocol.m \ | |
682e805a | 131 | accessors.m \ |
7e268280 NP |
132 | linking.m |
133 | ||
134 | # C source files to compile | |
135 | C_SOURCE_FILES = \ | |
7e268280 NP |
136 | class.c \ |
137 | encoding.c \ | |
138 | error.c \ | |
139 | gc.c \ | |
140 | hash.c \ | |
141 | init.c \ | |
fdcbbfe7 | 142 | ivars.c \ |
7e268280 | 143 | memory.c \ |
ad9eef11 | 144 | methods.c \ |
7e268280 | 145 | nil_method.c \ |
f05b9d93 | 146 | objc-foreach.c \ |
fd312537 | 147 | objc-sync.c \ |
7e268280 | 148 | objects.c \ |
debfbfee | 149 | protocols.c \ |
7e268280 NP |
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)) | |
7b869986 | 162 | OBJS_GC = \ |
7e268280 NP |
163 | $(patsubst %.m,%_gc.lo,$(OBJC_SOURCE_FILES)) \ |
164 | $(patsubst %.c,%_gc.lo,$(C_SOURCE_FILES)) | |
bce1b489 | 165 | |
bce1b489 | 166 | |
7e268280 NP |
167 | ## |
168 | ## The rules to build | |
169 | ## | |
bce1b489 | 170 | |
7e268280 NP |
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)" | |
bce1b489 | 195 | |
7e268280 NP |
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 | |
7b869986 | 200 | |
7e268280 NP |
201 | .SUFFIXES: |
202 | .SUFFIXES: .c .m .lo | |
bce1b489 | 203 | |
7e268280 NP |
204 | %.lo: %.c |
205 | $(LIBTOOL_COMPILE) $(CC) $< -c \ | |
206 | $(ALL_CFLAGS) $(INCLUDES) \ | |
207 | -o $@ | |
bce1b489 | 208 | |
7e268280 NP |
209 | %_gc.lo: %.c |
210 | $(LIBTOOL_COMPILE) $(CC) $< -c \ | |
211 | $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \ | |
212 | -o $@ | |
bce1b489 | 213 | |
7e268280 NP |
214 | %.lo: %.m |
215 | $(LIBTOOL_COMPILE) $(CC) $< -c \ | |
216 | $(ALL_CFLAGS) $(INCLUDES) -fgnu-runtime \ | |
217 | -o $@ | |
bce1b489 | 218 | |
7e268280 NP |
219 | %_gc.lo: %.m |
220 | $(LIBTOOL_COMPILE) $(CC) $< -c \ | |
221 | $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fgnu-runtime \ | |
222 | -o $@ | |
bce1b489 | 223 | |
7e268280 NP |
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 | |
bce1b489 | 230 | |
7e268280 NP |
231 | sendmsg.lo: sendmsg.c runtime-info.h |
232 | $(LIBTOOL_COMPILE) $(CC) $< -c \ | |
233 | $(ALL_CFLAGS) $(INCLUDES) \ | |
234 | -o $@ | |
bce1b489 | 235 | |
7e268280 NP |
236 | sendmsg_gc.lo: sendmsg.c runtime-info.h |
237 | $(LIBTOOL_COMPILE) $(CC) $< -c \ | |
238 | $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \ | |
239 | -o $@ | |
bce1b489 | 240 | |
7e268280 NP |
241 | # These files have separate rules because they require special |
242 | # compiler flags. | |
bce1b489 | 243 | |
a776161b | 244 | exception.lo: exception.c |
7e268280 | 245 | $(LIBTOOL_COMPILE) $(CC) $< -c \ |
309ce401 | 246 | $(ALL_CFLAGS) $(INCLUDES) -fexceptions \ |
7e268280 | 247 | -o $@ |
5520b936 AM |
248 | |
249 | exception_gc.lo: exception.c | |
7e268280 | 250 | $(LIBTOOL_COMPILE) $(CC) $< -c \ |
309ce401 | 251 | $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fexceptions \ |
7e268280 | 252 | -o $@ |
a776161b | 253 | |
b5422ad7 | 254 | doc: info dvi pdf html |
bce1b489 | 255 | |
38593123 | 256 | # No install-html or install-pdf support |
a0ed5099 | 257 | .PHONY: install-html install-pdf install-info |
2788992b | 258 | install-html: |
38593123 | 259 | install-pdf: |
a0ed5099 | 260 | install-info: |
2788992b | 261 | |
7afa92c5 JB |
262 | LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) |
263 | ||
45d5f86c | 264 | libobjc$(libsuffix).la: $(OBJS) |
b150efee | 265 | $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) \ |
1d439e6c | 266 | -Wc,-shared-libgcc -rpath $(toolexeclibdir) \ |
7afa92c5 JB |
267 | -version-info $(LIBOBJC_VERSION) $(extra_ldflags_libobjc) \ |
268 | $(LTLDFLAGS) | |
bce1b489 | 269 | |
45d5f86c | 270 | libobjc_gc$(libsuffix).la: $(OBJS_GC) |
785fad0a | 271 | $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) $(OBJC_BOEHM_GC_LIBS) \ |
1d439e6c | 272 | -Wc,-shared-libgcc -rpath $(toolexeclibdir) \ |
7afa92c5 JB |
273 | -version-info $(LIBOBJC_GC_VERSION) $(extra_ldflags_libobjc) \ |
274 | $(LTLDFLAGS) | |
bce1b489 | 275 | |
10c179f3 JM |
276 | info: |
277 | dvi: | |
b5422ad7 | 278 | pdf: |
10c179f3 | 279 | html: |
bce1b489 BE |
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 | ||
6efbd53f RW |
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 \ | |
e8e66971 | 296 | $(srcdir)/../config/toolexeclibdir.m4 \ |
6efbd53f RW |
297 | $(srcdir)/../ltoptions.m4 \ |
298 | $(srcdir)/../ltsugar.m4 \ | |
299 | $(srcdir)/../ltversion.m4 \ | |
300 | $(srcdir)/../lt~obsolete.m4 \ | |
9e68f177 | 301 | $(srcdir)/../config/cet.m4 \ |
6efbd53f RW |
302 | $(srcdir)/acinclude.m4 |
303 | ||
304 | $(srcdir)/configure: @MAINT@ configure.ac $(srcdir)/aclocal.m4 | |
bce1b489 | 305 | rm -f config.cache |
6efbd53f RW |
306 | cd $(srcdir) && $(AUTOCONF) |
307 | ||
308 | $(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps) | |
309 | cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) | |
bce1b489 | 310 | |
b150efee | 311 | install: install-libs install-headers |
bce1b489 BE |
312 | |
313 | install-libs: installdirs | |
5b043f08 | 314 | $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(toolexeclibdir) |
45d5f86c | 315 | $(LIBTOOL_INSTALL) $(INSTALL) libobjc$(libsuffix).la $(DESTDIR)$(toolexeclibdir); |
c161c99b | 316 | if [ "$(OBJC_BOEHM_GC)" ]; then \ |
45d5f86c | 317 | $(LIBTOOL_INSTALL) $(INSTALL) libobjc_gc$(libsuffix).la \ |
608e1e0c | 318 | $(DESTDIR)$(toolexeclibdir);\ |
c161c99b | 319 | fi |
b150efee | 320 | $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@" |
608e1e0c | 321 | @-$(LIBTOOL) --mode=finish $(DESTDIR)$(toolexeclibdir) |
bce1b489 | 322 | |
7e268280 | 323 | # Copy Objective-C headers to installation include directory. |
b150efee | 324 | install-headers: |
5b043f08 | 325 | $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/objc |
bce1b489 | 326 | for file in $(OBJC_H); do \ |
789eb4f5 | 327 | realfile=$(srcdir)/objc/$${file}; \ |
7d34a5a9 | 328 | $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc; \ |
bce1b489 BE |
329 | done |
330 | ||
331 | check uninstall install-strip dist installcheck installdirs: | |
332 | ||
333 | mostlyclean: | |
45d5f86c | 334 | -$(LIBTOOL_CLEAN) rm -f libobjc$(libsuffix).la libobjc_gc$(libsuffix).la *.lo |
c161c99b | 335 | -rm -f runtime-info.h tmp-runtime.s *.o *.lo libobjc* xforward \ |
b5422ad7 | 336 | fflags *.aux *.cp *.dvi *.pdf *.fn *.info *.ky *.log *.pg \ |
bce1b489 BE |
337 | *.toc *.tp *.vr *.html libobj.exp |
338 | @$(MULTICLEAN) multi-clean DO=mostlyclean | |
339 | ||
340 | clean: mostlyclean | |
341 | rm -f config.log | |
342 | @$(MULTICLEAN) multi-clean DO=clean | |
343 | ||
344 | distclean: clean | |
345 | @$(MULTICLEAN) multi-clean DO=distclean | |
346 | rm -f config.cache config.status Makefile configure | |
347 | ||
348 | maintainer-clean realclean: distclean | |
349 | ||
350 | .PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \ | |
351 | install-strip dist installcheck installdirs | |
54b2f310 DJ |
352 | |
353 | # Don't export variables to the environment, in order to not confuse | |
354 | # configure. | |
355 | .NOEXPORT: |