fb70ce77fadf2fd63d88b418a6c84be59bb34078
[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 #\f
209 # Remake cpp and protoize.
210
211 PREPROCESSOR_DEFINES = \
212   -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
213   -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
214   -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_alias)\" \
215   -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
216   -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
217   -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
218   -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\"
219
220 ##########################
221 # Libcpp
222
223 LIBCPP_OBJS =   charset.o directives.o errors.o expr.o files.o identifiers.o \
224                 init.o lex.o line-map.o macro.o mkdeps.o symtab.o traditional.o
225
226
227 ##LIBCPP_DEPS = cpplib.h cpphash.h hashtable.h intl.h options.h $(OBSTACK_H) $(SYSTEM_H)
228
229 # Most of the other archives built/used by this makefile are for
230 # targets.  This one is strictly for the host.
231 libcpp.a: $(LIBCPP_OBJS)
232         -rm -rf libcpp.a
233         $(AR) $(AR_FLAGS) libcpp.a $(LIBCPP_OBJS)
234         -$(RANLIB) libcpp.a
235
236 charset.o: $(LIBCPP_DIR)/charset.c $(CONFIG_H) $(LIBCPP_DEPS)
237         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
238
239 directives.o: $(LIBCPP_DIR)/directives.c $(CONFIG_H) $(LIBCPP_DEPS)
240         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
241
242 errors.o: $(LIBCPP_DIR)/errors.c $(CONFIG_H) $(LIBCPP_DEPS)
243         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
244
245 expr.o: $(LIBCPP_DIR)/expr.c $(CONFIG_H) $(LIBCPP_DEPS)
246         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
247
248 files.o: $(LIBCPP_DIR)/files.c $(CONFIG_H) $(LIBCPP_DEPS)
249         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
250
251 identifiers.o: $(LIBCPP_DIR)/identifiers.c $(CONFIG_H) $(LIBCPP_DEPS)
252         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
253
254 init.o: $(LIBCPP_DIR)/init.c $(CONFIG_H) $(LIBCPP_DEPS)
255         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
256
257 lex.o: $(LIBCPP_DIR)/lex.c $(CONFIG_H) $(LIBCPP_DEPS)
258         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
259
260 line-map.o: $(LIBCPP_DIR)/line-map.c $(CONFIG_H) $(LIBCPP_DEPS)
261         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
262
263 macro.o: $(LIBCPP_DIR)/macro.c $(CONFIG_H) $(LIBCPP_DEPS)
264         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
265
266 mkdeps.o: $(LIBCPP_DIR)/mkdeps.c $(CONFIG_H) $(LIBCPP_DEPS)
267         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
268
269 symtab.o: $(LIBCPP_DIR)/symtab.c $(CONFIG_H) $(LIBCPP_DEPS)
270         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
271
272 traditional.o: $(LIBCPP_DIR)/traditional.c $(CONFIG_H) $(LIBCPP_DEPS)
273         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
274
275 ##########################
276 # Libiberty
277
278 MY_LIBIBERTY_BITS = concat.o fopen_unlocked.o getpwd.o hashtab.o hex.o \
279                     lbasename.o md5.o obstack.o safe-ctype.o splay-tree.o \
280                     vasprintf.o xexit.o xmalloc.o xmemdup.o xstrdup.o \
281                     xstrerror.o
282
283 concat.o: $(LIBIBERTY_DIR)/concat.c $(CONFIG_H) $(LIBCPP_DEPS)
284         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
285
286 fopen_unlocked.o: $(LIBIBERTY_DIR)/fopen_unlocked.c $(CONFIG_H) $(LIBCPP_DEPS)
287         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
288
289 getpwd.o: $(LIBIBERTY_DIR)/getpwd.c $(CONFIG_H) $(LIBCPP_DEPS)
290         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
291
292 hashtab.o: $(LIBIBERTY_DIR)/hashtab.c $(CONFIG_H) $(LIBCPP_DEPS)
293         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
294
295 hex.o: $(LIBIBERTY_DIR)/hex.c $(CONFIG_H) $(LIBCPP_DEPS)
296         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
297
298 lbasename.o: $(LIBIBERTY_DIR)/lbasename.c $(CONFIG_H) $(LIBCPP_DEPS)
299         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
300
301 md5.o: $(LIBIBERTY_DIR)/md5.c $(LIBIBERTY_DIR)/obstack.h $(CONFIG_H) $(LIBCPP_DEPS)
302         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
303
304 obstack.o: $(LIBIBERTY_DIR)/obstack.c $(LIBIBERTY_DIR)/obstack.h $(CONFIG_H) $(LIBCPP_DEPS)
305         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
306
307 safe-ctype.o: $(LIBIBERTY_DIR)/safe-ctype.c $(LIBIBERTY_DIR)/safe-ctype.h $(CONFIG_H) $(LIBCPP_DEPS)
308         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
309
310 splay-tree.o: $(LIBIBERTY_DIR)/splay-tree.c $(LIBIBERTY_DIR)/splay-tree.h $(CONFIG_H) $(LIBCPP_DEPS)
311         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
312
313 vasprintf.o: $(LIBIBERTY_DIR)/vasprintf.c  $(CONFIG_H) $(LIBCPP_DEPS)
314         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
315
316 xexit.o: $(LIBIBERTY_DIR)/xexit.c  $(CONFIG_H) $(LIBCPP_DEPS)
317         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
318
319 xmalloc.o: $(LIBIBERTY_DIR)/xmalloc.c  $(CONFIG_H) $(LIBCPP_DEPS)
320         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
321
322 xmemdup.o: $(LIBIBERTY_DIR)/xmemdup.c  $(CONFIG_H) $(LIBCPP_DEPS)
323         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
324
325 xstrdup.o: $(LIBIBERTY_DIR)/xstrdup.c  $(CONFIG_H) $(LIBCPP_DEPS)
326         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
327
328 xstrerror.o: $(LIBIBERTY_DIR)/xstrerror.c  $(CONFIG_H) $(LIBCPP_DEPS)
329         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
330
331 ##########################
332 # Sdcpp
333
334 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
335
336 $(TARGET): $(SDCC_OBJS) $(MY_LIBIBERTY_BITS) libcpp.a $(LIBDEPS)
337         mkdir -p $(dir $@)
338         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(SDCC_OBJS) \
339         $(MY_LIBIBERTY_BITS) libcpp.a $(LIBS)
340
341 sdcpp.o: sdcpp.c $(CONFIG_H) $(SYSTEM_H) options.h
342
343 sdcpp-opts.o: sdcpp-opts.c $(CONFIG_H) $(LIBCPP_DEPS) options.h
344
345 c-ppoutput.o: c-ppoutput.c $(CONFIG_H) $(SYSTEM_H)
346
347 options.o: options.c $(CONFIG_H) $(LIBCPP_DEPS) options.h
348
349 opts.o: opts.c $(CONFIG_H) $(LIBCPP_DEPS) options.h
350
351 diagnostic.o: diagnostic.c $(CONFIG_H) $(LIBCPP_DEPS) diagnostic.h options.h
352
353 pretty-print.o: pretty-print.c $(CONFIG_H) $(LIBCPP_DEPS) pretty-print.h
354
355 c-incpath.o: $(CONFIG_H) $(LIBCPP_DEPS) c-incpath.h
356
357 version.o: version.c version.h
358
359 cppcharset.o: cppcharset.c $(CONFIG_H) $(SYSTEM_H)
360
361 prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) Makefile prefix.h
362         $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
363         -DPREFIX=\"$(prefix)\" \
364           -c $(srcdir)/prefix.c
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