diff options
author | ru <ru@FreeBSD.org> | 2004-02-09 14:11:58 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2004-02-09 14:11:58 +0000 |
commit | 5d659b9c9153cac8ef26ac894913d84a6772d779 (patch) | |
tree | 8ce2d80f6b9077e83a792c0cc593b1328ab46eb6 | |
parent | 951150d25a152b9b7302661fb693e51d0ffe17f1 (diff) | |
download | FreeBSD-src-5d659b9c9153cac8ef26ac894913d84a6772d779.zip FreeBSD-src-5d659b9c9153cac8ef26ac894913d84a6772d779.tar.gz |
- Factor out -nostdlib to an upper level Makefile.inc.
- Now that bsd.prog.mk deals with programs linked with -nostdlib
better, and has a notion of an "internal" program, use PROG
where possible. This has a good impact on the contents of
.depend files and causes programs to be linked with cc(1).
XXX: boot2 couldn't be converted as it's actually two programs.
Tested on: i386, amd64
-rw-r--r-- | sys/boot/i386/Makefile.inc | 1 | ||||
-rw-r--r-- | sys/boot/i386/boot0/Makefile | 11 | ||||
-rw-r--r-- | sys/boot/i386/boot2/Makefile | 2 | ||||
-rw-r--r-- | sys/boot/i386/btx/btx/Makefile | 13 | ||||
-rw-r--r-- | sys/boot/i386/btx/btxldr/Makefile | 13 | ||||
-rw-r--r-- | sys/boot/i386/btx/lib/Makefile | 12 | ||||
-rw-r--r-- | sys/boot/i386/cdboot/Makefile | 9 | ||||
-rw-r--r-- | sys/boot/i386/gptboot/Makefile | 2 | ||||
-rw-r--r-- | sys/boot/i386/kgzldr/Makefile | 17 | ||||
-rw-r--r-- | sys/boot/i386/loader/Makefile | 21 | ||||
-rw-r--r-- | sys/boot/i386/mbr/Makefile | 9 | ||||
-rw-r--r-- | sys/boot/i386/pxeldr/Makefile | 12 |
12 files changed, 64 insertions, 58 deletions
diff --git a/sys/boot/i386/Makefile.inc b/sys/boot/i386/Makefile.inc index 6bd4f31..d7e4d0d 100644 --- a/sys/boot/i386/Makefile.inc +++ b/sys/boot/i386/Makefile.inc @@ -6,6 +6,7 @@ BINDIR?= /boot LOADER_ADDRESS?=0x200000 CFLAGS+= -ffreestanding -mpreferred-stack-boundary=2 +LDFLAGS+= -nostdlib .if ${MACHINE_ARCH} == "amd64" CFLAGS+= -m32 diff --git a/sys/boot/i386/boot0/Makefile b/sys/boot/i386/boot0/Makefile index dbfdb50..b22cf4d 100644 --- a/sys/boot/i386/boot0/Makefile +++ b/sys/boot/i386/boot0/Makefile @@ -1,7 +1,11 @@ # $FreeBSD$ +PROG= ${BOOT}.out +INTERNALPROG= FILES= ${BOOT} -CLEANFILES= ${BOOT} ${BOOT}.out ${BOOT}.o +NOMAN= +SRCS= ${BOOT}.s +CLEANFILES= ${BOOT} BOOT?= boot0 @@ -30,10 +34,9 @@ AFLAGS+=--defsym FLAGS=${BOOT_BOOT0_FLAGS} \ --defsym TICKS=${BOOT_BOOT0_TICKS} \ --defsym COMSPEED=${BOOT_BOOT0_COMCONSOLE_SPEED} +LDFLAGS=-N -e start -Ttext ${BOOT_BOOT0_ORG} + ${BOOT}: ${BOOT}.out objcopy -S -O binary ${BOOT}.out ${.TARGET} -${BOOT}.out: ${BOOT}.o - ${LD} -N -e start -Ttext ${BOOT_BOOT0_ORG} -o ${.TARGET} ${BOOT}.o - .include <bsd.prog.mk> diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile index 3356a6c..273d20a 100644 --- a/sys/boot/i386/boot2/Makefile +++ b/sys/boot/i386/boot2/Makefile @@ -36,7 +36,7 @@ CFLAGS= -Os \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings -LDFLAGS=-nostdlib -static -N --gc-sections +LDFLAGS=-static -N --gc-sections # Pick up ../Makefile.inc early. .include <bsd.init.mk> diff --git a/sys/boot/i386/btx/btx/Makefile b/sys/boot/i386/btx/btx/Makefile index c2a33a6..9ed8d49 100644 --- a/sys/boot/i386/btx/btx/Makefile +++ b/sys/boot/i386/btx/btx/Makefile @@ -1,5 +1,11 @@ # $FreeBSD$ +PROG= btx.out +INTERNALPROG= +NOMAN= +SRCS= btx.s +CLEANFILES= btx + M4?= m4 .if defined(PAGING) @@ -27,14 +33,13 @@ ORG= 0x9000 all: btx -btx: btx.o - ${LD} -N -e start -Ttext ${ORG} -o btx.out btx.o +LDFLAGS=-N -e start -Ttext ${ORG} + +btx: btx.out objcopy -S -O binary btx.out ${.TARGET} btx.o: btx.s (cd ${.CURDIR}; ${M4} ${M4FLAGS} btx.s) | \ ${AS} ${AFLAGS} -o ${.TARGET} -CLEANFILES+= btx btx.out btx.o - .include <bsd.prog.mk> diff --git a/sys/boot/i386/btx/btxldr/Makefile b/sys/boot/i386/btx/btxldr/Makefile index c89af62..23008a5 100644 --- a/sys/boot/i386/btx/btxldr/Makefile +++ b/sys/boot/i386/btx/btxldr/Makefile @@ -1,5 +1,11 @@ # $FreeBSD$ +PROG= btxldr.out +INTERNALPROG= +NOMAN= +SRCS= btxldr.s +CLEANFILES= btxldr + M4?= m4 M4FLAGS+= -DLOADER_ADDRESS=${LOADER_ADDRESS} @@ -9,14 +15,13 @@ M4FLAGS+= -DBTXLDR_VERBOSE all: btxldr -btxldr: btxldr.o - ${LD} -N -e start -Ttext ${LOADER_ADDRESS} -o btxldr.out btxldr.o +LDFLAGS=-N -e start -Ttext ${LOADER_ADDRESS} + +btxldr: btxldr.out objcopy -S -O binary btxldr.out ${.TARGET} btxldr.o: btxldr.s (cd ${.CURDIR}; ${M4} ${M4FLAGS} btxldr.s ) | \ ${AS} ${AFLAGS} -o ${.TARGET} -CLEANFILES+= btxldr btxldr.out btxldr.o - .include <bsd.prog.mk> diff --git a/sys/boot/i386/btx/lib/Makefile b/sys/boot/i386/btx/lib/Makefile index fb56ca1..563f001 100644 --- a/sys/boot/i386/btx/lib/Makefile +++ b/sys/boot/i386/btx/lib/Makefile @@ -1,11 +1,9 @@ # $FreeBSD$ -OBJS= btxcsu.o btxsys.o btxv86.o -CLEANFILES= crt0.o - -all: crt0.o - -crt0.o: ${OBJS} - ${LD} ${LDFLAGS} -i -o ${.TARGET} ${OBJS} +PROG= crt0.o +INTERNALPROG= +NOMAN= +SRCS= btxcsu.s btxsys.s btxv86.s +LDFLAGS=-Wl,-r .include <bsd.prog.mk> diff --git a/sys/boot/i386/cdboot/Makefile b/sys/boot/i386/cdboot/Makefile index f82b74e..08302e4 100644 --- a/sys/boot/i386/cdboot/Makefile +++ b/sys/boot/i386/cdboot/Makefile @@ -1,7 +1,11 @@ # $FreeBSD$ +PROG= ${BOOT}.out +INTERNALPROG= FILES= ${BOOT} -CLEANFILES= ${BOOT} ${BOOT}.out ${BOOT}.o +NOMAN= +SRCS= ${BOOT}.s +CLEANFILES= ${BOOT} BOOT= cdboot ORG= 0x7c00 @@ -9,7 +13,6 @@ ORG= 0x7c00 ${BOOT}: ${BOOT}.out objcopy -S -O binary ${BOOT}.out ${.TARGET} -${BOOT}.out: ${BOOT}.o - ${LD} -N -e start -Ttext ${ORG} -o ${.TARGET} ${BOOT}.o +LDFLAGS=-N -e start -Ttext ${ORG} .include <bsd.prog.mk> diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile index 3356a6c..273d20a 100644 --- a/sys/boot/i386/gptboot/Makefile +++ b/sys/boot/i386/gptboot/Makefile @@ -36,7 +36,7 @@ CFLAGS= -Os \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings -LDFLAGS=-nostdlib -static -N --gc-sections +LDFLAGS=-static -N --gc-sections # Pick up ../Makefile.inc early. .include <bsd.init.mk> diff --git a/sys/boot/i386/kgzldr/Makefile b/sys/boot/i386/kgzldr/Makefile index 4f21e8a..f19d1ea 100644 --- a/sys/boot/i386/kgzldr/Makefile +++ b/sys/boot/i386/kgzldr/Makefile @@ -1,23 +1,18 @@ # $FreeBSD$ -FILES= kgzldr.o -FILESOWN= ${LIBOWN} -FILESGRP= ${LIBGRP} -FILESMODE= ${LIBMODE} -FILESDIR= ${LIBDIR} -CLEANFILES= kgzldr.o +PROG= kgzldr.o +BINMODE=${LIBMODE} +BINDIR= ${LIBDIR} +NOMAN= SRCS= start.s boot.c inflate.c lib.c crt.s sio.s -OBJS= ${SRCS:N*.h:R:S/$/.o/g} CFLAGS= -Os CFLAGS+=-DKZIP -LDFLAGS=-nostdlib -static -Wl,-r +NOSHARED= +LDFLAGS=-Wl,-r .PATH: ${.CURDIR}/../../../kern BOOT_COMCONSOLE_PORT?= 0x3f8 AFLAGS+=--defsym SIO_PRT=${BOOT_COMCONSOLE_PORT} -kgzldr.o: ${OBJS} - ${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} - .include <bsd.prog.mk> diff --git a/sys/boot/i386/loader/Makefile b/sys/boot/i386/loader/Makefile index da6f696..61871ed 100644 --- a/sys/boot/i386/loader/Makefile +++ b/sys/boot/i386/loader/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PROG= loader.sym +INTERNALPROG= NEWVERSWHAT= "bootstrap loader" i386 # architecture-specific loader code @@ -20,11 +22,7 @@ HAVE_ISABUS= yes # Enable BootForth BOOT_FORTH= yes CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386 -.if exists(${.OBJDIR}/../../ficl/libficl.a) LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.else -LIBFICL= ${.CURDIR}/../../ficl/libficl.a -.endif .endif .if defined(LOADER_BZIP2_SUPPORT) @@ -40,10 +38,10 @@ CFLAGS+= -DLOADER_GZIP_SUPPORT CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I. -CLEANFILES= vers.c loader loader.list loader.bin loader.sym loader.help +CLEANFILES= vers.c loader loader.list loader.bin loader.help CFLAGS+= -Wall -LDFLAGS= -nostdlib -static -Ttext 0x0 +LDFLAGS= -static -Ttext 0x0 # i386 standalone support library LIBI386= ${.OBJDIR}/../libi386/libi386.a @@ -62,7 +60,7 @@ CFLAGS+= -I${.CURDIR}/../btx/lib vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} -loader: loader.bin ${BTXLDR} ${BTXKERN} ${BTXCRT} +loader: loader.bin ${BTXLDR} ${BTXKERN} btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ -b ${BTXKERN} loader.bin # /usr/bin/kzip ${.TARGET} @@ -86,11 +84,10 @@ FILESDIR_loader.conf= /boot/defaults FILES+= ${.CURDIR}/loader.rc .endif -OBJS= ${SRCS:N*.h:R:S/$/.o/g} +DPADD= ${BTXCRT} ${LIBFICL} ${LIBI386} ${LIBSTAND} +LDADD= ${BTXCRT} ${LIBFICL} ${LIBI386} -lstand -loader.sym: ${OBJS} ${LIBFICL} ${LIBI386} ${LIBSTAND} - ${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} \ - ${LIBFICL} ${LIBI386} ${LIBSTAND} +.include <bsd.prog.mk> .if ${MACHINE_ARCH} == "amd64" beforedepend ${OBJS}: machine @@ -98,5 +95,3 @@ CLEANFILES+= machine machine: ln -sf ${.CURDIR}/../../../i386/include machine .endif - -.include <bsd.prog.mk> diff --git a/sys/boot/i386/mbr/Makefile b/sys/boot/i386/mbr/Makefile index 7a40111..2405297 100644 --- a/sys/boot/i386/mbr/Makefile +++ b/sys/boot/i386/mbr/Makefile @@ -1,7 +1,11 @@ # $FreeBSD$ +PROG= ${BOOT}.out +INTERNALPROG= FILES= ${BOOT} -CLEANFILES= ${BOOT} ${BOOT}.out ${BOOT}.o +NOMAN= +SRCS= ${BOOT}.s +CLEANFILES= ${BOOT} BOOT= mbr ORG= 0x600 @@ -9,7 +13,6 @@ ORG= 0x600 ${BOOT}: ${BOOT}.out objcopy -S -O binary ${BOOT}.out ${.TARGET} -${BOOT}.out: ${BOOT}.o - ${LD} -N -e start -Ttext ${ORG} -o ${.TARGET} ${BOOT}.o +LDFLAGS=-N -e start -Ttext ${ORG} .include <bsd.prog.mk> diff --git a/sys/boot/i386/pxeldr/Makefile b/sys/boot/i386/pxeldr/Makefile index 1f779ec..3d9228f 100644 --- a/sys/boot/i386/pxeldr/Makefile +++ b/sys/boot/i386/pxeldr/Makefile @@ -3,8 +3,11 @@ # Pick up ../Makefile.inc early. .include <bsd.init.mk> +PROG= ${LDR}.out +INTERNALPROG= FILES= ${BOOT} MAN= ${BOOT}.8 +SRCS= ${LDR}.s CLEANFILES= ${BOOT} BOOT= pxeboot @@ -21,11 +24,7 @@ M4FLAGS+= -DPROBE_KEYBOARD M4FLAGS+= -DALWAYS_SERIAL .endif -.if exists(${.OBJDIR}/../loader) LOADERBIN= ${.OBJDIR}/../loader/loader.bin -.else -LOADERBIN= ${.CURDIR}/../loader/loader.bin -.endif CLEANFILES+= ${BOOT}.tmp @@ -34,13 +33,12 @@ ${BOOT}: ${LDR} ${LOADER} dd if=${.TARGET}.tmp of=${.TARGET} obs=2k conv=osync rm ${.TARGET}.tmp -CLEANFILES+= ${LDR} ${LDR}.out ${LDR}.o +CLEANFILES+= ${LDR} ${LDR}: ${LDR}.out objcopy -S -O binary ${LDR}.out ${.TARGET} -${LDR}.out: ${LDR}.o - ${LD} -N -e start -Ttext ${ORG} -o ${.TARGET} ${LDR}.o +LDFLAGS+= -N -e start -Ttext ${ORG} ${LDR}.o: ${LDR}.s (cd ${.CURDIR}; ${M4} ${M4FLAGS} ${LDR}.s) | \ |