1 # Makefile for GNU C Preprocessor.
3 # hacked from gcc Makefile by kvigor.
5 # Copyright (C) 1987, 1988, 1990, 1991, 1992, 1993, 1994, 1995
6 # 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
8 #This file is part of GNU CC.
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)
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.
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.
26 TARGET = ../../bin/sdcpp$(EXEEXT)
30 # This is the default target.
33 # Directory where sources are, from where we are.
40 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) \
41 $(CFLAGS) $(WARN_CFLAGS) $(XCFLAGS) @DEFS@
42 ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
52 # on sysV, define this as cp.
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.
58 # These permit overriding just for certain files.
59 INSTALL_PROGRAM = @INSTALL_PROGRAM@
60 INSTALL_DATA = @INSTALL_DATA@
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@
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 >
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
77 # Test to see whether <limits.h> exists in the system header files.
78 LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
80 # Common prefix for installation directories.
81 # NOTE: This directory must exist when you start installation.
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
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'
92 includedir = $(local_prefix)/include
93 # where the info files go
94 exeext = @host_exeext@
96 transform = @program_transform_name@
97 lang_opt_files=$(srcdir)/sdcpp.opt
99 # All option source files
100 ALL_OPT_FILES=$(lang_opt_files) $(extra_opt_files)
102 # Top build directory, relative to here.
103 top_builddir = @top_builddir@
105 # Whether we were configured with NLS.
108 # Internationalization library.
109 INTLLIBS = @INTLLIBS@
111 # Change this to a null string if obstacks are installed in the
115 # End of variables for you to override.
118 mkdir -p $(DESTDIR)$(bindir)
119 $(INSTALL) $(TARGET) `echo $(DESTDIR)$(bindir)/sdcpp$(EXEEXT)|sed '$(transform)'`
120 $(STRIP) `echo $(DESTDIR)$(bindir)/sdcpp$(EXEEXT)|sed '$(transform)'`
123 rm -f $(DESTDIR)$(bindir)/sdcpp$(EXEEXT)
125 -rm -f $(TARGET) *.o core libcpp.a
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 *~
131 # This tells GNU Make version 3 not to put all variables in the environment.
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.
138 SYSTEM_H = system.h hwint.h
140 # sed inserts variable overrides after the following line.
155 INCLUDES = -I$(srcdir) -I$(LIBCPP_DIR) -I$(LIBCPP_DIR)/include -I$(LIBIBERTY_DIR) -I.
157 # Always use -I$(srcdir)/config when compiling.
159 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
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
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.; \
187 LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status --recheck; \
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
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" < $< > $@
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 \
205 $(SHELL) $(srcdir)/move-if-change tmp-options.h options.h
209 # Remake cpp and protoize.
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\"
220 ##########################
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
227 ##LIBCPP_DEPS = cpplib.h cpphash.h hashtable.h intl.h options.h $(OBSTACK_H) $(SYSTEM_H)
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)
233 $(AR) $(AR_FLAGS) libcpp.a $(LIBCPP_OBJS)
236 charset.o: $(LIBCPP_DIR)/charset.c $(CONFIG_H) $(LIBCPP_DEPS)
237 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
239 directives.o: $(LIBCPP_DIR)/directives.c $(CONFIG_H) $(LIBCPP_DEPS)
240 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
242 errors.o: $(LIBCPP_DIR)/errors.c $(CONFIG_H) $(LIBCPP_DEPS)
243 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
245 expr.o: $(LIBCPP_DIR)/expr.c $(CONFIG_H) $(LIBCPP_DEPS)
246 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
248 files.o: $(LIBCPP_DIR)/files.c $(CONFIG_H) $(LIBCPP_DEPS)
249 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
251 identifiers.o: $(LIBCPP_DIR)/identifiers.c $(CONFIG_H) $(LIBCPP_DEPS)
252 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
254 init.o: $(LIBCPP_DIR)/init.c $(CONFIG_H) $(LIBCPP_DEPS)
255 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
257 lex.o: $(LIBCPP_DIR)/lex.c $(CONFIG_H) $(LIBCPP_DEPS)
258 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
260 line-map.o: $(LIBCPP_DIR)/line-map.c $(CONFIG_H) $(LIBCPP_DEPS)
261 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
263 macro.o: $(LIBCPP_DIR)/macro.c $(CONFIG_H) $(LIBCPP_DEPS)
264 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
266 mkdeps.o: $(LIBCPP_DIR)/mkdeps.c $(CONFIG_H) $(LIBCPP_DEPS)
267 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
269 symtab.o: $(LIBCPP_DIR)/symtab.c $(CONFIG_H) $(LIBCPP_DEPS)
270 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
272 traditional.o: $(LIBCPP_DIR)/traditional.c $(CONFIG_H) $(LIBCPP_DEPS)
273 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
275 ##########################
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 \
283 concat.o: $(LIBIBERTY_DIR)/concat.c $(CONFIG_H) $(LIBCPP_DEPS)
284 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
286 fopen_unlocked.o: $(LIBIBERTY_DIR)/fopen_unlocked.c $(CONFIG_H) $(LIBCPP_DEPS)
287 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
289 getpwd.o: $(LIBIBERTY_DIR)/getpwd.c $(CONFIG_H) $(LIBCPP_DEPS)
290 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
292 hashtab.o: $(LIBIBERTY_DIR)/hashtab.c $(CONFIG_H) $(LIBCPP_DEPS)
293 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
295 hex.o: $(LIBIBERTY_DIR)/hex.c $(CONFIG_H) $(LIBCPP_DEPS)
296 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
298 lbasename.o: $(LIBIBERTY_DIR)/lbasename.c $(CONFIG_H) $(LIBCPP_DEPS)
299 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
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)
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)
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)
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)
313 vasprintf.o: $(LIBIBERTY_DIR)/vasprintf.c $(CONFIG_H) $(LIBCPP_DEPS)
314 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
316 xexit.o: $(LIBIBERTY_DIR)/xexit.c $(CONFIG_H) $(LIBCPP_DEPS)
317 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
319 xmalloc.o: $(LIBIBERTY_DIR)/xmalloc.c $(CONFIG_H) $(LIBCPP_DEPS)
320 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
322 xmemdup.o: $(LIBIBERTY_DIR)/xmemdup.c $(CONFIG_H) $(LIBCPP_DEPS)
323 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
325 xstrdup.o: $(LIBIBERTY_DIR)/xstrdup.c $(CONFIG_H) $(LIBCPP_DEPS)
326 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
328 xstrerror.o: $(LIBIBERTY_DIR)/xstrerror.c $(CONFIG_H) $(LIBCPP_DEPS)
329 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
331 ##########################
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
336 $(TARGET): $(SDCC_OBJS) $(MY_LIBIBERTY_BITS) libcpp.a $(LIBDEPS)
338 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(SDCC_OBJS) \
339 $(MY_LIBIBERTY_BITS) libcpp.a $(LIBS)
341 sdcpp.o: sdcpp.c $(CONFIG_H) $(SYSTEM_H) options.h
343 sdcpp-opts.o: sdcpp-opts.c $(CONFIG_H) $(LIBCPP_DEPS) options.h
345 c-ppoutput.o: c-ppoutput.c $(CONFIG_H) $(SYSTEM_H)
347 options.o: options.c $(CONFIG_H) $(LIBCPP_DEPS) options.h
349 opts.o: opts.c $(CONFIG_H) $(LIBCPP_DEPS) options.h
351 diagnostic.o: diagnostic.c $(CONFIG_H) $(LIBCPP_DEPS) diagnostic.h options.h
353 pretty-print.o: pretty-print.c $(CONFIG_H) $(LIBCPP_DEPS) pretty-print.h
355 c-incpath.o: $(CONFIG_H) $(LIBCPP_DEPS) c-incpath.h
357 version.o: version.c version.h
359 cppcharset.o: cppcharset.c $(CONFIG_H) $(SYSTEM_H)
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
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