# Makefile for GNU C Preprocessor. # # hacked from gcc Makefile by kvigor. # # Copyright (C) 1987, 1988, 1990, 1991, 1992, 1993, 1994, 1995 # 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. #This file is part of GNU CC. #GNU CC is free software; you can redistribute it and/or modify #it under the terms of the GNU General Public License as published by #the Free Software Foundation; either version 2, or (at your option) #any later version. #GNU CC is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License for more details. #You should have received a copy of the GNU General Public License #along with GNU CC; see the file COPYING. If not, write to #the Free Software Foundation, 59 Temple Place - Suite 330, #Boston MA 02111-1307, USA. EXEEXT = @EXEEXT@ TARGET = ../../bin/sdcpp$(EXEEXT) VPATH = @srcdir@ # This is the default target. all: $(TARGET) # Directory where sources are, from where we are. srcdir = @srcdir@ LIBS = @LIBS@ CFLAGS = @CFLAGS@ -Wall ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) \ $(CFLAGS) $(WARN_CFLAGS) $(XCFLAGS) @DEFS@ ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS) LDFLAGS = @LDFLAGS@ AWK = @AWK@ CC = @CC@ AR = ar AR_FLAGS = rc RANLIB = @RANLIB@ SHELL = /bin/sh STRIP = @STRIP@ # on sysV, define this as cp. INSTALL = @INSTALL@ # Some systems may be missing symbolic links, regular links, or both. # Allow configure to check this and use "ln -s", "ln", or "cp" as appropriate. LN=@LN@ LN_S=@LN_S@ # These permit overriding just for certain files. INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ @SET_MAKE@ # Some compilers can't handle cc -c blah.c -o foo/blah.o. # In stage2 and beyond, we force this to "-o $@" since we know we're using gcc. OUTPUT_OPTION = @OUTPUT_OPTION@ # Some versions of `touch' (such as the version on Solaris 2.8) # do not correctly set the timestamp due to buggy versions of `utime' # in the kernel. So, we use `echo' instead. STAMP = echo timestamp > # Where to find some libiberty headers. LIBIBERTY_DIR = $(srcdir)/libiberty LIBCPP_DIR = $(srcdir)/libcpp OBSTACK_H = $(LIBIBERTY_DIR)/obstack.h SPLAY_TREE_H= $(LIBIBERTY_DIR)/splay-tree.h # Test to see whether exists in the system header files. LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ] # Common prefix for installation directories. # NOTE: This directory must exist when you start installation. prefix = @prefix@ # Directory in which to put localized header files. On the systems with # gcc as the native cc, `local_prefix' may not be `prefix' which is # `/usr'. # NOTE: local_prefix *should not* default from prefix. local_prefix = @local_prefix@ # Directory in which to put host dependent programs and libraries exec_prefix = @exec_prefix@ # Directory in which to put the executable for the command `gcc' bindir = @bindir@ includedir = $(local_prefix)/include # where the info files go exeext = @host_exeext@ transform = @program_transform_name@ lang_opt_files=$(srcdir)/sdcpp.opt # All option source files ALL_OPT_FILES=$(lang_opt_files) $(extra_opt_files) # Top build directory, relative to here. top_builddir = @top_builddir@ # Whether we were configured with NLS. USE_NLS = @USE_NLS@ # Internationalization library. INTLLIBS = @INTLLIBS@ # Change this to a null string if obstacks are installed in the # system library. OBSTACK=obstack.o # End of variables for you to override. install: all mkdir -p $(DESTDIR)$(bindir) $(INSTALL) $(TARGET) `echo $(DESTDIR)$(bindir)/sdcpp$(EXEEXT)|sed '$(transform)'` $(STRIP) `echo $(DESTDIR)$(bindir)/sdcpp$(EXEEXT)|sed '$(transform)'` uninstall: rm -f $(DESTDIR)$(bindir)/sdcpp$(EXEEXT) clean: -rm -f $(TARGET) *.o core libcpp.a rm -f s-options optionlist options.h s-options-h options.c distclean: clean -rm -f auto-host.h auto-build.h cstamp-h Makefile config.status config.run config.cache config.bak config.log *~ # This tells GNU Make version 3 not to put all variables in the environment. .NOEXPORT: # GCONFIG_H lists the config files that the generator files depend on, while # CONFIG_H lists the the ones ordinary gcc files depend on, which includes # a file generated by gencodes. CONFIG_H = config.h SYSTEM_H = system.h hwint.h # sed inserts variable overrides after the following line. ####target overrides #@target_overrides@ ####host overrides #@host_overrides@ ####cross overrides #@cross_defines@ #@cross_overrides@ ####build overrides #@build_overrides@ # INCLUDES = -I$(srcdir) -I$(LIBCPP_DIR) -I$(LIBCPP_DIR)/include -I$(LIBIBERTY_DIR) -I. # Always use -I$(srcdir)/config when compiling. .c.o: $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) # cstamp-h.in controls rebuilding of config.in. # It is named cstamp-h.in and not stamp-h.in so the mostlyclean rule doesn't # delete it. A stamp file is needed as autoheader won't update the file if # nothing has changed. # It remains in the source directory and is part of the distribution. # This follows what is done in shellutils, fileutils, etc. # "echo timestamp" is used instead of touch to be consistent with other # packages that use autoconf (??? perhaps also to avoid problems with patch?). # ??? Newer versions have a maintainer mode that may be useful here. $(srcdir)/config.in: $(srcdir)/cstamp-h.in $(srcdir)/acconfig.h $(srcdir)/cstamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h (cd $(srcdir) && autoheader) @rm -f $(srcdir)/cstamp-h.in echo timestamp > $(srcdir)/cstamp-h.in auto-host.h: cstamp-h ; @true cstamp-h: config.in config.status CONFIG_HEADERS=auto-host.h:config.in LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status # Really, really stupid make features, such as SUN's KEEP_STATE, may force # a target to build even if it is up-to-date. So we must verify that # config.status does not exist before failing. config.status: $(srcdir)/configure version.c @if [ ! -f config.status ] ; then \ echo You must configure gcc. Look at http://gcc.gnu.org/install/ for details.; \ false; \ else \ LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status --recheck; \ fi optionlist: s-options ; @true s-options: $(ALL_OPT_FILES) Makefile $(srcdir)/opt-gather.awk $(AWK) -f $(srcdir)/opt-gather.awk $(ALL_OPT_FILES) > tmp-optionlist $(SHELL) $(srcdir)/move-if-change tmp-optionlist optionlist $(STAMP) s-options options.c: optionlist $(srcdir)/opt-functions.awk $(srcdir)/optc-gen.awk $(AWK) -f $(srcdir)/opt-functions.awk -f $(srcdir)/optc-gen.awk \ -v header_name="config.h system.h options.h" < $< > $@ options.h: s-options-h ; @true s-options-h: optionlist $(srcdir)/opt-functions.awk $(srcdir)/opth-gen.awk $(AWK) -f $(srcdir)/opt-functions.awk -f $(srcdir)/opth-gen.awk \ < $< > tmp-options.h $(SHELL) $(srcdir)/move-if-change tmp-options.h options.h $(STAMP) $@ # # Remake cpp and protoize. PREPROCESSOR_DEFINES = \ -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \ -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \ -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_alias)\" \ -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \ -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \ -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \ -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" ########################## # Libcpp LIBCPP_OBJS = charset.o directives.o errors.o expr.o files.o identifiers.o \ init.o lex.o line-map.o macro.o mkdeps.o symtab.o traditional.o ##LIBCPP_DEPS = cpplib.h cpphash.h hashtable.h intl.h options.h $(OBSTACK_H) $(SYSTEM_H) # Most of the other archives built/used by this makefile are for # targets. This one is strictly for the host. libcpp.a: $(LIBCPP_OBJS) -rm -rf libcpp.a $(AR) $(AR_FLAGS) libcpp.a $(LIBCPP_OBJS) -$(RANLIB) libcpp.a charset.o: $(LIBCPP_DIR)/charset.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) directives.o: $(LIBCPP_DIR)/directives.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) errors.o: $(LIBCPP_DIR)/errors.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) expr.o: $(LIBCPP_DIR)/expr.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) files.o: $(LIBCPP_DIR)/files.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) identifiers.o: $(LIBCPP_DIR)/identifiers.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) init.o: $(LIBCPP_DIR)/init.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) lex.o: $(LIBCPP_DIR)/lex.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) line-map.o: $(LIBCPP_DIR)/line-map.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) macro.o: $(LIBCPP_DIR)/macro.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) mkdeps.o: $(LIBCPP_DIR)/mkdeps.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) symtab.o: $(LIBCPP_DIR)/symtab.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) traditional.o: $(LIBCPP_DIR)/traditional.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) ########################## # Libiberty MY_LIBIBERTY_BITS = concat.o fopen_unlocked.o getpwd.o hashtab.o hex.o \ lbasename.o md5.o obstack.o safe-ctype.o splay-tree.o \ vasprintf.o xexit.o xmalloc.o xmemdup.o xstrdup.o \ xstrerror.o concat.o: $(LIBIBERTY_DIR)/concat.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) fopen_unlocked.o: $(LIBIBERTY_DIR)/fopen_unlocked.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) getpwd.o: $(LIBIBERTY_DIR)/getpwd.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) hashtab.o: $(LIBIBERTY_DIR)/hashtab.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) hex.o: $(LIBIBERTY_DIR)/hex.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) lbasename.o: $(LIBIBERTY_DIR)/lbasename.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) md5.o: $(LIBIBERTY_DIR)/md5.c $(LIBIBERTY_DIR)/obstack.h $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) obstack.o: $(LIBIBERTY_DIR)/obstack.c $(LIBIBERTY_DIR)/obstack.h $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) safe-ctype.o: $(LIBIBERTY_DIR)/safe-ctype.c $(LIBIBERTY_DIR)/safe-ctype.h $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) splay-tree.o: $(LIBIBERTY_DIR)/splay-tree.c $(LIBIBERTY_DIR)/splay-tree.h $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) vasprintf.o: $(LIBIBERTY_DIR)/vasprintf.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) xexit.o: $(LIBIBERTY_DIR)/xexit.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) xmalloc.o: $(LIBIBERTY_DIR)/xmalloc.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) xmemdup.o: $(LIBIBERTY_DIR)/xmemdup.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) xstrdup.o: $(LIBIBERTY_DIR)/xstrdup.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) xstrerror.o: $(LIBIBERTY_DIR)/xstrerror.c $(CONFIG_H) $(LIBCPP_DEPS) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) ########################## # Sdcpp SDCC_OBJS = sdcpp.o sdcpp-opts.o c-ppoutput.o cppdefault.o prefix.o version.o opts.o opts-common.o options.o c-incpath.o $(TARGET): $(SDCC_OBJS) $(MY_LIBIBERTY_BITS) libcpp.a $(LIBDEPS) mkdir -p $(dir $@) $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(SDCC_OBJS) \ $(MY_LIBIBERTY_BITS) libcpp.a $(LIBS) sdcpp.o: sdcpp.c $(CONFIG_H) $(SYSTEM_H) options.h sdcpp-opts.o: sdcpp-opts.c $(CONFIG_H) $(LIBCPP_DEPS) options.h c-ppoutput.o: c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) options.o: options.c $(CONFIG_H) $(LIBCPP_DEPS) options.h opts.o: opts.c $(CONFIG_H) $(LIBCPP_DEPS) options.h opts-common.o: opts.c $(CONFIG_H) $(LIBCPP_DEPS) options.h c-incpath.o: $(CONFIG_H) $(LIBCPP_DEPS) c-incpath.h version.o: version.c version.h cppcharset.o: cppcharset.c $(CONFIG_H) $(SYSTEM_H) prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) Makefile prefix.h $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ -DPREFIX=\"$(prefix)\" \ -c $(srcdir)/prefix.c cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) cppdefault.h Makefile $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(PREPROCESSOR_DEFINES) \ -c $(srcdir)/cppdefault.c