Initial revision
[gcc.git] / libobjc / Makefile.in
1 #Makefile for GNU Objective C runtime library.
2 #Copyright (C) 1993, 95-97, 1998 Free Software Foundation, Inc.
3
4 #This file is part of GNU CC.
5
6 #GNU CC 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 2, or (at your option)
9 #any later version.
10
11 #GNU CC 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.
15
16 #You should have received a copy of the GNU General Public License
17 #along with GNU CC; see the file COPYING. If not, write to
18 #the Free Software Foundation, 59 Temple Place - Suite 330,
19 #Boston, MA 02111-1307, USA. */
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 = /bin/sh
26
27 #### Start of system configuration section. ####
28
29 srcdir = @srcdir@
30 VPATH = @srcdir@
31 prefix = @prefix@
32 exec_prefix = @exec_prefix@
33 target_alias = @target_alias@
34 gcc_version = @gcc_version@
35 gcc_version_trigger = @gcc_version_trigger@
36
37 libdir = $(exec_prefix)/lib
38 libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
39 incinstalldir = $(libsubdir)/include
40
41 # Multilib support variables.
42 MULTISRCTOP =
43 MULTIBUILDTOP =
44 MULTIDIRS =
45 MULTISUBDIR =
46 MULTIDO = true
47 MULTICLEAN = true
48
49 # Not configured per top-level version, since that doesn't get passed
50 # down at configure time, but overrridden by the top-level install
51 # target.
52 INSTALL = @INSTALL@
53 INSTALL_PROGRAM = @INSTALL_PROGRAM@
54 INSTALL_DATA = @INSTALL_DATA@
55
56 AR = @AR@
57 AR_FLAGS = rc
58
59 RANLIB = @RANLIB@
60
61 CC = @CC@
62 CFLAGS = @CFLAGS@
63 ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) -DIN_GCC
64
65 #
66 # Define the cc1obj in terms of the CC that is passed on from higher
67 # level make. This is needed to make sure we can create runtime-info.h
68 # when doing canadian cross builds where running ../../gcc/cc1obj
69 # does not make any sense.
70 #
71 CC1OBJ = `$(CC) -print-prog-name=cc1obj`
72
73 INCLUDES = -I$(srcdir)/objc -I$(srcdir)/$(MULTISRCTOP)../gcc \
74 -I$(srcdir)/$(MULTISRCTOP)../gcc/config -I$(MULTIBUILDTOP)../../gcc \
75 -I$(srcdir)/$(MULTISRCTOP)../include
76
77 OBJC_GCFLAGS=-DOBJC_WITH_GC=1
78 OBJC_THREAD_FILE=thr-@OBJC_THREAD_FILE@
79
80 .SUFFIXES:
81 .SUFFIXES: .c .m .o
82
83 .c.o:
84 $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
85
86 .m.o:
87 $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
88
89 # Flags to pass to a recursive make.
90 FLAGS_TO_PASS = \
91 "AR=$(AR)" \
92 "AR_FLAGS=$(AR_FLAGS)" \
93 "CC=$(CC)" \
94 "CFLAGS=$(CFLAGS)" \
95 "LIBCFLAGS=$(LIBCFLAGS)" \
96 "EXTRA_OFILES=$(EXTRA_OFILES)" \
97 "HDEFINES=$(HDEFINES)" \
98 "INSTALL=$(INSTALL)" \
99 "INSTALL_DATA=$(INSTALL_DATA)" \
100 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
101 "LDFLAGS=$(LDFLAGS)" \
102 "LOADLIBES=$(LOADLIBES)" \
103 "PICFLAG=$(PICFLAG)" \
104 "RANLIB=$(RANLIB)" \
105 "SHELL=$(SHELL)" \
106 "prefix=$(prefix)" \
107 "exec_prefix=$(exec_prefix)" \
108 "libdir=$(libdir)" \
109 "libsubdir=$(libsubdir)" \
110 "tooldir=$(tooldir)"
111
112 all: libobjc.a @OBJC_BOEHM_GC@
113 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
114
115 # User-visible header files.
116
117 OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \
118 NXConstStr.h Object.h Protocol.h encoding.h typedstream.h \
119 thr.h
120
121 # Modules that comprise the runtime library.
122
123 OBJS = archive.o class.o encoding.o gc.o hash.o init.o linking.o \
124 misc.o nil_method.o NXConstStr.o Object.o objects.o \
125 Protocol.o sarray.o selector.o sendmsg.o thr.o \
126 $(OBJC_THREAD_FILE).o
127
128 OBJS_GC = archive_gc.o class_gc.o encoding_gc.o gc_gc.o hash_gc.o \
129 init_gc.o linking_gc.o misc_gc.o nil_method_gc.o \
130 NXConstStr_gc.o Object_gc.o objects_gc.o Protocol_gc.o \
131 sarray_gc.o selector_gc.o sendmsg_gc.o thr_gc.o \
132 $(OBJC_THREAD_FILE)_gc.o
133
134 runtime-info.h:
135 echo "" > tmp-runtime
136 echo "/* This file is automatically generated */" > $@
137 $(CC1OBJ) -print-objc-runtime-info tmp-runtime >> $@
138 rm -f tmp-runtime
139
140 archive_gc.o: archive.c
141 $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $<
142
143 class_gc.o: class.c
144 $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $<
145
146 encoding_gc.o: encoding.c
147 $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $<
148
149 gc.o: gc.c
150 $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
151
152 gc_gc.o: gc.c
153 $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
154 $(INCLUDES) $<
155
156 hash_gc.o: hash.c
157 $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $<
158
159 init_gc.o: init.c
160 $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $<
161
162 linking.o: linking.m
163 $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
164
165 linking_gc.o: linking.m
166 $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
167 $(INCLUDES) $<
168
169 misc_gc.o: misc.c
170 $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $<
171
172 nil_method_gc.o: nil_method.c
173 $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $<
174
175 NXConstStr.o: NXConstStr.m
176 $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
177
178 NXConstStr_gc.o: NXConstStr.m
179 $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
180 $(INCLUDES) $<
181
182 Object.o: Object.m
183 $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
184
185 Object_gc.o: Object.m
186 $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
187 $(INCLUDES) $<
188
189 objects_gc.o: objects.c
190 $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $<
191
192 Protocol.o: Protocol.m
193 $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
194
195 Protocol_gc.o: Protocol.m
196 $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
197 $(INCLUDES) $<
198
199 sarray_gc.o: sarray.c
200 $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $<
201
202 selector_gc.o: selector.c
203 $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $<
204
205 sendmsg.o: sendmsg.c runtime-info.h
206 $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
207
208 sendmsg_gc.o: sendmsg.c runtime-info.h
209 $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $<
210
211 thr_gc.o: thr.c
212 $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $<
213
214 $(OBJC_THREAD_FILE)_gc.o: $(OBJC_THREAD_FILE).c
215 $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $<
216
217 doc: info dvi html
218
219 libobjc.a: $(OBJS)
220 $(AR) $(AR_FLAGS) $@ $(OBJS)
221 $(RANLIB) $@
222
223 libobjc_gc.a: $(OBJS_GC)
224 $(AR) $(AR_FLAGS) $@ $(OBJS_GC)
225 $(RANLIB) $@
226
227 libobjc_s.a: libobjc.a
228 mv libobjc.a libobjc_s.a
229
230 # Create a relocatable DLL
231 libobjc.dll: libobjc_s.a libobjc_entry.o
232 $(CC) -mdll -Wl,--base-file -Wl,libobjc.base \
233 -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
234 $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
235 --base-file libobjc.base --output-exp libobjc.exp
236 $(GCC_FOR_TARGET) -mdll -Wl,--base-file libobjc.base libobjc.exp \
237 -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
238 $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
239 --base-file libobjc.base --output-exp libobjc.exp
240 $(GCC_FOR_TARGET) libobjc.exp -mdll \
241 -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
242 $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
243 --output-lib libobjc.a
244
245 info: objc-features.info
246 dvi: objc-features.dvi
247 html: objc-features_toc.html
248
249 objc-features.info: $(srcdir)/objc-features.texi
250 makeinfo $(srcdir)/objc-features.texi
251
252 objc-features.dvi: $(srcdir)/objc-features.texi
253 texi2dvi $(srcdir)/objc-features.texi
254
255 objc-features_toc.html: objc-features.texi
256 texi2html -split_node $(srcdir)/objc-features.texi
257
258 Makefile: Makefile.in config.status
259 $(SHELL) config.status
260
261 config.status: configure
262 rm -f config.cache
263 CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
264 CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
265
266 ${srcdir}/configure: configure.in
267 rm -f config.cache
268 cd ${srcdir} && autoconf
269
270 install: install-libs copy-headers
271
272 install-libs: installdirs
273 -if test -f libobjc.a ; then \
274 rm -f $(libsubdir)/libobjc.a; \
275 $(INSTALL_DATA) libobjc.a $(libsubdir)/libobjc.a; \
276 chmod a-x $(libsubdir)/libobjc.a; \
277 else true; fi
278 -if test -f libobjc_gc.a ; then \
279 rm -f $(libsubdir)/libobjc_gc.a; \
280 $(INSTALL_DATA) libobjc_gc.a $(libsubdir)/libobjc_gc.a; \
281 chmod a-x $(libsubdir)/libobjc_gc.a; \
282 else true; fi
283 -if test -f libobjc_s.a ; then \
284 rm -f $(libsubdir)/libobjc_s.a; \
285 $(INSTALL_DATA) libobjc_s.a $(libsubdir)/libobjc_s.a; \
286 chmod a-x $(libsubdir)/libobjc_s.a; \
287 else true; fi
288 -if test -f libobjc.dll ; then \
289 rm -f $(bindir)/libobjc.dll; \
290 $(INSTALL_DATA) libobjc.dll $(bindir)/libobjc.dll; \
291 else true; fi
292
293 # Copy Objective C headers to installation include directory.
294 copy-headers:
295 -rm -rf $(incinstalldir)/objc
296 -mkdir $(incinstalldir)/objc
297 for file in $(OBJC_H); do \
298 realfile=$(srcdir)/objc/$${file}; \
299 cp $${realfile} $(incinstalldir)/objc; \
300 chmod a+r $(incinstalldir)/objc/$${file}; \
301 done
302
303 check uninstall install-strip dist installcheck installdirs:
304
305 mostlyclean:
306 -rm -f runtime-info.h tmp-runtime.s *.o libobjc* xforward \
307 fflags *.aux *.cp *.dvi *.fn *.info *.ky *.log *.pg \
308 *.toc *.tp *.vr *.html libobj.exp
309 @$(MULTICLEAN) multi-clean DO=mostlyclean
310
311 clean: mostlyclean
312 rm -f config.log
313 @$(MULTICLEAN) multi-clean DO=clean
314
315 distclean: clean
316 @$(MULTICLEAN) multi-clean DO=distclean
317 rm -f config.cache config.status Makefile configure
318
319 maintainer-clean realclean: distclean
320
321 .PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \
322 install-strip dist installcheck installdirs