46980540105ace453c097aae7ecafffae18f8642
[fw/sdcc] / support / cpp2 / Makefile.in
1 # Makefile for GNU C Preprocessor.
2 #
3 # hacked from gcc Makefile by kvigor.
4 #
5 #   Copyright (C) 1987, 1988, 1990, 1991, 1992, 1993, 1994, 1995
6 #   1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
7
8 #This file is part of GNU CC.
9
10 #GNU CC is free software; you can redistribute it and/or modify
11 #it under the terms of the GNU General Public License as published by
12 #the Free Software Foundation; either version 2, or (at your option)
13 #any later version.
14
15 #GNU CC is distributed in the hope that it will be useful,
16 #but WITHOUT ANY WARRANTY; without even the implied warranty of
17 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 #GNU General Public License for more details.
19
20 #You should have received a copy of the GNU General Public License
21 #along with GNU CC; see the file COPYING.  If not, write to
22 #the Free Software Foundation, 59 Temple Place - Suite 330,
23 #Boston MA 02111-1307, USA.
24
25 EXEEXT = @EXEEXT@
26 TARGET = ../../bin/sdcpp$(EXEEXT)
27
28 VPATH  = @srcdir@
29
30 # This is the default target.
31 all: $(TARGET)
32
33 # Directory where sources are, from where we are.
34 srcdir = @srcdir@
35
36
37
38 LIBS = @LIBS@
39 CFLAGS = @CFLAGS@
40 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) \
41   $(CFLAGS) $(WARN_CFLAGS) $(XCFLAGS) @DEFS@
42 ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
43 LDFLAGS = @LDFLAGS@
44
45 AWK = @AWK@
46 CC = @CC@
47 AR = ar
48 AR_FLAGS = rc
49 RANLIB = @RANLIB@
50 SHELL = /bin/sh
51 STRIP = @STRIP@
52 # on sysV, define this as cp.
53 INSTALL = @INSTALL@
54 # Some systems may be missing symbolic links, regular links, or both.
55 # Allow configure to check this and use "ln -s", "ln", or "cp" as appropriate.
56 LN=@LN@
57 LN_S=@LN_S@
58 # These permit overriding just for certain files.
59 INSTALL_PROGRAM = @INSTALL_PROGRAM@
60 INSTALL_DATA = @INSTALL_DATA@
61 @SET_MAKE@
62 # Some compilers can't handle cc -c blah.c -o foo/blah.o.
63 # In stage2 and beyond, we force this to "-o $@" since we know we're using gcc.
64 OUTPUT_OPTION = @OUTPUT_OPTION@
65
66 # Some versions of `touch' (such as the version on Solaris 2.8)
67 # do not correctly set the timestamp due to buggy versions of `utime'
68 # in the kernel.  So, we use `echo' instead.
69 STAMP = echo timestamp >
70
71 # Where to find some libiberty headers.
72 LIBIBERTY_DIR = $(srcdir)/libiberty
73 LIBCPP_DIR = $(srcdir)/libcpp
74 OBSTACK_H   = $(LIBIBERTY_DIR)/obstack.h
75 SPLAY_TREE_H= $(LIBIBERTY_DIR)/splay-tree.h
76
77 # Test to see whether <limits.h> exists in the system header files.
78 LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
79
80 # Common prefix for installation directories.
81 # NOTE: This directory must exist when you start installation.
82 prefix = @prefix@
83 # Directory in which to put localized header files. On the systems with
84 # gcc as the native cc, `local_prefix' may not be `prefix' which is
85 # `/usr'.
86 # NOTE: local_prefix *should not* default from prefix.
87 local_prefix = @local_prefix@
88 # Directory in which to put host dependent programs and libraries
89 exec_prefix = @exec_prefix@
90 # Directory in which to put the executable for the command `gcc'
91 bindir = @bindir@
92 includedir = $(local_prefix)/include
93 # where the info files go
94 exeext = @host_exeext@
95
96 transform       = @program_transform_name@
97 lang_opt_files=$(srcdir)/sdcpp.opt
98
99 # All option source files
100 ALL_OPT_FILES=$(lang_opt_files) $(extra_opt_files)
101
102 # Top build directory, relative to here.
103 top_builddir = @top_builddir@
104
105 # Whether we were configured with NLS.
106 USE_NLS = @USE_NLS@
107
108 # Internationalization library.
109 INTLLIBS = @INTLLIBS@
110
111 # Change this to a null string if obstacks are installed in the
112 # system library.
113 OBSTACK=obstack.o
114
115 # End of variables for you to override.
116
117 install: all
118         mkdir -p $(DESTDIR)$(bindir)
119         $(INSTALL) $(TARGET) `echo $(DESTDIR)$(bindir)/sdcpp$(EXEEXT)|sed '$(transform)'`
120         $(STRIP) `echo $(DESTDIR)$(bindir)/sdcpp$(EXEEXT)|sed '$(transform)'`
121
122 uninstall:
123         rm -f $(DESTDIR)$(bindir)/sdcpp$(EXEEXT)
124 clean:
125         -rm -f $(TARGET) *.o core libcpp.a
126
127 distclean: clean
128         -rm -f auto-host.h auto-build.h cstamp-h Makefile
129         -rm -f configargs.h config.status config.run config.cache config.bak config.log *~
130
131 # This tells GNU Make version 3 not to put all variables in the environment.
132 .NOEXPORT:
133
134 # GCONFIG_H lists the config files that the generator files depend on, while
135 # CONFIG_H lists the the ones ordinary gcc files depend on, which includes
136 # a file generated by gencodes.
137 CONFIG_H = config.h
138 SYSTEM_H = system.h hwint.h
139
140 # sed inserts variable overrides after the following line.
141 ####target overrides
142 #@target_overrides@
143
144 ####host overrides
145 #@host_overrides@
146
147 ####cross overrides
148 #@cross_defines@
149 #@cross_overrides@
150
151 ####build overrides
152 #@build_overrides@
153 #\f
154
155 INCLUDES = -I$(srcdir) -I$(LIBCPP_DIR) -I$(LIBCPP_DIR)/include -I$(LIBIBERTY_DIR) -I.
156
157 # Always use -I$(srcdir)/config when compiling.
158 .c.o:
159         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
160
161 # cstamp-h.in controls rebuilding of config.in.
162 # It is named cstamp-h.in and not stamp-h.in so the mostlyclean rule doesn't
163 # delete it.  A stamp file is needed as autoheader won't update the file if
164 # nothing has changed.
165 # It remains in the source directory and is part of the distribution.
166 # This follows what is done in shellutils, fileutils, etc.
167 # "echo timestamp" is used instead of touch to be consistent with other
168 # packages that use autoconf (??? perhaps also to avoid problems with patch?).
169 # ??? Newer versions have a maintainer mode that may be useful here.
170 $(srcdir)/config.in: $(srcdir)/cstamp-h.in $(srcdir)/acconfig.h
171 $(srcdir)/cstamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h
172         (cd $(srcdir) && autoheader)
173         @rm -f $(srcdir)/cstamp-h.in
174         echo timestamp > $(srcdir)/cstamp-h.in
175 auto-host.h: cstamp-h ; @true
176 cstamp-h: config.in config.status
177         CONFIG_HEADERS=auto-host.h:config.in LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status
178
179 # Really, really stupid make features, such as SUN's KEEP_STATE, may force
180 # a target to build even if it is up-to-date.  So we must verify that
181 # config.status does not exist before failing.
182 config.status: $(srcdir)/configure  version.c
183         @if [ ! -f config.status ] ; then \
184           echo You must configure gcc.  Look at http://gcc.gnu.org/install/ for details.; \
185           false; \
186         else \
187           LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status --recheck; \
188         fi
189
190
191 optionlist: s-options ; @true
192 s-options: $(ALL_OPT_FILES) Makefile $(srcdir)/opt-gather.awk
193         $(AWK) -f $(srcdir)/opt-gather.awk $(ALL_OPT_FILES) > tmp-optionlist
194         $(SHELL) $(srcdir)/move-if-change tmp-optionlist optionlist
195         $(STAMP) s-options
196
197 options.c: optionlist $(srcdir)/opt-functions.awk $(srcdir)/optc-gen.awk
198         $(AWK) -f $(srcdir)/opt-functions.awk -f $(srcdir)/optc-gen.awk \
199                -v header_name="config.h system.h options.h" < $< > $@
200
201 options.h: s-options-h ; @true
202 s-options-h: optionlist $(srcdir)/opt-functions.awk $(srcdir)/opth-gen.awk
203         $(AWK) -f $(srcdir)/opt-functions.awk -f $(srcdir)/opth-gen.awk \
204                < $< > tmp-options.h
205         $(SHELL) $(srcdir)/move-if-change tmp-options.h options.h
206         $(STAMP) $@
207
208 version.o: version.c version.h
209
210 hashtable.o: hashtable.c hashtable.h $(CONFIG_H) $(SYSTEM_H) $(OBSTACK_H)
211
212 cppcharset.o: cppcharset.c $(CONFIG_H) $(SYSTEM_H)
213
214 prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) Makefile prefix.h
215         $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
216         -DPREFIX=\"$(prefix)\" \
217           -c $(srcdir)/prefix.c
218
219 #\f
220 # Remake cpp and protoize.
221
222 PREPROCESSOR_DEFINES = \
223   -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
224   -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
225   -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_alias)\" \
226   -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
227   -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
228   -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
229   -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\"
230
231 ##########################
232 # Libcpp
233
234 LIBCPP_OBJS =   charset.o directives.o errors.o expr.o files.o identifiers.o \
235                 init.o lex.o line-map.o macro.o mkdeps.o symtab.o traditional.o
236
237
238 ##LIBCPP_DEPS = cpplib.h cpphash.h hashtable.h intl.h options.h $(OBSTACK_H) $(SYSTEM_H)
239
240 # Most of the other archives built/used by this makefile are for
241 # targets.  This one is strictly for the host.
242 libcpp.a: $(LIBCPP_OBJS)
243         -rm -rf libcpp.a
244         $(AR) $(AR_FLAGS) libcpp.a $(LIBCPP_OBJS)
245         -$(RANLIB) libcpp.a
246
247 charset.o: $(LIBCPP_DIR)/charset.c $(CONFIG_H) $(LIBCPP_DEPS)
248         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
249
250 directives.o: $(LIBCPP_DIR)/directives.c $(CONFIG_H) $(LIBCPP_DEPS)
251         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
252
253 errors.o: $(LIBCPP_DIR)/errors.c $(CONFIG_H) $(LIBCPP_DEPS)
254         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
255
256 expr.o: $(LIBCPP_DIR)/expr.c $(CONFIG_H) $(LIBCPP_DEPS)
257         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
258
259 files.o: $(LIBCPP_DIR)/files.c $(CONFIG_H) $(LIBCPP_DEPS)
260         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
261
262 identifiers.o: $(LIBCPP_DIR)/identifiers.c $(CONFIG_H) $(LIBCPP_DEPS)
263         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
264
265 init.o: $(LIBCPP_DIR)/init.c $(CONFIG_H) $(LIBCPP_DEPS)
266         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
267
268 lex.o: $(LIBCPP_DIR)/lex.c $(CONFIG_H) $(LIBCPP_DEPS)
269         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
270
271 line-map.o: $(LIBCPP_DIR)/line-map.c $(CONFIG_H) $(LIBCPP_DEPS)
272         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
273
274 macro.o: $(LIBCPP_DIR)/macro.c $(CONFIG_H) $(LIBCPP_DEPS)
275         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
276
277 mkdeps.o: $(LIBCPP_DIR)/mkdeps.c $(CONFIG_H) $(LIBCPP_DEPS)
278         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
279
280 symtab.o: $(LIBCPP_DIR)/symtab.c $(CONFIG_H) $(LIBCPP_DEPS)
281         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
282
283 traditional.o: $(LIBCPP_DIR)/traditional.c $(CONFIG_H) $(LIBCPP_DEPS)
284         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
285
286 ##########################
287 # Libiberty
288
289 MY_LIBIBERTY_BITS = concat.o fopen_unlocked.o getpwd.o hashtab.o hex.o \
290                     lbasename.o md5.o obstack.o safe-ctype.o splay-tree.o \
291                     vasprintf.o xexit.o xmalloc.o xmemdup.o xstrdup.o \
292                     xstrerror.o
293
294 concat.o: $(LIBIBERTY_DIR)/concat.c $(CONFIG_H) $(LIBCPP_DEPS)
295         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
296
297 fopen_unlocked.o: $(LIBIBERTY_DIR)/fopen_unlocked.c $(CONFIG_H) $(LIBCPP_DEPS)
298         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
299
300 getpwd.o: $(LIBIBERTY_DIR)/getpwd.c $(CONFIG_H) $(LIBCPP_DEPS)
301         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
302
303 hashtab.o: $(LIBIBERTY_DIR)/hashtab.c $(CONFIG_H) $(LIBCPP_DEPS)
304         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
305
306 hex.o: $(LIBIBERTY_DIR)/hex.c $(CONFIG_H) $(LIBCPP_DEPS)
307         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
308
309 lbasename.o: $(LIBIBERTY_DIR)/lbasename.c $(CONFIG_H) $(LIBCPP_DEPS)
310         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
311
312 md5.o: $(LIBIBERTY_DIR)/md5.c $(LIBIBERTY_DIR)/obstack.h $(CONFIG_H) $(LIBCPP_DEPS)
313         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
314
315 obstack.o: $(LIBIBERTY_DIR)/obstack.c $(LIBIBERTY_DIR)/obstack.h $(CONFIG_H) $(LIBCPP_DEPS)
316         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
317
318 safe-ctype.o: $(LIBIBERTY_DIR)/safe-ctype.c $(LIBIBERTY_DIR)/safe-ctype.h $(CONFIG_H) $(LIBCPP_DEPS)
319         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
320
321 splay-tree.o: $(LIBIBERTY_DIR)/splay-tree.c $(LIBIBERTY_DIR)/splay-tree.h $(CONFIG_H) $(LIBCPP_DEPS)
322         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
323
324 vasprintf.o: $(LIBIBERTY_DIR)/vasprintf.c  $(CONFIG_H) $(LIBCPP_DEPS)
325         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
326
327 xexit.o: $(LIBIBERTY_DIR)/xexit.c  $(CONFIG_H) $(LIBCPP_DEPS)
328         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
329
330 xmalloc.o: $(LIBIBERTY_DIR)/xmalloc.c  $(CONFIG_H) $(LIBCPP_DEPS)
331         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
332
333 xmemdup.o: $(LIBIBERTY_DIR)/xmemdup.c  $(CONFIG_H) $(LIBCPP_DEPS)
334         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
335
336 xstrdup.o: $(LIBIBERTY_DIR)/xstrdup.c  $(CONFIG_H) $(LIBCPP_DEPS)
337         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
338
339 xstrerror.o: $(LIBIBERTY_DIR)/xstrerror.c  $(CONFIG_H) $(LIBCPP_DEPS)
340         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
341
342 ##########################
343 # Sdcpp
344
345 SDCC_OBJS =     sdcpp.o sdcpp-opts.o c-ppoutput.o cppdefault.o prefix.o version.o opts.o options.o diagnostic.o pretty-print.o c-incpath.o
346
347 $(TARGET): $(SDCC_OBJS) $(MY_LIBIBERTY_BITS) libcpp.a $(LIBDEPS)
348         mkdir -p $(dir $@)
349         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(SDCC_OBJS) \
350         $(MY_LIBIBERTY_BITS) libcpp.a $(LIBS)
351
352 sdcpp.o:      sdcpp.c  $(CONFIG_H) $(SYSTEM_H) options.h
353
354 sdcpp-opts.o: sdcpp-opts.c $(CONFIG_H) $(LIBCPP_DEPS) options.h
355
356 c-ppoutput.o:  c-ppoutput.c  $(CONFIG_H) $(SYSTEM_H)
357
358 opts.o:     opts.c     $(CONFIG_H) $(LIBCPP_DEPS) options.h
359
360 diagnostic.o: diagnostic.c $(CONFIG_H) $(LIBCPP_DEPS) diagnostic.h
361
362 pretty-print.o: pretty-print.c $(CONFIG_H) $(LIBCPP_DEPS) pretty-print.h
363
364 c-incpath.o: $(CONFIG_H) $(LIBCPP_DEPS) c-incpath.h
365
366 cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) cppdefault.h Makefile
367         $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
368           $(PREPROCESSOR_DEFINES) \
369           -c $(srcdir)/cppdefault.c