gcc2 snapshot 980401 import
[official-gcc.git] / gcc / objc / Make-lang.in
blob4dbb041186f8d77d2b14d64031dea48991cd5cb5
1 # Top level makefile fragment for GNU Objective-C
2 #   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
4 #This file is part of GNU CC.
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.
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.
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.
21 # This file provides the language dependent support in the main Makefile.
22 # Each language makefile fragment must provide the following targets:
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
31 # where `foo' is the name of the language.
33 # It should also provide rules for:
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)" \
45 # Actual names to use when installing a native compiler.
46 #OBJC_INSTALL_NAME = `t='$(program_transform_name)'; echo c++ | sed $$t`
48 # Actual names to use when installing a cross-compiler.
49 #OBJC_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t`
51 #\f
52 # Define the names for selecting Objective-C in LANGUAGES.
53 OBJC objc: cc1obj objc-runtime
54 OBJECTIVE-C objective-c: cc1obj objc-runtime
56 # Tell GNU make to ignore these if they exist.
57 .PHONY: objective-c objc ObjC
59 # The Objective C thread file
60 OBJC_THREAD_FILE=thr-$(GCC_THREAD_FILE)
62 # Language-specific object files for Objective C.
63 OBJC_OBJS = objc-parse.o objc-act.o $(C_AND_OBJC_OBJS)
65 cc1obj: $(P) $(OBJC_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
66         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJC_OBJS) $(OBJS) \
67                 $(BC_OBJS) $(LIBS)
69 # Objective C language specific files.
71 objc-parse.o : $(srcdir)/objc/objc-parse.c \
72    $(CONFIG_H) $(TREE_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
75         $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
76         -c $(srcdir)/objc/objc-parse.c
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
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
89 objc-act.o : $(srcdir)/objc/objc-act.c \
90    $(CONFIG_H) $(TREE_H) $(RTL_H) \
91    $(srcdir)/c-tree.h $(srcdir)/c-lex.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
97 objc-runtime: objc-headers libobjc.a
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
112 # Objective C runtime library specific files.
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
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 $@
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 $@
180 # Build the Objective C runtime library.
181 libobjc.a: cc1obj specs stmp-int-hdrs libgcc2.ready \
182  $(USE_COLLECT2) $(EXTRA_PARTS) objc/runtime-info.h $(OBJC_O)
183         -rm -f libobjc.a
184         $(AR) $(AR_FLAGS) libobjc.a $(OBJC_O)
185         -if $(RANLIB_TEST) ; then $(RANLIB) libobjc.a; else true; fi
187 libobjc_s.a: libobjc.a
188         mv libobjc.a libobjc_s.a
190 # Create a relocatable DLL
191 libobjc.dll: libobjc_s.a objc/libobjc_entry.o
192         $(GCC_FOR_TARGET) -mdll -Wl,--base-file -Wl,libobjc.base \
193                 -o libobjc.dll libobjc_s.a \
194                 objc/libobjc_entry.o -lkernel32
195         $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/objc/libobjc.def \
196                 --base-file libobjc.base --output-exp libobjc.exp
197         $(GCC_FOR_TARGET) -mdll -Wl,--base-file libobjc.base libobjc.exp \
198                 -o libobjc.dll libobjc_s.a \
199                 objc/libobjc_entry.o -lkernel32
200         $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/objc/libobjc.def \
201                 --base-file libobjc.base --output-exp libobjc.exp
202         $(GCC_FOR_TARGET) libobjc.exp -mdll \
203                 -o libobjc.dll libobjc_s.a \
204                 objc/libobjc_entry.o -lkernel32
205         $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/objc/libobjc.def \
206                 --output-lib libobjc.a
208 # Platform generated information needed by ObjC runtime
209 objc/runtime-info.h: cc1obj
210         echo "" > tmp-runtime
211         echo "/* This file is automatically generated */" >$@
212         ./cc1obj -print-objc-runtime-info tmp-runtime >>$@
213         rm -f tmp-runtime
215 # Build hooks:
217 objc.all.build:
218 objc.all.cross:
219 objc.start.encap:
220 objc.rest.encap:
222 objc.info:
223 objc.dvi:
226 # Install hooks:
227 # cc1obj is installed elsewhere as part of $(COMPILERS).
229 objc.install-normal: installdirs
230         -if [ -f libobjc.a ] ; then \
231           rm -f $(libsubdir)/libobjc.a; \
232           $(INSTALL_DATA) libobjc.a $(libsubdir)/libobjc.a; \
233           if $(RANLIB_TEST) ; then \
234             (cd $(libsubdir); $(RANLIB) libobjc.a); else true; fi; \
235           chmod a-x $(libsubdir)/libobjc.a; \
236         else true; fi
237         -if [ -f libobjc_s.a ] ; then \
238           rm -f $(libsubdir)/libobjc_s.a; \
239           $(INSTALL_DATA) libobjc_s.a $(libsubdir)/libobjc_s.a; \
240           if $(RANLIB_TEST) ; then \
241             (cd $(libsubdir); $(RANLIB) libobjc_s.a); else true; fi; \
242           chmod a-x $(libsubdir)/libobjc_s.a; \
243         else true; fi
244         -if [ -f libobjc.dll ] ; then \
245           rm -f $(bindir)/libobjc.dll; \
246           $(INSTALL_DATA) libobjc.dll $(bindir)/libobjc.dll; \
247         else true; fi
249 objc.install-common:
251 objc.install-info:
253 objc.install-man:
255 objc.uninstall:
257 # Clean hooks:
258 # A lot of the ancillary files are deleted by the main makefile.
259 # We just have to delete files specific to us.
260 objc.mostlyclean:
261         -rm -f tmp-objc-prs.y
262         -rm -f objc/*$(objext) objc/xforward objc/fflags
263         -rm -f objc/runtime-info.h
264         -rm -f libobjc.a libobjc_s.a libobjc.dll
265         -rm -f libobjc.base libobjc.exp
266 objc.clean: objc.mostlyclean
267         -rm -rf objc-headers
268 objc.distclean:
269         -rm -f objc/Makefile objc/Make-host objc/Make-target
270         -rm -f objc/config.status objc/config.cache
271         -rm -f objc-parse.output
272 objc.extraclean:
273 objc.maintainer-clean:
274         -rm -f objc/objc-parse.y
275         -rm -f objc/objc-parse.c objc/objc-parse.output
278 # Stage hooks:
280 objc.stage1: stage1-start
281         -mv objc/*$(objext) stage1/objc
282         -mv cc1obj$(exeext) stage1
283         -mv libobjc.a stage1
284 objc.stage2: stage2-start
285         -mv objc/*$(objext) stage2/objc
286         -mv cc1obj$(exeext) stage2
287         -mv libobjc.a stage2
288 objc.stage3: stage3-start
289         -mv objc/*$(objext) stage3/objc
290         -mv cc1obj$(exeext) stage3
291         -mv libobjc.a stage3
292 objc.stage4: stage4-start
293         -mv objc/*$(objext) stage4/objc
294         -mv cc1obj$(exeext) stage4
295         -mv libobjc.a stage4
298 # Maintenance hooks:
300 # This target creates the files that can be rebuilt, but go in the
301 # distribution anyway.  It then copies the files to the distdir directory.
302 # ??? Note that this should be fixed once the Makefile is fixed to do
303 # the build in the inner directory.
304 objc.distdir: $(srcdir)/objc/objc-parse.c
305         mkdir tmp/objc
306 #       cd objc ; $(MAKE) $(FLAGS_TO_PASS) objc-parse.c
307         cd objc; \
308         for file in *[0-9a-zA-Z+]; do \
309           ln $$file ../tmp/objc >/dev/null 2>&1 || cp $$file ../tmp/objc; \
310         done