diff options
| author | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
|---|---|---|
| committer | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
| commit | 268a53de823a6750d6256ee1fb1e7707b4b45740 (patch) | |
| tree | 42c1799a9a82b2f7d9790ee9fe181d72a7274751 /support/cpp/Makefile | |
| download | sdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz | |
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'support/cpp/Makefile')
| -rw-r--r-- | support/cpp/Makefile | 323 |
1 files changed, 323 insertions, 0 deletions
diff --git a/support/cpp/Makefile b/support/cpp/Makefile new file mode 100644 index 0000000..132789e --- /dev/null +++ b/support/cpp/Makefile @@ -0,0 +1,323 @@ +# 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 = +TARGET = ../../bin/sdcpp$(EXEEXT) + + + +# This is the default target. +all: $(TARGET) + +# Directory where sources are, from where we are. +srcdir = . + + + +LIBS = +CFLAGS = -g -O2 -Wall +ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) \ + $(CFLAGS) $(WARN_CFLAGS) $(XCFLAGS) -DHAVE_CONFIG_H +ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS) +LDFLAGS = + +AWK = gawk +CC = gcc +AR = ar +AR_FLAGS = rc +RANLIB = ranlib +SHELL = /bin/sh +STRIP = strip +# on sysV, define this as cp. +INSTALL = /usr/bin/install -c +# 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} +INSTALL_DATA = ${INSTALL} -m 644 + +# 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 = -o $@ + +# 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)/../sdbinutils/include +LIBCPP_DIR = $(srcdir)/libcpp +OBSTACK_H = $(LIBIBERTY_DIR)/obstack.h +SPLAY_TREE_H= $(LIBIBERTY_DIR)/splay-tree.h + +# Test to see whether <limits.h> 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 = /usr/local +# 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 = /usr/local +# Directory in which to put host dependent programs and libraries +exec_prefix = ${prefix} +# Directory in which to put the executable for the command `gcc' +bindir = ${exec_prefix}/bin +includedir = $(local_prefix)/include +# where the info files go +exeext = + +transform = s,x,x, +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 = . + +# 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) $(DESTDIR)$(bindir)/`echo sdcpp|sed '$(transform)'`$(EXEEXT) + $(STRIP) $(DESTDIR)$(bindir)/`echo sdcpp|sed '$(transform)'`$(EXEEXT) + +uninstall: + rm -f $(DESTDIR)$(bindir)/`echo sdcpp|sed '$(transform)'`$(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 *~ \ + configargs.h + +# 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) $(INCLUDES) $(ALL_CPPFLAGS) $< $(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 + +LIBIBERTY = ../sdbinutils/libiberty/libiberty.a + +$(LIBIBERTY): + cd ../sdbinutils/libiberty/ && if [ -e Makefile ]; then $(MAKE); else ./configure && $(MAKE); fi + +########################## +# Sdcpp + +SDCC_OBJS = sdcpp.o sdcpp-opts.o sdcpp-diagnostic.o c-ppoutput.o cppdefault.o prefix.o version.o opts.o opts-common.o options.o c-incpath.o + +$(TARGET): $(SDCC_OBJS) $(LIBIBERTY) libcpp.a $(LIBDEPS) + mkdir -p $(dir $@) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(SDCC_OBJS) \ + libcpp.a $(LIBIBERTY) $(LIBS) + +sdcpp.o: sdcpp.c $(CONFIG_H) $(SYSTEM_H) options.h + +sdcpp-opts.o: sdcpp-opts.c $(CONFIG_H) $(LIBCPP_DEPS) options.h + +sdcpp-diagnostic.o: sdcpp-diagnostic.c $(CONFIG_H) $(LIBCPP_DEPS) + +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 |
