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)
51 # on sysV, define this as cp.
53 # Some systems may be missing symbolic links, regular links, or both.
54 # Allow configure to check this and use "ln -s", "ln", or "cp" as appropriate.
57 # These permit overriding just for certain files.
58 INSTALL_PROGRAM = @INSTALL_PROGRAM@
59 INSTALL_DATA = @INSTALL_DATA@
61 # Some compilers can't handle cc -c blah.c -o foo/blah.o.
62 # In stage2 and beyond, we force this to "-o $@" since we know we're using gcc.
63 OUTPUT_OPTION = @OUTPUT_OPTION@
65 # Some versions of `touch' (such as the version on Solaris 2.8)
66 # do not correctly set the timestamp due to buggy versions of `utime'
67 # in the kernel. So, we use `echo' instead.
68 STAMP = echo timestamp >
70 # Where to find some libiberty headers.
71 LIBIBERTY_DIR = $(srcdir)/libiberty
72 OBSTACK_H = $(LIBIBERTY_DIR)/obstack.h
73 SPLAY_TREE_H= $(LIBIBERTY_DIR)/splay-tree.h
75 # Test to see whether <limits.h> exists in the system header files.
76 LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
78 # Common prefix for installation directories.
79 # NOTE: This directory must exist when you start installation.
81 # Directory in which to put localized header files. On the systems with
82 # gcc as the native cc, `local_prefix' may not be `prefix' which is
84 # NOTE: local_prefix *should not* default from prefix.
85 local_prefix = @local_prefix@
86 # Directory in which to put host dependent programs and libraries
87 exec_prefix = @exec_prefix@
88 # Directory in which to put the executable for the command `gcc'
90 includedir = $(local_prefix)/include
91 # where the info files go
92 exeext = @host_exeext@
94 transform = @program_transform_name@
95 lang_opt_files=$(srcdir)/sdcpp.opt
97 # Top build directory, relative to here.
98 top_builddir = @top_builddir@
100 # Whether we were configured with NLS.
103 # Internationalization library.
104 INTLLIBS = @INTLLIBS@
106 # Change this to a null string if obstacks are installed in the
110 # End of variables for you to override.
113 mkdir -p $(DESTDIR)$(bindir)
114 $(INSTALL) $(TARGET) `echo $(DESTDIR)$(bindir)/sdcpp$(EXEEXT)|sed '$(transform)'`
115 $(STRIP) `echo $(DESTDIR)$(bindir)/sdcpp$(EXEEXT)|sed '$(transform)'`
118 rm -f $(DESTDIR)$(bindir)/sdcpp$(EXEEXT)
120 -rm -f $(TARGET) *.o core libcpp.a
123 -rm -f auto-host.h auto-build.h cstamp-h Makefile
124 -rm -f configargs.h config.status config.run config.cache config.bak config.log *~
126 # This tells GNU Make version 3 not to put all variables in the environment.
129 # GCONFIG_H lists the config files that the generator files depend on, while
130 # CONFIG_H lists the the ones ordinary gcc files depend on, which includes
131 # a file generated by gencodes.
133 SYSTEM_H = system.h hwint.h
135 # sed inserts variable overrides after the following line.
150 INCLUDES = -I$(srcdir) -I$(LIBIBERTY_DIR) -I.
152 # Always use -I$(srcdir)/config when compiling.
154 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
156 # cstamp-h.in controls rebuilding of config.in.
157 # It is named cstamp-h.in and not stamp-h.in so the mostlyclean rule doesn't
158 # delete it. A stamp file is needed as autoheader won't update the file if
159 # nothing has changed.
160 # It remains in the source directory and is part of the distribution.
161 # This follows what is done in shellutils, fileutils, etc.
162 # "echo timestamp" is used instead of touch to be consistent with other
163 # packages that use autoconf (??? perhaps also to avoid problems with patch?).
164 # ??? Newer versions have a maintainer mode that may be useful here.
165 $(srcdir)/config.in: $(srcdir)/cstamp-h.in $(srcdir)/acconfig.h
166 $(srcdir)/cstamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h
167 (cd $(srcdir) && autoheader)
168 @rm -f $(srcdir)/cstamp-h.in
169 echo timestamp > $(srcdir)/cstamp-h.in
170 auto-host.h: cstamp-h ; @true
171 cstamp-h: config.in config.status
172 CONFIG_HEADERS=auto-host.h:config.in LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status
174 # Really, really stupid make features, such as SUN's KEEP_STATE, may force
175 # a target to build even if it is up-to-date. So we must verify that
176 # config.status does not exist before failing.
177 config.status: $(srcdir)/configure version.c
178 @if [ ! -f config.status ] ; then \
179 echo You must configure gcc. Look at http://gcc.gnu.org/install/ for details.; \
182 LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status --recheck; \
185 options.c: $(lang_opt_files) $(srcdir)/opts.sh options.h intl.h
187 options.h: $(lang_opt_files) $(srcdir)/opts.sh Makefile
188 AWK=awk $(SHELL) $(srcdir)/opts.sh \
189 '$(SHELL) $(srcdir)/move-if-change' \
190 options.c options.h $(lang_opt_files)
192 version.o: version.c version.h
194 hashtable.o: hashtable.c hashtable.h $(CONFIG_H) $(SYSTEM_H) $(OBSTACK_H)
196 hashtab.o: hashtab.c hashtab.h $(CONFIG_H)
198 cppcharset.o: cppcharset.c $(CONFIG_H) $(SYSTEM_H)
200 mbchar.o: mbchar.c mbchar.h $(CONFIG_H) $(SYSTEM_H)
202 prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) Makefile prefix.h
203 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
204 -DPREFIX=\"$(prefix)\" \
205 -c $(srcdir)/prefix.c
208 # Remake cpp and protoize.
210 PREPROCESSOR_DEFINES = \
211 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
212 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
213 -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_alias)\" \
214 -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
215 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
216 -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
217 -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\"
219 LIBCPP_OBJS = c-ppoutput.o cppinit.o cpplib.o cpplex.o cppmacro.o cppexp.o cppfiles.o \
220 cpphash.o cpperror.o cppdefault.o \
221 hashtable.o mkdeps.o prefix.o version.o mbchar.o \
222 line-map.o cpptrad.o cppcharset.o hashtab.o \
223 opts.o options.o diagnostic.o pretty-print.o c-incpath.o
225 LIBCPP_DEPS = cpplib.h cpphash.h hashtable.h intl.h $(OBSTACK_H) $(SYSTEM_H)
227 # Most of the other archives built/used by this makefile are for
228 # targets. This one is strictly for the host.
229 libcpp.a: $(LIBCPP_OBJS)
231 $(AR) $(AR_FLAGS) libcpp.a $(LIBCPP_OBJS)
234 MY_LIBIBERTY_BITS = safe-ctype.o obstack.o splay-tree.o \
235 lbasename.o hex.o concat.o \
236 xmalloc.o xmemdup.o xstrdup.o xstrerror.o xexit.o getpwd.o
238 $(TARGET): sdcpp.o sdcpp-opts.o $(MY_LIBIBERTY_BITS) libcpp.a $(LIBDEPS)
240 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ sdcpp.o sdcpp-opts.o \
241 $(MY_LIBIBERTY_BITS) libcpp.a $(LIBS)
243 sdcpp.o: sdcpp.c $(CONFIG_H) cpplib.h $(SYSTEM_H)
244 sdcpp-opts.o: sdcpp-opts.c $(CONFIG_H) $(LIBCPP_DEPS)
246 c-ppoutput.o: c-ppoutput.c $(CONFIG_H) cpplib.h intl.h $(SYSTEM_H)
247 cppinit.o: cppinit.c $(CONFIG_H) $(LIBCPP_DEPS) cppdefault.h \
248 mkdeps.h prefix.h output.h version.h
249 cpperror.o: cpperror.c $(CONFIG_H) $(LIBCPP_DEPS)
250 cppexp.o: cppexp.c $(CONFIG_H) $(LIBCPP_DEPS)
251 cpplex.o: cpplex.c $(CONFIG_H) $(LIBCPP_DEPS) mbchar.h
252 cppmacro.o: cppmacro.c $(CONFIG_H) $(LIBCPP_DEPS)
253 cpplib.o: cpplib.c $(CONFIG_H) $(LIBCPP_DEPS)
254 cpphash.o: cpphash.c $(CONFIG_H) $(LIBCPP_DEPS)
255 cppfiles.o: cppfiles.c $(CONFIG_H) $(LIBCPP_DEPS) $(SPLAY_TREE_H) mkdeps.h
256 cpptrad.o: cpptrad.c $(CONFIG_H) $(LIBCPP_DEPS)
257 opts.o: opts.c $(CONFIG_H) $(LIBCPP_DEPS) options.h
258 diagnostic.o: diagnostic.c $(CONFIG_H) $(LIBCPP_DEPS) diagnostic.h
259 pretty-print.o: pretty-print.c $(CONFIG_H) $(LIBCPP_DEPS) pretty-print.h
260 c-incpath.o: $(CONFIG_H) $(LIBCPP_DEPS) c-incpath.h
262 cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) cppdefault.h Makefile
263 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
264 $(PREPROCESSOR_DEFINES) \
265 -c $(srcdir)/cppdefault.c
267 mkdeps.o: mkdeps.c $(CONFIG_H) $(SYSTEM_H) mkdeps.h
271 safe-ctype.o: $(LIBIBERTY_DIR)/safe-ctype.c $(LIBIBERTY_DIR)/safe-ctype.h $(CONFIG_H) $(LIBCPP_DEPS)
272 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
274 obstack.o: $(LIBIBERTY_DIR)/obstack.c $(LIBIBERTY_DIR)/obstack.h $(CONFIG_H) $(LIBCPP_DEPS)
275 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
277 splay-tree.o: $(LIBIBERTY_DIR)/splay-tree.c $(LIBIBERTY_DIR)/splay-tree.h $(CONFIG_H) $(LIBCPP_DEPS)
278 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
280 lbasename.o: $(LIBIBERTY_DIR)/lbasename.c $(CONFIG_H) $(LIBCPP_DEPS)
281 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
283 hex.o: $(LIBIBERTY_DIR)/hex.c $(CONFIG_H) $(LIBCPP_DEPS)
284 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
286 concat.o: $(LIBIBERTY_DIR)/concat.c $(CONFIG_H) $(LIBCPP_DEPS)
287 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
289 xmalloc.o: $(LIBIBERTY_DIR)/xmalloc.c $(CONFIG_H) $(LIBCPP_DEPS)
290 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
292 xmemdup.o: $(LIBIBERTY_DIR)/xmemdup.c $(CONFIG_H) $(LIBCPP_DEPS)
293 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
295 xstrdup.o: $(LIBIBERTY_DIR)/xstrdup.c $(CONFIG_H) $(LIBCPP_DEPS)
296 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
298 xexit.o: $(LIBIBERTY_DIR)/xexit.c $(CONFIG_H) $(LIBCPP_DEPS)
299 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
301 xstrerror.o: $(LIBIBERTY_DIR)/xstrerror.c $(CONFIG_H) $(LIBCPP_DEPS)
302 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
304 getpwd.o: $(LIBIBERTY_DIR)/getpwd.c $(CONFIG_H) $(LIBCPP_DEPS)
305 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)