(OBJC_THREAD_FILE): New definition.
[gcc.git] / gcc / objc / Make-lang.in
1 # Top level makefile fragment for GNU Objective-C
2 # Copyright (C) 1997 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 objc-runtime
54 OBJECTIVE-C objective-c: cc1obj 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 # C common object files required by Objective C.
63 OBJC_CCOMMON = c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o \
64 c-aux-info.o c-common.o c-iterate.o
65
66 # Language-specific object files for Objective C.
67 OBJC_OBJS = objc-parse.o objc-act.o
68
69 cc1obj: $(P) $(OBJC_OBJS) $(OBJC_CCOMMON) $(OBJS) $(BC_OBJS) $(LIBDEPS)
70 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJC_OBJS) $(OBJS) \
71 $(OBJC_CCOMMON) $(BC_OBJS) $(LIBS)
72
73 # Objective C language specific files.
74
75 objc-parse.o : $(srcdir)/objc/objc-parse.c \
76 $(CONFIG_H) $(TREE_H) \
77 $(srcdir)/c-lex.h $(srcdir)/c-tree.h $(srcdir)/input.h \
78 $(srcdir)/flags.h $(srcdir)/objc/objc-act.h
79 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
80 -c $(srcdir)/objc/objc-parse.c
81
82 $(srcdir)/objc/objc-parse.c : $(srcdir)/objc/objc-parse.y
83 cd $(srcdir); $(BISON) $(BISONFLAGS) \
84 $(srcdir)/objc/objc-parse.y -o $(srcdir)/objc/objc-parse.c
85
86 $(srcdir)/objc/objc-parse.y: $(srcdir)/c-parse.in
87 echo '/*WARNING: This file is automatically generated!*/' >tmp-objc-prs.y
88 sed -e "/^ifc$$/,/^end ifc$$/d" \
89 -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \
90 $(srcdir)/c-parse.in >>tmp-objc-prs.y
91 $(srcdir)/move-if-change tmp-objc-prs.y $(srcdir)/objc/objc-parse.y
92
93 objc-act.o : $(srcdir)/objc/objc-act.c \
94 $(CONFIG_H) $(TREE_H) $(RTL_H) \
95 $(srcdir)/c-tree.h $(srcdir)/c-lex.h \
96 $(srcdir)/flags.h $(srcdir)/objc/objc-act.h $(srcdir)/input.h \
97 $(srcdir)/function.h $(srcdir)/c-parse.h
98 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
99 -c $(srcdir)/objc/objc-act.c
100
101 objc-runtime: objc-headers libobjc.a
102
103 # copy objc header files into build directory
104 objc-headers: stmp-fixinc
105 if [ -d include ]; then true; else mkdir include; fi
106 if [ -d objc ]; then true; else mkdir objc; fi
107 thisdir1=`pwd`; \
108 srcdir1=`cd $(srcdir); pwd`; \
109 cd objc; \
110 if [ -f $${srcdir1}/objc/Makefile ]; then \
111 $(MAKE) -f $${srcdir1}/objc/Makefile copy-headers \
112 srcdir=$${srcdir1} tooldir=$(tooldir) \
113 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
114 GCC_FOR_TARGET="$${thisdir1}/xgcc -B$${thisdir1}/" \
115 GCC_CFLAGS="$(GCC_CFLAGS)" incinstalldir=$${thisdir1}/include; \
116 fi
117 touch objc-headers
118
119 # Objective C runtime library specific files.
120
121 OBJC_O = objc/hash.o objc/sarray.o \
122 objc/class.o objc/sendmsg.o \
123 objc/init.o objc/archive.o \
124 objc/encoding.o objc/selector.o \
125 objc/objects.o objc/misc.o \
126 objc/NXConstStr.o objc/Object.o \
127 objc/Protocol.o objc/nil_method.o \
128 objc/thr.o objc/linking.o \
129 objc/$(OBJC_THREAD_FILE).o
130
131 objc/hash.o: $(srcdir)/objc/hash.c
132 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
133 -c $(srcdir)/objc/hash.c -o $@
134 objc/sarray.o: $(srcdir)/objc/sarray.c
135 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
136 -c $(srcdir)/objc/sarray.c -o $@
137 objc/class.o: $(srcdir)/objc/class.c
138 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
139 -c $(srcdir)/objc/class.c -o $@
140 objc/sendmsg.o: $(srcdir)/objc/sendmsg.c
141 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
142 -c $(srcdir)/objc/sendmsg.c -o $@
143 objc/init.o: $(srcdir)/objc/init.c
144 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
145 -c $(srcdir)/objc/init.c -o $@
146 objc/archive.o: $(srcdir)/objc/archive.c
147 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
148 -c $(srcdir)/objc/archive.c -o $@
149 objc/encoding.o: $(srcdir)/objc/encoding.c
150 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
151 -c $(srcdir)/objc/encoding.c -o $@
152 objc/selector.o: $(srcdir)/objc/selector.c
153 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
154 -c $(srcdir)/objc/selector.c -o $@
155 objc/objects.o: $(srcdir)/objc/objects.c
156 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
157 -c $(srcdir)/objc/objects.c -o $@
158 objc/misc.o: $(srcdir)/objc/misc.c
159 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
160 -c $(srcdir)/objc/misc.c -o $@
161 objc/NXConstStr.o: $(srcdir)/objc/NXConstStr.m
162 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
163 -c $(srcdir)/objc/NXConstStr.m -o $@
164 objc/Object.o: $(srcdir)/objc/Object.m
165 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
166 -c $(srcdir)/objc/Object.m -o $@
167 objc/Protocol.o: $(srcdir)/objc/Protocol.m
168 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
169 -c $(srcdir)/objc/Protocol.m -o $@
170 objc/thr.o: $(srcdir)/objc/thr.h $(srcdir)/objc/thr.c
171 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
172 -c $(srcdir)/objc/thr.c -o $@
173 objc/$(OBJC_THREAD_FILE).o: $(srcdir)/objc/$(OBJC_THREAD_FILE).c
174 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
175 -c $(srcdir)/objc/$(OBJC_THREAD_FILE).c -o $@
176 objc/nil_method.o: $(srcdir)/objc/nil_method.c
177 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
178 -c $(srcdir)/objc/nil_method.c -o $@
179 objc/linking.o: $(srcdir)/objc/linking.m
180 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
181 -c $(srcdir)/objc/linking.m -o $@
182
183 # Build the Objective C runtime library.
184 libobjc.a: cc1obj specs stmp-int-hdrs libgcc2.ready \
185 $(USE_COLLECT2) $(EXTRA_PARTS) $(OBJC_O)
186 -rm -f libobjc.a
187 $(AR) $(AR_FLAGS) libobjc.a $(OBJC_O)
188 -if $(RANLIB_TEST) ; then $(RANLIB) libobjc.a; else true; fi
189
190 \f
191 # Build hooks:
192
193 objc.all.build:
194 objc.all.cross:
195 objc.start.encap:
196 objc.rest.encap:
197
198 objc.info:
199 objc.dvi:
200
201 \f
202 # Install hooks:
203 # cc1obj is installed elsewhere as part of $(COMPILERS).
204
205 # Nothing to do here.
206 objc.install-normal: installdirs
207 -if [ -f libobjc.a ] ; then \
208 rm -f $(libsubdir)/libobjc.a; \
209 $(INSTALL_DATA) libobjc.a $(libsubdir)/libobjc.a; \
210 if $(RANLIB_TEST) ; then \
211 (cd $(libsubdir); $(RANLIB) libobjc.a); else true; fi; \
212 chmod a-x $(libsubdir)/libobjc.a; \
213 else true; fi
214
215
216 objc.install-common:
217
218 objc.install-info:
219
220 objc.install-man:
221
222 objc.uninstall:
223 \f
224 # Clean hooks:
225 # A lot of the ancillary files are deleted by the main makefile.
226 # We just have to delete files specific to us.
227 objc.mostlyclean:
228 -rm -f tmp-objc-prs.y
229 -rm -f objc/*$(objext) objc/xforward objc/fflags
230 -rm -f libobjc.a
231 objc.clean: objc.mostlyclean
232 -rm -rf objc-headers
233 objc.distclean:
234 -rm -f objc/Makefile objc/Make-host objc/Make-target
235 -rm -f objc/config.status objc/config.cache
236 -rm -f objc-parse.output
237 objc.extraclean:
238 objc.maintainer-clean:
239 -rm -f objc/objc-parse.y
240 -rm -f objc/objc-parse.c objc/objc-parse.output
241
242 \f
243 # Stage hooks:
244
245 objc.stage1:
246 -mv objc/*$(objext) stage1/objc
247 -mv cc1obj$(exeext) stage1
248 -mv libobjc.a stage1
249 objc.stage2:
250 -mv objc/*$(objext) stage2/objc
251 -mv cc1obj$(exeext) stage2
252 -mv libobjc.a stage2
253 objc.stage3:
254 -mv objc/*$(objext) stage3/objc
255 -mv cc1obj$(exeext) stage3
256 -mv libobjc.a stage3
257 objc.stage4:
258 -mv objc/*$(objext) stage4/objc
259 -mv cc1obj$(exeext) stage4
260 -mv libobjc.a stage4
261
262 \f
263 # Maintenance hooks:
264
265 # This target creates the files that can be rebuilt, but go in the
266 # distribution anyway. It then copies the files to the distdir directory.
267 objc.distdir: