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