OSDN Git Service

Warning fixes:
[pf3gnuchains/gcc-fork.git] / gcc / objc / Make-lang.in
1 # Top level makefile fragment for GNU Objective-C
2 #   Copyright (C) 1997, 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 file provides the language dependent support in the main Makefile.
22 # Each language makefile fragment must provide the following targets:
23 #
24 # foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
25 # foo.info, foo.dvi,
26 # foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
27 # foo.uninstall, foo.distdir,
28 # foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
29 # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
30 #
31 # where `foo' is the name of the language.
32 #
33 # It should also provide rules for:
34 #
35 # - making any compiler driver (eg: g++)
36 # - the compiler proper (eg: cc1plus)
37 # - define the names for selecting the language in LANGUAGES.
38 #\f
39 # Extra flags to pass to recursive makes.
40 OBJC_FLAGS_TO_PASS = \
41         "OBJC_FOR_BUILD=$(OBJC_FOR_BUILD)" \
42         "OBJCFLAGS=$(OBJCFLAGS)" \
43         "OBJC_FOR_TARGET=$(OBJC_FOR_TARGET)" \
44
45 # Actual names to use when installing a native compiler.
46 #OBJC_INSTALL_NAME = `t='$(program_transform_name)'; echo c++ | sed $$t`
47
48 # Actual names to use when installing a cross-compiler.
49 #OBJC_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t`
50
51 #\f
52 # Define the names for selecting Objective-C in LANGUAGES.
53 OBJC objc: cc1obj$(exeext) objc-runtime
54 OBJECTIVE-C objective-c: cc1obj$(exeext) objc-runtime
55
56 # Tell GNU make to ignore these if they exist.
57 .PHONY: objective-c objc ObjC
58
59 # The Objective C thread file
60 OBJC_THREAD_FILE=thr-$(GCC_THREAD_FILE)
61
62 # Language-specific object files for Objective C.
63 OBJC_OBJS = objc-parse.o objc-act.o $(C_AND_OBJC_OBJS)
64
65 cc1obj$(exeext): $(P) $(OBJC_OBJS) $(OBJS) $(LIBDEPS)
66         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJC_OBJS) $(OBJS) \
67                 $(LIBS)
68
69 # Objective C language specific files.
70
71 objc-parse.o : $(srcdir)/objc/objc-parse.c \
72    $(CONFIG_H) $(TREE_H) $(srcdir)/toplev.h \
73    $(srcdir)/c-lex.h $(srcdir)/c-tree.h $(srcdir)/input.h \
74    $(srcdir)/flags.h $(srcdir)/output.h $(srcdir)/objc/objc-act.h system.h
75         $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
76         -c $(srcdir)/objc/objc-parse.c
77
78 $(srcdir)/objc/objc-parse.c : $(srcdir)/objc/objc-parse.y
79         cd $(srcdir)/objc; \
80         $(BISON) $(BISONFLAGS) objc-parse.y -o objc-parse.c
81
82 $(srcdir)/objc/objc-parse.y: $(srcdir)/c-parse.in
83         echo '/*WARNING: This file is automatically generated!*/' >tmp-objc-prs.y
84         sed -e "/^ifc$$/,/^end ifc$$/d" \
85           -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \
86           $(srcdir)/c-parse.in >>tmp-objc-prs.y
87         $(srcdir)/move-if-change tmp-objc-prs.y $(srcdir)/objc/objc-parse.y
88
89 objc-act.o : $(srcdir)/objc/objc-act.c \
90    $(CONFIG_H) $(TREE_H) $(RTL_H) system.h \
91    $(srcdir)/c-tree.h $(srcdir)/c-lex.h $(srcdir)/toplev.h \
92    $(srcdir)/flags.h $(srcdir)/objc/objc-act.h $(srcdir)/input.h \
93    $(srcdir)/function.h $(srcdir)/output.h $(srcdir)/c-parse.h
94         $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
95         -c $(srcdir)/objc/objc-act.c
96
97 objc-runtime: objc-headers libobjc.a
98
99 # copy objc header files into build directory
100 objc-headers: stmp-fixinc
101         if [ -d include ]; then true; else mkdir include; fi
102         cd objc; \
103         if [ -f Makefile ]; then \
104           $(MAKE) copy-headers \
105           tooldir=$(tooldir) \
106           AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
107           GCC_FOR_TARGET="../xgcc -B../" \
108           GCC_CFLAGS="$(GCC_CFLAGS)" incinstalldir=../include; \
109         fi
110         touch objc-headers
111
112 # Objective C runtime library specific files.
113
114 OBJC_O = objc/hash.o objc/sarray.o \
115         objc/class.o objc/sendmsg.o \
116         objc/init.o objc/archive.o \
117         objc/encoding.o objc/selector.o \
118         objc/objects.o objc/misc.o \
119         objc/NXConstStr.o objc/Object.o \
120         objc/Protocol.o objc/nil_method.o \
121         objc/thr.o objc/linking.o \
122         objc/$(OBJC_THREAD_FILE).o
123
124 objc/hash.o: $(srcdir)/objc/hash.c $(GCC_PASSES)
125         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
126         -c $(srcdir)/objc/hash.c -o $@
127 objc/sarray.o: $(srcdir)/objc/sarray.c $(GCC_PASSES)
128         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
129         -c $(srcdir)/objc/sarray.c -o $@
130 objc/class.o: $(srcdir)/objc/class.c $(GCC_PASSES)
131         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
132         -c $(srcdir)/objc/class.c -o $@
133 objc/sendmsg.o: $(srcdir)/objc/sendmsg.c $(GCC_PASSES) objc/runtime-info.h
134         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -Iobjc \
135         -c $(srcdir)/objc/sendmsg.c -o $@
136 objc/init.o: $(srcdir)/objc/init.c $(GCC_PASSES)
137         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
138         -c $(srcdir)/objc/init.c -o $@
139 objc/archive.o: $(srcdir)/objc/archive.c $(GCC_PASSES)
140         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
141         -c $(srcdir)/objc/archive.c -o $@
142 objc/encoding.o: $(srcdir)/objc/encoding.c $(GCC_PASSES)
143         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
144         -c $(srcdir)/objc/encoding.c -o $@
145 objc/selector.o: $(srcdir)/objc/selector.c $(GCC_PASSES)
146         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
147         -c $(srcdir)/objc/selector.c -o $@
148 objc/objects.o: $(srcdir)/objc/objects.c $(GCC_PASSES)
149         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
150         -c $(srcdir)/objc/objects.c -o $@
151 objc/misc.o: $(srcdir)/objc/misc.c $(GCC_PASSES)
152         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
153         -c $(srcdir)/objc/misc.c -o $@
154 objc/NXConstStr.o: $(srcdir)/objc/NXConstStr.m $(GCC_PASSES)
155         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
156         -fgnu-runtime -c $(srcdir)/objc/NXConstStr.m -o $@
157 objc/Object.o: $(srcdir)/objc/Object.m $(GCC_PASSES)
158         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
159         -fgnu-runtime -c $(srcdir)/objc/Object.m -o $@
160 objc/Protocol.o: $(srcdir)/objc/Protocol.m $(GCC_PASSES)
161         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
162         -fgnu-runtime -c $(srcdir)/objc/Protocol.m -o $@
163 objc/thr.o: $(srcdir)/objc/thr.h $(srcdir)/objc/thr.c $(GCC_PASSES)
164         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
165         -c $(srcdir)/objc/thr.c -o $@
166 objc/$(OBJC_THREAD_FILE).o: $(srcdir)/objc/$(OBJC_THREAD_FILE).c $(GCC_PASSES)
167         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
168         -c $(srcdir)/objc/$(OBJC_THREAD_FILE).c -o $@
169 objc/nil_method.o: $(srcdir)/objc/nil_method.c $(GCC_PASSES)
170         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
171         -c $(srcdir)/objc/nil_method.c -o $@
172 objc/linking.o: $(srcdir)/objc/linking.m $(GCC_PASSES)
173         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
174         -fgnu-runtime -c $(srcdir)/objc/linking.m -o $@
175
176 objc/libobjc_entry.o: $(srcdir)/objc/libobjc_entry.c $(GCC_PASSES)
177         $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
178         -c $(srcdir)/objc/libobjc_entry.c -o $@
179
180 $(OBJC_O): $(GCC_PASSES) cc1obj
181
182 # Build the Objective C runtime library.
183 libobjc.a: cc1obj specs stmp-int-hdrs libgcc2.ready \
184  $(USE_COLLECT2) $(EXTRA_PARTS) objc/runtime-info.h $(OBJC_O)
185         -rm -f libobjc.a
186         $(AR) $(AR_FLAGS) libobjc.a $(OBJC_O)
187         -if $(RANLIB_TEST) ; then $(RANLIB) libobjc.a; else true; fi
188
189 libobjc_s.a: libobjc.a
190         mv libobjc.a libobjc_s.a
191
192 # Create a relocatable DLL
193 libobjc.dll: libobjc_s.a objc/libobjc_entry.o
194         $(GCC_FOR_TARGET) -mdll -Wl,--base-file -Wl,libobjc.base \
195                 -o libobjc.dll libobjc_s.a \
196                 objc/libobjc_entry.o -lkernel32
197         $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/objc/libobjc.def \
198                 --base-file libobjc.base --output-exp libobjc.exp
199         $(GCC_FOR_TARGET) -mdll -Wl,--base-file libobjc.base libobjc.exp \
200                 -o libobjc.dll libobjc_s.a \
201                 objc/libobjc_entry.o -lkernel32
202         $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/objc/libobjc.def \
203                 --base-file libobjc.base --output-exp libobjc.exp
204         $(GCC_FOR_TARGET) libobjc.exp -mdll \
205                 -o libobjc.dll libobjc_s.a \
206                 objc/libobjc_entry.o -lkernel32
207         $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/objc/libobjc.def \
208                 --output-lib libobjc.a
209
210 # Platform generated information needed by ObjC runtime
211 objc/runtime-info.h: cc1obj
212         echo "" > tmp-runtime
213         echo "/* This file is automatically generated */" >$@
214         ./cc1obj -print-objc-runtime-info tmp-runtime >>$@
215         rm -f tmp-runtime
216 #\f
217 # Build hooks:
218
219 objc.all.build:
220 objc.all.cross:
221 objc.start.encap:
222 objc.rest.encap:
223
224 objc.info:
225 objc.dvi:
226
227 #\f
228 # Install hooks:
229 # cc1obj is installed elsewhere as part of $(COMPILERS).
230
231 objc.install-normal: installdirs
232         -if [ -f libobjc.a ] ; then \
233           rm -f $(libsubdir)/libobjc.a; \
234           $(INSTALL_DATA) libobjc.a $(libsubdir)/libobjc.a; \
235           if $(RANLIB_TEST) ; then \
236             (cd $(libsubdir); $(RANLIB) libobjc.a); else true; fi; \
237           chmod a-x $(libsubdir)/libobjc.a; \
238         else true; fi
239         -if [ -f libobjc_s.a ] ; then \
240           rm -f $(libsubdir)/libobjc_s.a; \
241           $(INSTALL_DATA) libobjc_s.a $(libsubdir)/libobjc_s.a; \
242           if $(RANLIB_TEST) ; then \
243             (cd $(libsubdir); $(RANLIB) libobjc_s.a); else true; fi; \
244           chmod a-x $(libsubdir)/libobjc_s.a; \
245         else true; fi
246         -if [ -f libobjc.dll ] ; then \
247           rm -f $(bindir)/libobjc.dll; \
248           $(INSTALL_DATA) libobjc.dll $(bindir)/libobjc.dll; \
249         else true; fi
250
251 objc.install-common:
252
253 objc.install-info:
254
255 objc.install-man:
256
257 objc.uninstall:
258 #\f
259 # Clean hooks:
260 # A lot of the ancillary files are deleted by the main makefile.
261 # We just have to delete files specific to us.
262 objc.mostlyclean:
263         -rm -f tmp-objc-prs.y
264         -rm -f objc/*$(objext) objc/xforward objc/fflags
265         -rm -f objc/runtime-info.h
266         -rm -f libobjc.a libobjc_s.a libobjc.dll
267         -rm -f libobjc.base libobjc.exp
268 objc.clean: objc.mostlyclean
269         -rm -rf objc-headers
270 objc.distclean:
271         -rm -f objc/Makefile objc/Make-host objc/Make-target
272         -rm -f objc/config.status objc/config.cache
273         -rm -f objc-parse.output
274 objc.extraclean:
275 objc.maintainer-clean:
276         -rm -f objc/objc-parse.y
277         -rm -f objc/objc-parse.c objc/objc-parse.output
278
279 #\f
280 # Stage hooks:
281
282 objc.stage1: stage1-start
283         -mv objc/*$(objext) stage1/objc
284         -mv cc1obj$(exeext) stage1
285         -mv libobjc.a stage1
286 objc.stage2: stage2-start
287         -mv objc/*$(objext) stage2/objc
288         -mv cc1obj$(exeext) stage2
289         -mv libobjc.a stage2
290 objc.stage3: stage3-start
291         -mv objc/*$(objext) stage3/objc
292         -mv cc1obj$(exeext) stage3
293         -mv libobjc.a stage3
294 objc.stage4: stage4-start
295         -mv objc/*$(objext) stage4/objc
296         -mv cc1obj$(exeext) stage4
297         -mv libobjc.a stage4
298
299 #\f
300 # Maintenance hooks:
301
302 # This target creates the files that can be rebuilt, but go in the
303 # distribution anyway.  It then copies the files to the distdir directory.
304 # ??? Note that this should be fixed once the Makefile is fixed to do
305 # the build in the inner directory.
306 objc.distdir: $(srcdir)/objc/objc-parse.c
307         mkdir tmp/objc
308 #       cd objc ; $(MAKE) $(FLAGS_TO_PASS) objc-parse.c
309         cd objc; \
310         for file in *[0-9a-zA-Z+]; do \
311           ln $$file ../tmp/objc >/dev/null 2>&1 || cp $$file ../tmp/objc; \
312         done