freebsd-dev/gnu/usr.bin/cc/cc_tools/Makefile

202 lines
5.8 KiB
Makefile
Raw Normal View History

#
1999-04-18 09:44:36 +00:00
# $Id: Makefile,v 1.27 1999/04/11 04:32:42 bde Exp $
#
#
# This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk
# is such a !@#!*#% nightmare because of how it reprograms the dependencies,
# suffix rules, SRCS, etc. It's easiest to cheat by using bsd.prog.mk and
# SRCS to get dependencies.
#
# ../Makefile.inc will put an absolute path to our objdir in CFLAGS.
# Prevent mkdep from using it, so that we don't have to give rules for
# aliases of generated headers.
#
CFLAGS+= -I.
.include "../Makefile.inc"
.PATH: ${GCCDIR} ${GCCDIR}/cp
CFLAGS+= -I${GCCDIR}/objc
#-----------------------------------------------------------------------
# insn-* gunk
.for i in attr codes config flags
insn-$i.h: gen$i ${MD_FILE}
./gen$i ${MD_FILE} > insn-$i.h
GENSRCS+= insn-$i.h
.endfor
.for i in attrtab emit extract opinit output peep recog
insn-$i.c: gen$i ${MD_FILE}
./gen$i ${MD_FILE} > insn-$i.c
GENSRCS+= insn-$i.c
.endfor
.for i in attr codes config emit extract flags opinit output peep recog
build-tools: gen$i
gen$i: gen$i.o rtl.o obstack.o bitmap.o
${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
GENSRCS+= gen$i.c
CLEANFILES+= gen$i
.endfor
.for i in attrtab
build-tools: gen$i
gen$i: gen$i.o rtl.o rtlanal.o print-rtl.o obstack.o bitmap.o
${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
GENSRCS+= gen$i.c
CLEANFILES+= gen$i
.endfor
SRCS+= bitmap.c obstack.c print-rtl.c rtl.c rtlanal.c
.for i in check genrtl
build-tools: gen$i
gen$i: gen$i.o
${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
GENSRCS+= gen$i.c
CLEANFILES+= gen$i
.endfor
.ORDER: genrtl.c genrtl.h
genrtl.c genrtl.h: gengenrtl
./gengenrtl genrtl.h genrtl.c
GENSRCS+= genrtl.c genrtl.h
#-----------------------------------------------------------------------
# C hash codes
c-gperf.h: c-parse.gperf
gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \
${GCCDIR}/c-parse.gperf > ${.TARGET}
GENSRCS+= c-gperf.h
#-----------------------------------------------------------------------
# C++ hash codes
hash.h: gxx.gperf
gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \
${GCCDIR}/cp/gxx.gperf >hash.h
GENSRCS+= hash.h
#-----------------------------------------------------------------------
# Common parser stuff.
tree-check.h: gencheck
./gencheck > ${.TARGET}
GENSRCS+= tree-check.h
#-----------------------------------------------------------------------
# C parser
.ORDER: c-parse.c c-parse.h
c-parse.c c-parse.h: c-parse.in
sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
-e "/^ifc$$/d" -e "/^end ifc$$/d" \
${GCCDIR}/c-parse.in > c-parse.y
${BISON} -d c-parse.y -o c-parse.c
rm -f c-parse.y
GENSRCS+= c-parse.c c-parse.h
CLEANFILES+= c-parse.y # insurance
#-----------------------------------------------------------------------
# objc parser
.ORDER: objc-parse.c objc-parse.h
objc-parse.c objc-parse.h: c-parse.in
sed -e "/^ifc$$/,/^end ifc$$/d" \
-e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \
${GCCDIR}/c-parse.in > objc-parse.y
${BISON} -d objc-parse.y -o objc-parse.c
rm -f objc-parse.y
GENSRCS+= objc-parse.c objc-parse.h
CLEANFILES+= objc-parse.y # insurance
#-----------------------------------------------------------------------
# C++ parser done in its own makefile
#-----------------------------------------------------------------------
# CPP parser done in its own makefile
#-----------------------------------------------------------------------
# the host/target compiler config.
COMMONHDRS= config.h hconfig.h multilib.h options.h specs.h tconfig.h tm.h
GENSRCS+= ${COMMONHDRS}
config.h hconfig.h:
echo '#include "auto-host.h"' > ${.TARGET}
echo '#include "${MACHINE_ARCH}/xm-${MACHINE_ARCH}.h"' >> ${.TARGET}
multilib.h:
echo 'static char *multilib_raw[] = { \
"aout maout;", "elf !maout;", NULL };' > ${.TARGET}
echo 'static char *multilib_matches_raw[] = { \
"maout maout;", "melf melf;", NULL };' >> ${.TARGET}
echo 'static char *multilib_extra = "";' >> ${.TARGET}
options.h:
echo '#include "cp/lang-options.h"' > ${.TARGET}
1999-04-18 09:44:36 +00:00
echo '#include "f/lang-options.h"' >> ${.TARGET}
specs.h:
echo '#include "cp/lang-specs.h"' > ${.TARGET}
1999-04-18 09:44:36 +00:00
echo '#include "f/lang-specs.h"' >> ${.TARGET}
tconfig.h:
echo '#include "${MACHINE_ARCH}/xm-${MACHINE_ARCH}.h"' > ${.TARGET}
tm.h:
echo '#include "${MACHINE_ARCH}/${MACHINE_ARCH}.h"' > ${.TARGET}
1999-04-04 20:47:33 +00:00
.if ${MACHINE_ARCH} == "i386"
echo '#include "${MACHINE_ARCH}/att.h"' >> ${.TARGET}
1999-04-04 20:47:33 +00:00
.endif
echo '#include "${MACHINE_ARCH}/freebsd.h"' >> ${.TARGET}
.if ${MACHINE_ARCH} == "i386"
echo '#include "${MACHINE_ARCH}/perform.h"' >> ${.TARGET}
.endif
First round of changes to support generation of assembler for the old a.out gas and the binutils gas (elf or a.out) with a single compiler. This uses other infrastructure not yet committed, in order to support both a.out and elf it needs to be able to get to both a.out and elf gas, ld, libs, crt* etc. So for now, the support is pretty much dormant. The new freebsd.h file is based on the old freebsd-elf.h file (which has a long lineage, right back through linux and svr4 files). The change is pretty dramatic from a gcc internals standpoint as it overrides a lot of definitions in order to generate different output based on target mode. There is potential for screw-ups, so please be on the lookout - gcc's configuration mechanism wasn't really meant for this kind of thing. It's believed to compile world etc just fine under both a.out and elf, can handle global constructors and destructors, handles the differences in a.out and elf stabs, and what sections things like exceptions go in. The initial idea came from i386/osfrose.h which is a dual rose/elf format target. These two are not as diverse as a.out and elf it would seem. The cc front-end uses external configuration to determine default object format (still being thrashed out, so read the source if you want to see it so far), and has a '-aout' and '-elf' override command line switch. There are some other internal switches that can be accessed, namely -maout, -mno-aout, -munderscores and -mnounderscores. The underscore and local symbol prefixing rules are controllable seperately to the output format. (ie: it's possible to generate a.out without the _ prefixes on symbols and also to generate elf with the _ prefixes. This isn't quite optimal, but does seem to work pretty well, except the linkers don't always recognise the local symbols without their normal names) The default format is a.out (still), nobody should see any major changes. With both elf and a.out tools and libraries installed: [1:26pm]/tmp-223> cc -elf -o hello hello.c peter@beast[1:27pm]/tmp-224> file hello hello: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked, not stripped [1:27pm]/tmp-225> ./hello hello world! [1:27pm]/tmp-226> cc -aout -o hello hello.c [1:27pm]/tmp-227> file hello hello: FreeBSD/i386 compact demand paged dynamically linked executable not stripped 1:27pm]/tmp-228> ./hello hello world! Since my co-conspirators put a lot of effort into this too, I'll add them so they can share the blame^H^H^H^H^Hglory. :-) Reviewed by: sos, jdp
1998-03-08 05:29:49 +00:00
#-----------------------------------------------------------------------
# General things.
First round of changes to support generation of assembler for the old a.out gas and the binutils gas (elf or a.out) with a single compiler. This uses other infrastructure not yet committed, in order to support both a.out and elf it needs to be able to get to both a.out and elf gas, ld, libs, crt* etc. So for now, the support is pretty much dormant. The new freebsd.h file is based on the old freebsd-elf.h file (which has a long lineage, right back through linux and svr4 files). The change is pretty dramatic from a gcc internals standpoint as it overrides a lot of definitions in order to generate different output based on target mode. There is potential for screw-ups, so please be on the lookout - gcc's configuration mechanism wasn't really meant for this kind of thing. It's believed to compile world etc just fine under both a.out and elf, can handle global constructors and destructors, handles the differences in a.out and elf stabs, and what sections things like exceptions go in. The initial idea came from i386/osfrose.h which is a dual rose/elf format target. These two are not as diverse as a.out and elf it would seem. The cc front-end uses external configuration to determine default object format (still being thrashed out, so read the source if you want to see it so far), and has a '-aout' and '-elf' override command line switch. There are some other internal switches that can be accessed, namely -maout, -mno-aout, -munderscores and -mnounderscores. The underscore and local symbol prefixing rules are controllable seperately to the output format. (ie: it's possible to generate a.out without the _ prefixes on symbols and also to generate elf with the _ prefixes. This isn't quite optimal, but does seem to work pretty well, except the linkers don't always recognise the local symbols without their normal names) The default format is a.out (still), nobody should see any major changes. With both elf and a.out tools and libraries installed: [1:26pm]/tmp-223> cc -elf -o hello hello.c peter@beast[1:27pm]/tmp-224> file hello hello: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked, not stripped [1:27pm]/tmp-225> ./hello hello world! [1:27pm]/tmp-226> cc -aout -o hello hello.c [1:27pm]/tmp-227> file hello hello: FreeBSD/i386 compact demand paged dynamically linked executable not stripped 1:27pm]/tmp-228> ./hello hello world! Since my co-conspirators put a lot of effort into this too, I'll add them so they can share the blame^H^H^H^H^Hglory. :-) Reviewed by: sos, jdp
1998-03-08 05:29:49 +00:00
SRCS+= ${GENSRCS}
CLEANFILES+= ${GENSRCS}
First round of changes to support generation of assembler for the old a.out gas and the binutils gas (elf or a.out) with a single compiler. This uses other infrastructure not yet committed, in order to support both a.out and elf it needs to be able to get to both a.out and elf gas, ld, libs, crt* etc. So for now, the support is pretty much dormant. The new freebsd.h file is based on the old freebsd-elf.h file (which has a long lineage, right back through linux and svr4 files). The change is pretty dramatic from a gcc internals standpoint as it overrides a lot of definitions in order to generate different output based on target mode. There is potential for screw-ups, so please be on the lookout - gcc's configuration mechanism wasn't really meant for this kind of thing. It's believed to compile world etc just fine under both a.out and elf, can handle global constructors and destructors, handles the differences in a.out and elf stabs, and what sections things like exceptions go in. The initial idea came from i386/osfrose.h which is a dual rose/elf format target. These two are not as diverse as a.out and elf it would seem. The cc front-end uses external configuration to determine default object format (still being thrashed out, so read the source if you want to see it so far), and has a '-aout' and '-elf' override command line switch. There are some other internal switches that can be accessed, namely -maout, -mno-aout, -munderscores and -mnounderscores. The underscore and local symbol prefixing rules are controllable seperately to the output format. (ie: it's possible to generate a.out without the _ prefixes on symbols and also to generate elf with the _ prefixes. This isn't quite optimal, but does seem to work pretty well, except the linkers don't always recognise the local symbols without their normal names) The default format is a.out (still), nobody should see any major changes. With both elf and a.out tools and libraries installed: [1:26pm]/tmp-223> cc -elf -o hello hello.c peter@beast[1:27pm]/tmp-224> file hello hello: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked, not stripped [1:27pm]/tmp-225> ./hello hello world! [1:27pm]/tmp-226> cc -aout -o hello hello.c [1:27pm]/tmp-227> file hello hello: FreeBSD/i386 compact demand paged dynamically linked executable not stripped 1:27pm]/tmp-228> ./hello hello world! Since my co-conspirators put a lot of effort into this too, I'll add them so they can share the blame^H^H^H^H^Hglory. :-) Reviewed by: sos, jdp
1998-03-08 05:29:49 +00:00
all: ${SRCS}
.include <bsd.prog.mk>
#-----------------------------------------------------------------------
# Fixups.
# Set OBJS the same as bsd.prog.mk would do if we defined PROG. We can't
# define PROG because we have multiple programs.
#
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
.if !exists(${DEPENDFILE})
# Fudge pre-dependfile dependencies of objects in much the same way as
# bsd.prog.mk would do if we defined PROG. There are complications to
# avoid circular dependencies. First, only make most objects depend on
# all headers. Filter out the objects that would cause problems (i.e.,
# objects that will be used to create programs that will generate headers).
#
${OBJS:Nbitmap.o:Ngenattr.o:Ngencheck.o:Ngencodes.o:Ngenconfig.o:Ngenflags.o:Ngengenrtl.o:Nobstack.o:Nrtl.o}: ${SRCS:M*.h}
# Next, make each of the problematic objects depend on only most headers.
# Filter out the headers that would cause problems (and a few more when it
# is inconvenient to filter precisely).
#
bitmap.o genattr.o gencodes.o genconfig.o genflags.o obstack.o rtl.o: \
${SRCS:M*.h:Ninsn-*.h}
gencheck.o: ${SRCS:M*.h:Ngenrtl.h:Ntree-check.h:Ninsn-*.h}
gengenrtl.o: ${SRCS:M*.h:Ngenrtl.h:Ninsn-*.h}
.endif