File:  [DragonFly] / src / gnu / usr.bin / cc3 / cc_tools / Attic / Makefile
Revision 1.4: download - view: text, annotated - select for diffs
Mon Feb 2 23:35:10 2004 UTC (10 years, 6 months ago) by dillon
Branches: MAIN
CVS tags: HEAD
Update the GCC3 infrastructure Stage 1/2.  This commit generates the basic
infrastructure needed to support /usr/src/contrib/gcc-3.3 (a pristine gcc
dist) intead of /usr/src/contrib/gcc3 (munged version taken from FreeBSD-5).

This stage does not have all the fbsd/dfly specific extensions, such as
-fformat-extensions.

    1: # $FreeBSD: src/gnu/usr.bin/cc/cc_tools/Makefile,v 1.73 2004/01/15 10:07:59 ru Exp $
    2: # $DragonFly: src/gnu/usr.bin/cc3/cc_tools/Makefile,v 1.4 2004/02/02 23:35:10 dillon Exp $
    3: 
    4: #
    5: # This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk
    6: # is such a !@#!*#% nightmare because of how it reprograms the dependencies,
    7: # suffix rules, SRCS, etc.  It's easiest to cheat by using bsd.prog.mk and
    8: # SRCS to get dependencies.
    9: #
   10: 
   11: # ../Makefile.inc will put an absolute path to our objdir in CFLAGS.
   12: # Prevent mkdep from using it, so that we don't have to give rules for
   13: # aliases of generated headers.
   14: 
   15: CFLAGS+=	-I. -I${.CURDIR}/../config 
   16: CFLAGS+=	-static -DGENERATOR_FILE
   17: 
   18: .include "../Makefile.inc"
   19: 
   20: .PATH: ${GCCDIR} ${GCCDIR}/gcc ${GCCDIR}/libiberty
   21: 
   22: #-----------------------------------------------------------------------
   23: # insn-* gunk
   24: 
   25: .for F in attr codes config flags constants
   26: insn-$F.h: gen$F ${MD_FILE}
   27: 	./gen$F ${MD_FILE} > insn-$F.h
   28: GENSRCS+=	insn-$F.h
   29: .endfor
   30: 
   31: .for F in conditions
   32: insn-$F.c: gen$F ${MD_FILE}
   33: 	./gen$F ${MD_FILE} > insn-$F.c
   34: GENSRCS+=	insn-$F.c
   35: .endfor
   36: 
   37: GENSRCS+=	gen-time-stamp
   38: gen-time-stamp: genattr genattrtab genconditions genconstants genemit \
   39: 		genextract gengtype genopinit genoutput genpeep genrecog
   40: 	touch ${.TARGET}
   41: 
   42: .for F in attr codes config emit extract flags opinit output peep recog
   43: build-tools: gen$F
   44: 
   45: gen$F: gen$F.o rtl.o obstack.o print-rtl.o bitmap.o errors.o gensupport.o \
   46: 	ggc-none.o hashtab.o read-rtl.o concat.o insn-conditions.o
   47: 	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
   48: 
   49: GENSRCS+=	gen$F.c
   50: CLEANFILES+=	gen$F
   51: .endfor
   52: 
   53: #
   54: # genattrtab needs more complex build rule
   55: #
   56: build-tools: genattrtab
   57: 
   58: genattrtab : genattrtab.o rtl.o obstack.o print-rtl.o bitmap.o errors.o \
   59: 	gensupport.o ggc-none.o hashtab.o read-rtl.o concat.o \
   60: 	insn-conditions.o genautomata.o varray.o getruntime.o
   61: 	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} -lm
   62: 
   63: GENSRCS+=	genattrtab.c
   64: CLEANFILES+=	genattrtab
   65: 
   66: #
   67: # genconstants and genconditions cannot depend on insn-conditions.o
   68: # they should be liked with dummy-conditions.o stubs instead
   69: #
   70: .for F in constants conditions
   71: build-tools: gen$F
   72: 
   73: gen$F: gen$F.o rtl.o obstack.o bitmap.o errors.o gensupport.o \
   74:        ggc-none.o hashtab.o read-rtl.o concat.o dummy-conditions.o
   75: 	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
   76: 
   77: GENSRCS+=	gen$F.c
   78: CLEANFILES+=	gen$F
   79: .endfor
   80: 
   81: .for F in check genrtl preds
   82: build-tools: gen$F
   83: 
   84: gen$F: gen$F.o
   85: 	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
   86: 
   87: GENSRCS+=	gen$F.c
   88: CLEANFILES+=	gen$F
   89: .endfor
   90: 
   91: .ORDER: genrtl.c genrtl.h
   92: genrtl.c genrtl.h: gengenrtl
   93: 	./gengenrtl > genrtl.c
   94: 	./gengenrtl -h > genrtl.h
   95: 
   96: GENSRCS+=	genrtl.c genrtl.h
   97: 
   98: SRCS+=	bitmap.c concat.c dummy-conditions.c errors.c genautomata.c \
   99: 	gensupport.c getruntime.c ggc-none.c hashtab.c \
  100: 	obstack.c physmem.c print-rtl.c read-rtl.c rtl.c varray.c xmemdup.c
  101: 
  102: #-----------------------------------------------------------------------
  103: # Common parser stuff.
  104: 
  105: tree-check.h: gencheck
  106: 	./gencheck > ${.TARGET}
  107: GENSRCS+=	tree-check.h
  108: 
  109: #-----------------------------------------------------------------------
  110: # Predicates stuff.
  111: 
  112: tm-preds.h: genpreds
  113: 	./genpreds > ${.TARGET}
  114: GENSRCS+=	tm-preds.h
  115: 
  116: #-----------------------------------------------------------------------
  117: # Gengtype 
  118: 
  119: gengtype-lex.c : gengtype-lex.l
  120: 	${LEX} -t  ${.ALLSRC} | \
  121: 	sed 's/^\(char msg\[\];\)/yyconst \1/' > ${.TARGET}
  122: 
  123: .ORDER: gengtype-yacc.c gengtype-yacc.h
  124: gengtype-yacc.c gengtype-yacc.h: gengtype-yacc.y
  125: 	${YACC} -d -o gengtype-yacc.c ${.ALLSRC}
  126: 
  127: GENSRCS+=	gengtype-yacc+%DIKED.c gengtype-yacc.h gengtype-lex.c
  128: CLEANFILES+=	gengtype-yacc.c
  129: 
  130: gengtype-yacc+%DIKED.c: gengtype-yacc.c
  131: 	cat    ${.ALLSRC} > ${.TARGET}
  132: 	sed -e "s/xmalloc/malloc/g" \
  133: 	    -e "s/xrealloc/realloc/g" \
  134: 	    -e "s/malloc/xmalloc/g" \
  135: 	    -e "s/realloc/xrealloc/g" \
  136: 	    ${.ALLSRC} > ${.TARGET}
  137: 
  138: gengtype: gengtype.o gengtype-yacc+%DIKED.o gengtype-lex.o xmemdup.o
  139: 	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
  140: 
  141: GENSRCS+=	gengtype.c
  142: CLEANFILES+=	gengtype
  143: 
  144: gengtype-lex.o: gengtype-yacc.h
  145: 
  146: .ORDER: gtype-desc.c gtype-desc.h
  147: gtype-desc.c gtype-desc.h: gtype-time-stamp
  148: 	@true
  149: 
  150: GENSRCS+=	gtype-time-stamp
  151: gtype-time-stamp: gengtype ${GTFILES}
  152: 	./gengtype
  153: 	touch ${.TARGET}
  154: 
  155: GENSRCS+=	gtype-desc.c gtype-desc.h
  156: CLEANFILES+=	gt-*.h gtype-*.h
  157: 
  158: #-----------------------------------------------------------------------
  159: # Determine content of variables used by the target/host config files
  160: 
  161: #
  162: # The list of headers to go into tconfig.h
  163: #
  164: TARGET_INC=	ansidecl.h
  165: TARGET_INC+=	${GCC_CPU}/${GCC_CPU}.h
  166: .if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "amd64"
  167: TARGET_INC+=	${GCC_CPU}/unix.h
  168: TARGET_INC+=	${GCC_CPU}/att.h
  169: .endif
  170: .if ${TARGET_ARCH} != "alpha"
  171: TARGET_INC+=	dbxelf.h
  172: TARGET_INC+=	elfos.h
  173: .endif
  174: TARGET_INC+=	dragonfly-native.h
  175: TARGET_INC+=	dragonfly-spec.h
  176: TARGET_INC+=	dragonfly.h
  177: .if ${TARGET_ARCH} == "alpha"
  178: TARGET_INC+=	${GCC_CPU}/elf.h
  179: .endif
  180: .if ${TARGET_ARCH} != "i386" && ${TARGET_ARCH} != "amd64"
  181: .if exists(${GCCDIR}/config/${GCC_CPU}/sysv4.h)
  182: TARGET_INC+=	${GCC_CPU}/sysv4.h
  183: .endif
  184: .endif
  185: TARGET_INC+=	${GCC_CPU}/dragonfly.h
  186: .if ${TARGET_ARCH} == "amd64"
  187: TARGET_INC+=	${GCC_CPU}/x86-64.h
  188: TARGET_INC+=	${GCC_CPU}/dragonfly64.h
  189: .endif
  190: TARGET_INC+=	defaults.h
  191: 
  192: #
  193: # Use TARGET_INC as a template and build a list of target specific
  194: # include files for gengtype to scan
  195: #
  196: GCONFIG_H=	${.OBJDIR}/tconfig.h ${.CURDIR}/auto-host.h
  197: 
  198: .for H in ${TARGET_INC}
  199: .for D in ${GCCDIR}/config ${GCCDIR} ${.CURDIR}
  200: .if exists($D/$H)
  201: GCONFIG_H+=	$D/$H
  202: .endif
  203: .endfor
  204: .endfor
  205: 
  206: #
  207: # Define some variables to make blocks copied from Makefile.in happy
  208: #
  209: srcdir=		${GCCDIR}/gcc
  210: out_file=	${GCCDIR}/gcc/config/${GCC_CPU}/${GCC_CPU}.c
  211: GTFILES_SRCDIR=	${GCCDIR}/gcc
  212: 
  213: #
  214: # Copied unchanged from gcc/Makefile.in
  215: #
  216: GTFILES = $(GCONFIG_H) $(srcdir)/location.h \
  217:   $(GCCDIR)/include/hashtab.h \
  218:   $(srcdir)/bitmap.h $(srcdir)/function.h \
  219:   $(srcdir)/rtl.h $(srcdir)/optabs.h \
  220:   $(srcdir)/tree.h $(srcdir)/libfuncs.h \
  221:   $(srcdir)/hashtable.h $(srcdir)/real.h \
  222:   $(srcdir)/varray.h $(srcdir)/ssa.h $(srcdir)/insn-addr.h \
  223:   $(srcdir)/cselib.h \
  224:   $(srcdir)/c-common.h $(srcdir)/c-tree.h \
  225:   $(srcdir)/basic-block.h \
  226:   $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c \
  227:   $(srcdir)/dwarf2out.c $(srcdir)/emit-rtl.c \
  228:   $(srcdir)/except.c $(srcdir)/explow.c $(srcdir)/expr.c \
  229:   $(srcdir)/fold-const.c $(srcdir)/function.c \
  230:   $(srcdir)/gcse.c $(srcdir)/integrate.c $(srcdir)/lists.c \
  231:   $(srcdir)/optabs.c \
  232:   $(srcdir)/profile.c $(srcdir)/ra-build.c $(srcdir)/regclass.c \
  233:   $(srcdir)/reg-stack.c \
  234:   $(srcdir)/sdbout.c $(srcdir)/stmt.c $(srcdir)/stor-layout.c \
  235:   $(srcdir)/tree.c $(srcdir)/varasm.c \
  236:   $(out_file)
  237: 
  238: #
  239: # Build a list of frontend directories to look into
  240: #
  241: # These paths are very sensitive and used in the gengtype program.
  242: #
  243: GTFILES_LANG_DIR_NAMES=
  244: 
  245: .if !defined(NO_CXX)
  246: GTFILES_LANG_DIR_NAMES+=	cp
  247: .endif
  248: 
  249: .if !defined(NO_OBJC)
  250: GTFILES_LANG_DIR_NAMES+=	objc
  251: .endif
  252: 
  253: .if !defined(NO_FORTRAN)
  254: GTFILES_LANG_DIR_NAMES+=	f
  255: .endif
  256: 
  257: #
  258: # Build a list of language specific files for gengtype
  259: #
  260: .for L in ${GTFILES_LANG_DIR_NAMES} c
  261: .if exists(${GCCDIR}/gcc/$L-config-lang.in)
  262: # Source the language config file
  263: $L_GTFILES!=	sh -c '. ${GCCDIR}/gcc/$L-config-lang.in; echo $$gtfiles'
  264: .else
  265: $L_GTFILES!=	sh -c '. ${GCCDIR}/gcc/$L/config-lang.in; echo $$gtfiles'
  266: .endif
  267: GTFILES+=	${$L_GTFILES}
  268: .for F in ${$L_GTFILES}
  269: GTFILES_FILES+=	$F
  270: GTFILES_LANGS+= $L
  271: .endfor
  272: .endfor
  273: 
  274: #-----------------------------------------------------------------------
  275: # the host/target compiler config.
  276: 
  277: COMMONHDRS=	config.h hconfig.h multilib.h options.h specs.h tconfig.h \
  278: 		tm_p.h configargs.h safe-ctype.h
  279: GENSRCS+=	${COMMONHDRS} gencheck.h gtyp-gen.h
  280: 
  281: MFILE?=	${.CURDIR}/Makefile
  282: ${COMMONHDRS}: ${MFILE}
  283: 
  284: configargs.h:
  285: 	echo 'static const char configuration_arguments[] ='	> ${.TARGET}
  286: 	echo '	"DragonFly/${TARGET_ARCH} system compiler";'	>> ${.TARGET}
  287: 	echo 'static const char thread_model[] = "posix";'	>> ${.TARGET}
  288: 
  289: hconfig.h:
  290: 	echo '#include "auto-host.h"'			> ${.TARGET}
  291: 	echo '#include <tconfig.h>'			>> ${.TARGET}
  292: 
  293: gencheck.h:
  294: 	echo '#include "cp/cp-tree.def"'		> ${.TARGET}
  295: 	echo '#include "objc/objc-tree.def"'		>> ${.TARGET}
  296: 
  297: multilib.h:
  298: 	echo 'static const char *const multilib_raw[] = { \
  299: 	    "aout maout;", "elf !maout;", NULL };'	> ${.TARGET}
  300: 	echo 'static const char *const multilib_matches_raw[] = { \
  301: 	    "maout maout;", "melf melf;", NULL };'	>> ${.TARGET}
  302: 	echo 'static const char *multilib_extra = "";'	>> ${.TARGET}
  303: 	echo 'static const char *multilib_options = "";'>> ${.TARGET}
  304: 	echo 'static const char *const multilib_exclusions_raw[] = { \
  305: 	    NULL };'					>> ${.TARGET}
  306: 
  307: options.h:
  308: 	echo '#include "cp/lang-options.h"'		> ${.TARGET}
  309: 	echo '#include "f/lang-options.h"'		>> ${.TARGET}
  310: 	echo '#include "objc/lang-options.h"'		>> ${.TARGET}
  311: 
  312: specs.h:
  313: 	echo '#include "cp/lang-specs.h"'		> ${.TARGET}
  314: 	echo '#include "f/lang-specs.h"'		>> ${.TARGET}
  315: 	echo '#include "objc/lang-specs.h"'		>> ${.TARGET}
  316: 
  317: config.h:
  318: 	echo '#include <hconfig.h>'			> ${.TARGET}
  319: 	echo '#ifndef GENERATOR_FILE'			>> ${.TARGET}
  320: 	echo '#include "insn-constants.h"'		>> ${.TARGET}
  321: 	echo '#include "insn-flags.h"'			>> ${.TARGET}
  322: 	echo '#endif'					>> ${.TARGET}
  323: 
  324: tconfig.h:
  325: 	echo 'struct rtx_def;'				> ${.TARGET}
  326: 	echo 'typedef struct rtx_def *rtx;'		>> ${.TARGET}
  327: 	echo 'struct rtvec_def;'			>> ${.TARGET}
  328: 	echo 'typedef struct rtvec_def *rtvec;'		>> ${.TARGET}
  329: 	echo 'union tree_node;'				>> ${.TARGET}
  330: 	echo 'typedef union tree_node *tree;'		>> ${.TARGET}
  331: 	echo '#ifndef GTY'				>> ${.TARGET}
  332: 	echo '# define GTY(x)'				>> ${.TARGET}
  333: 	echo '#endif'					>> ${.TARGET}
  334: 	echo ''						>> ${.TARGET}
  335: .if ${TARGET_ARCH} == "amd64"
  336: 	echo '#include "i386/biarch64.h"'		>> ${.TARGET}
  337: .endif
  338: .if ${TARGET_ARCH} == "ia64"
  339: 	echo '#define TARGET_CPU_DEFAULT (MASK_GNU_AS|MASK_GNU_LD)' >>${.TARGET}
  340: .endif
  341: .for H in ${TARGET_INC}
  342: 	echo '#include "$H"'				>> ${.TARGET}
  343: .endfor
  344: 	echo '#ifndef POSIX'				>> ${.TARGET}
  345: 	echo '# define POSIX'				>> ${.TARGET}
  346: 	echo '#endif'					>> ${.TARGET}
  347: .if exists(${GCCDIR}/gcc/config/${GCC_CPU}/${GCC_CPU}-modes.def)
  348: 	echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
  349: 	echo '#define EXTRA_CC_MODES 1'			>> ${.TARGET}
  350: .endif
  351: 
  352: tm_p.h:
  353: 	echo '#include "${GCC_CPU}/${GCC_CPU}-protos.h"'	>> ${.TARGET}
  354: 	echo '#include "tm-preds.h"'				>> ${.TARGET}
  355: 
  356: safe-ctype.h: Makefile
  357: 	echo '#include <ctype.h>'				> ${.TARGET}
  358: .for Z in TOUPPER TOLOWER ISDIGIT ISXDIGIT ISUPPER ISLOWER ISALPHA ISALNUM \
  359:     ISSPACE ISPUNCT ISGRAPH ISBLANK ISPRINT ISCNTRL
  360: 	echo '#define ${Z}	${Z:L}'				>> ${.TARGET}
  361: .endfor
  362: 	echo "#define ISIDST(x)		\
  363: 		((x) == '_' || isalpha(x))"			>> ${.TARGET}
  364: 	echo "#define ISIDNUM(x)	\
  365: 		(isdigit(x) || ISIDST(x))"			>> ${.TARGET}
  366: 	echo "#define IS_VSPACE(x)	\
  367: 		((x) == '\n' || (x) == '\r')"			>> ${.TARGET}
  368: 	echo "#define IS_NVSPACE(x)	\
  369: 		(!IS_VSPACE(x) && (isspace(x) || (x) == '\0'))"	>> ${.TARGET}
  370: 	echo "#define IS_SPACE_OR_NUL(x)	\
  371: 		(isspace(x) || (x) == '\0')"			>> ${.TARGET}
  372: 
  373: gtyp-gen.h:
  374: 	echo "/* This file is machine generated.  Do not edit.  */" > ${.TARGET}
  375: 	echo "static const char *srcdir = "			>> ${.TARGET}
  376: 	echo "\"$(GTFILES_SRCDIR)\";"				>> ${.TARGET}
  377: 	echo "static const char *lang_files[] = {"		>> ${.TARGET}
  378: .for F in ${GTFILES_FILES}
  379: 	echo "\"$F\", "						>> ${.TARGET}
  380: .endfor
  381: 	echo "NULL};"						>> ${.TARGET}
  382: 	echo "static const char *langs_for_lang_files[] = {"	>> ${.TARGET}
  383: .for F in ${GTFILES_LANGS}
  384: 	echo "\"$F\", "						>> ${.TARGET}
  385: .endfor
  386: 	echo "NULL};"						>> ${.TARGET}
  387: 	echo "static const char *all_files[] = {"		>> ${.TARGET}
  388: .for F in ${GTFILES}
  389: 	echo "\"$F\", "						>> ${.TARGET}
  390: .endfor
  391: 	echo "NULL};"						>> ${.TARGET}
  392: 	echo "static const char *lang_dir_names[] = { \"c\", "	>> ${.TARGET}
  393: .for F in ${GTFILES_LANG_DIR_NAMES}
  394: 	echo "\"$F\", "						>> ${.TARGET}
  395: .endfor
  396: 	echo "NULL};"						>> ${.TARGET}
  397: 	echo "#define	xexit exit"				>> ${.TARGET}
  398: 
  399: 
  400: #-----------------------------------------------------------------------
  401: # General things.
  402: 
  403: SRCS+=		${GENSRCS}
  404: CLEANFILES+=	${GENSRCS}
  405: 
  406: all: ${SRCS}
  407: 
  408: .include <bsd.prog.mk>
  409: 
  410: #-----------------------------------------------------------------------
  411: # Fixups.
  412: 
  413: # Set OBJS the same as bsd.prog.mk would do if we defined PROG.  We can't
  414: # define PROG because we have multiple programs.
  415: #
  416: OBJS+=		${SRCS:N*.h:R:S/$/.o/g}
  417: CLEANFILES+=	${OBJS}
  418: 
  419: .if !exists(${DEPENDFILE})
  420: # Fudge pre-dependfile dependencies of objects in much the same way as
  421: # bsd.prog.mk would do if we defined PROG.  There are complications to
  422: # avoid circular dependencies.  First, only make most objects depend on
  423: # all headers.  Filter out the objects that would cause problems (i.e.,
  424: # objects that will be used to create programs that will generate headers).
  425: #
  426: ${OBJS}: ${SRCS:M*.h:Ngtype-desc.h:Ngenrtl.h:Ntree-check.h:Ntm-preds.h:Ninsn-*.h}
  427: 
  428: ${OBJS:Ngencheck.o:Ngengenrtl.o:Ngenpreds.o}: tree-check.h tm-preds.h genrtl.h
  429: 
  430: ${OBJS:Ngengtype*.o:Nxmemdup.o:Ngengenrtl.o:Ngencheck.o:Ngenpreds.o}: gtype-desc.h
  431: 
  432: genextract.o: insn-config.h
  433: 
  434: insn-conditions.o: insn-constants.h
  435: 
  436: .endif