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 = $(PRJDIR)/bin/sdcpp2
28 # This is the default target.
31 # Directory where sources are, from where we are.
37 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) \
38 $(CFLAGS) $(WARN_CFLAGS) $(XCFLAGS) @DEFS@
39 ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
46 # on sysV, define this as cp.
48 # Some systems may be missing symbolic links, regular links, or both.
49 # Allow configure to check this and use "ln -s", "ln", or "cp" as appropriate.
52 # These permit overriding just for certain files.
53 INSTALL_PROGRAM = @INSTALL_PROGRAM@
54 INSTALL_DATA = @INSTALL_DATA@
56 # Some compilers can't handle cc -c blah.c -o foo/blah.o.
57 # In stage2 and beyond, we force this to "-o $@" since we know we're using gcc.
58 OUTPUT_OPTION = @OUTPUT_OPTION@
60 # Some versions of `touch' (such as the version on Solaris 2.8)
61 # do not correctly set the timestamp due to buggy versions of `utime'
62 # in the kernel. So, we use `echo' instead.
63 STAMP = echo timestamp >
65 # Where to find some libiberty headers.
66 LIBIBERTY_DIR = $(srcdir)/libiberty
67 OBSTACK_H = $(LIBIBERTY_DIR)/obstack.h
68 SPLAY_TREE_H= $(LIBIBERTY_DIR)/splay-tree.h
70 # Test to see whether <limits.h> exists in the system header files.
71 LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
73 # Common prefix for installation directories.
74 # NOTE: This directory must exist when you start installation.
76 # Directory in which to put localized header files. On the systems with
77 # gcc as the native cc, `local_prefix' may not be `prefix' which is
79 # NOTE: local_prefix *should not* default from prefix.
80 local_prefix = @local_prefix@
81 # Directory in which to put host dependent programs and libraries
82 exec_prefix = @exec_prefix@
83 # Directory in which to put the executable for the command `gcc'
85 includedir = $(local_prefix)/include
86 # where the info files go
87 exeext = @host_exeext@
89 # Top build directory, relative to here.
92 # Whether we were configured with NLS.
95 # Internationalization library.
98 # Change this to a null string if obstacks are installed in the
102 # End of variables for you to override.
105 $(INSTALL) -s $(TARGET) $(bindir)/sdcpp
108 -rm -f $(TARGET) *.o core libcpp.a
111 -rm -f auto-host.h auto-build.h cstamp-h Makefile
112 -rm -f config.status config.run config.cache config.bak config.log *~
114 # This tells GNU Make version 3 not to put all variables in the environment.
117 # GCONFIG_H lists the config files that the generator files depend on, while
118 # CONFIG_H lists the the ones ordinary gcc files depend on, which includes
119 # a file generated by gencodes.
121 SYSTEM_H = system.h hwint.h
123 # sed inserts variable overrides after the following line.
138 INCLUDES = -I$(srcdir) -I$(LIBIBERTY_DIR)
140 # Always use -I$(srcdir)/config when compiling.
142 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
144 # cstamp-h.in controls rebuilding of config.in.
145 # It is named cstamp-h.in and not stamp-h.in so the mostlyclean rule doesn't
146 # delete it. A stamp file is needed as autoheader won't update the file if
147 # nothing has changed.
148 # It remains in the source directory and is part of the distribution.
149 # This follows what is done in shellutils, fileutils, etc.
150 # "echo timestamp" is used instead of touch to be consistent with other
151 # packages that use autoconf (??? perhaps also to avoid problems with patch?).
152 # ??? Newer versions have a maintainer mode that may be useful here.
153 $(srcdir)/config.in: $(srcdir)/cstamp-h.in $(srcdir)/acconfig.h
154 $(srcdir)/cstamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h
155 (cd $(srcdir) && autoheader)
156 @rm -f $(srcdir)/cstamp-h.in
157 echo timestamp > $(srcdir)/cstamp-h.in
158 auto-host.h: cstamp-h ; @true
159 cstamp-h: config.in config.status
160 CONFIG_HEADERS=auto-host.h:config.in LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status
162 # Really, really stupid make features, such as SUN's KEEP_STATE, may force
163 # a target to build even if it is up-to-date. So we must verify that
164 # config.status does not exist before failing.
165 config.status: $(srcdir)/configure version.c
166 @if [ ! -f config.status ] ; then \
167 echo You must configure gcc. Look at http://gcc.gnu.org/install/ for details.; \
170 LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status --recheck; \
173 version.o: version.c version.h
175 hashtable.o: hashtable.c hashtable.h $(CONFIG_H) $(SYSTEM_H) $(OBSTACK_H)
177 prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) Makefile prefix.h
178 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
179 -DPREFIX=\"$(prefix)\" \
180 -c $(srcdir)/prefix.c
182 intl.o: intl.c intl.h Makefile
183 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
184 -DLOCALEDIR=\"$(localedir)\" \
188 # Remake cpp and protoize.
190 PREPROCESSOR_DEFINES = \
191 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
192 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
193 -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_alias)\" \
194 -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
195 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
196 -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
197 -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\"
199 LIBCPP_OBJS = cpplib.o cpplex.o cppmacro.o cppexp.o cppfiles.o \
200 cpphash.o cpperror.o cppinit.o cppdefault.o \
201 hashtable.o mkdeps.o prefix.o version.o mbchar.o
203 LIBCPP_DEPS = cpplib.h cpphash.h hashtable.h intl.h $(OBSTACK_H) $(SYSTEM_H)
205 # Most of the other archives built/used by this makefile are for
206 # targets. This one is strictly for the host.
207 libcpp.a: $(LIBCPP_OBJS)
209 $(AR) $(AR_FLAGS) libcpp.a $(LIBCPP_OBJS)
212 MY_LIBIBERTY_BITS = intl.o safe-ctype.o obstack.o splay-tree.o \
215 $(TARGET): cppmain.o intl.o $(MY_LIBIBERTY_BITS) libcpp.a $(LIBDEPS)
216 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cppmain.o \
217 $(MY_LIBIBERTY_BITS) libcpp.a $(LIBS)
219 cppmain.o: cppmain.c $(CONFIG_H) cpplib.h intl.h $(SYSTEM_H)
221 cpperror.o: cpperror.c $(CONFIG_H) $(LIBCPP_DEPS)
222 cppexp.o: cppexp.c $(CONFIG_H) $(LIBCPP_DEPS)
223 cpplex.o: cpplex.c $(CONFIG_H) $(LIBCPP_DEPS) mbchar.h
224 cppmacro.o: cppmacro.c $(CONFIG_H) $(LIBCPP_DEPS)
225 cpplib.o: cpplib.c $(CONFIG_H) $(LIBCPP_DEPS)
226 cpphash.o: cpphash.c $(CONFIG_H) $(LIBCPP_DEPS)
227 cppfiles.o: cppfiles.c $(CONFIG_H) $(LIBCPP_DEPS) $(SPLAY_TREE_H) mkdeps.h
228 cppinit.o: cppinit.c $(CONFIG_H) $(LIBCPP_DEPS) cppdefault.h \
229 mkdeps.h prefix.h output.h version.h
230 safe-ctype.o: $(LIBIBERTY_DIR)/safe-ctype.c $(LIBIBERTY_DIR)/safe-ctype.h $(CONFIG_H) $(LIBCPP_DEPS)
231 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
232 obstack.o: $(LIBIBERTY_DIR)/obstack.c $(LIBIBERTY_DIR)/obstack.h $(CONFIG_H) $(LIBCPP_DEPS)
233 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
234 splay-tree.o: $(LIBIBERTY_DIR)/splay-tree.c $(LIBIBERTY_DIR)/splay-tree.h $(CONFIG_H) $(LIBCPP_DEPS)
235 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
236 lbasename.o: $(LIBIBERTY_DIR)/lbasename.c $(CONFIG_H) $(LIBCPP_DEPS)
237 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
238 cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) cppdefault.h Makefile
239 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
240 $(PREPROCESSOR_DEFINES) \
241 -c $(srcdir)/cppdefault.c
243 mkdeps.o: mkdeps.c $(CONFIG_H) $(SYSTEM_H) mkdeps.h