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
208 version.o: version.c version.h
210 hashtable.o: hashtable.c hashtable.h $(CONFIG_H) $(SYSTEM_H) $(OBSTACK_H)
212 cppcharset.o: cppcharset.c $(CONFIG_H) $(SYSTEM_H)
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
220 # Remake cpp and protoize.
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\"
231 ##########################
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
238 ##LIBCPP_DEPS = cpplib.h cpphash.h hashtable.h intl.h options.h $(OBSTACK_H) $(SYSTEM_H)
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)
244 $(AR) $(AR_FLAGS) libcpp.a $(LIBCPP_OBJS)
247 charset.o: $(LIBCPP_DIR)/charset.c $(CONFIG_H) $(LIBCPP_DEPS)
248 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
250 directives.o: $(LIBCPP_DIR)/directives.c $(CONFIG_H) $(LIBCPP_DEPS)
251 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
253 errors.o: $(LIBCPP_DIR)/errors.c $(CONFIG_H) $(LIBCPP_DEPS)
254 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
256 expr.o: $(LIBCPP_DIR)/expr.c $(CONFIG_H) $(LIBCPP_DEPS)
257 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
259 files.o: $(LIBCPP_DIR)/files.c $(CONFIG_H) $(LIBCPP_DEPS)
260 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
262 identifiers.o: $(LIBCPP_DIR)/identifiers.c $(CONFIG_H) $(LIBCPP_DEPS)
263 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
265 init.o: $(LIBCPP_DIR)/init.c $(CONFIG_H) $(LIBCPP_DEPS)
266 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
268 lex.o: $(LIBCPP_DIR)/lex.c $(CONFIG_H) $(LIBCPP_DEPS)
269 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
271 line-map.o: $(LIBCPP_DIR)/line-map.c $(CONFIG_H) $(LIBCPP_DEPS)
272 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
274 macro.o: $(LIBCPP_DIR)/macro.c $(CONFIG_H) $(LIBCPP_DEPS)
275 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
277 mkdeps.o: $(LIBCPP_DIR)/mkdeps.c $(CONFIG_H) $(LIBCPP_DEPS)
278 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
280 symtab.o: $(LIBCPP_DIR)/symtab.c $(CONFIG_H) $(LIBCPP_DEPS)
281 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
283 traditional.o: $(LIBCPP_DIR)/traditional.c $(CONFIG_H) $(LIBCPP_DEPS)
284 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
286 ##########################
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 \
294 concat.o: $(LIBIBERTY_DIR)/concat.c $(CONFIG_H) $(LIBCPP_DEPS)
295 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
297 fopen_unlocked.o: $(LIBIBERTY_DIR)/fopen_unlocked.c $(CONFIG_H) $(LIBCPP_DEPS)
298 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
300 getpwd.o: $(LIBIBERTY_DIR)/getpwd.c $(CONFIG_H) $(LIBCPP_DEPS)
301 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
303 hashtab.o: $(LIBIBERTY_DIR)/hashtab.c $(CONFIG_H) $(LIBCPP_DEPS)
304 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
306 hex.o: $(LIBIBERTY_DIR)/hex.c $(CONFIG_H) $(LIBCPP_DEPS)
307 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
309 lbasename.o: $(LIBIBERTY_DIR)/lbasename.c $(CONFIG_H) $(LIBCPP_DEPS)
310 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
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)
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)
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)
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)
324 vasprintf.o: $(LIBIBERTY_DIR)/vasprintf.c $(CONFIG_H) $(LIBCPP_DEPS)
325 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
327 xexit.o: $(LIBIBERTY_DIR)/xexit.c $(CONFIG_H) $(LIBCPP_DEPS)
328 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
330 xmalloc.o: $(LIBIBERTY_DIR)/xmalloc.c $(CONFIG_H) $(LIBCPP_DEPS)
331 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
333 xmemdup.o: $(LIBIBERTY_DIR)/xmemdup.c $(CONFIG_H) $(LIBCPP_DEPS)
334 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
336 xstrdup.o: $(LIBIBERTY_DIR)/xstrdup.c $(CONFIG_H) $(LIBCPP_DEPS)
337 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
339 xstrerror.o: $(LIBIBERTY_DIR)/xstrerror.c $(CONFIG_H) $(LIBCPP_DEPS)
340 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
342 ##########################
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
347 $(TARGET): $(SDCC_OBJS) $(MY_LIBIBERTY_BITS) libcpp.a $(LIBDEPS)
349 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(SDCC_OBJS) \
350 $(MY_LIBIBERTY_BITS) libcpp.a $(LIBS)
352 sdcpp.o: sdcpp.c $(CONFIG_H) $(SYSTEM_H) options.h
354 sdcpp-opts.o: sdcpp-opts.c $(CONFIG_H) $(LIBCPP_DEPS) options.h
356 c-ppoutput.o: c-ppoutput.c $(CONFIG_H) $(SYSTEM_H)
358 opts.o: opts.c $(CONFIG_H) $(LIBCPP_DEPS) options.h
360 diagnostic.o: diagnostic.c $(CONFIG_H) $(LIBCPP_DEPS) diagnostic.h
362 pretty-print.o: pretty-print.c $(CONFIG_H) $(LIBCPP_DEPS) pretty-print.h
364 c-incpath.o: $(CONFIG_H) $(LIBCPP_DEPS) c-incpath.h
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