summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2003-06-26 03:51:57 +0000
committerpeter <peter@FreeBSD.org>2003-06-26 03:51:57 +0000
commit289e79b907dd648e5c22a0678baf44a585511b35 (patch)
tree096ff24ee5a884c1dabbe49274b851335a0ef193
parent5d98ddee251e0ad9fcfe740b27b439d8c124e36b (diff)
downloadFreeBSD-src-289e79b907dd648e5c22a0678baf44a585511b35.zip
FreeBSD-src-289e79b907dd648e5c22a0678baf44a585511b35.tar.gz
Build on amd64. Yes, I know this isn't particularly nice.
-rw-r--r--sys/boot/Makefile3
-rw-r--r--sys/boot/common/Makefile.inc4
-rw-r--r--sys/boot/ficl/Makefile20
-rw-r--r--sys/boot/i386/Makefile.inc11
-rw-r--r--sys/boot/i386/boot2/Makefile12
-rw-r--r--sys/boot/i386/btx/Makefile.inc2
-rw-r--r--sys/boot/i386/btx/btxldr/Makefile1
-rw-r--r--sys/boot/i386/gptboot/Makefile12
-rw-r--r--sys/boot/i386/loader/Makefile2
9 files changed, 59 insertions, 8 deletions
diff --git a/sys/boot/Makefile b/sys/boot/Makefile
index 4e3ed58..ad7f32b 100644
--- a/sys/boot/Makefile
+++ b/sys/boot/Makefile
@@ -1,8 +1,7 @@
# $FreeBSD$
.if ${MACHINE_ARCH} == "amd64"
-MACHINE_ARCH=i386
-MACHINE=i386
+.MAKEFLAGS: MACHINE_ARCH=i386 MACHINE=i386 REALLY_AMD64=true
.endif
.if !defined(NOFORTH)
diff --git a/sys/boot/common/Makefile.inc b/sys/boot/common/Makefile.inc
index c72d09e..3f171a3d 100644
--- a/sys/boot/common/Makefile.inc
+++ b/sys/boot/common/Makefile.inc
@@ -34,7 +34,3 @@ MAN+= ../forth/loader.4th.8
.endif
MAN+= loader.8
-
-.if ${MACHINE_ARCH} == "amd64"
-CFLAGS+= -m32
-.endif
diff --git a/sys/boot/ficl/Makefile b/sys/boot/ficl/Makefile
index 6302da6..d3b8924 100644
--- a/sys/boot/ficl/Makefile
+++ b/sys/boot/ficl/Makefile
@@ -1,5 +1,9 @@
# $FreeBSD$
#
+.if ${MACHINE_ARCH} == "amd64"
+.MAKEFLAGS: MACHINE_ARCH=i386 MACHINE=i386 REALLY_AMD64=true
+.endif
+
.PATH: ${.CURDIR}/${MACHINE_ARCH}
BASE_SRCS= dict.c ficl.c fileaccess.c float.c loader.c math64.c \
prefix.c search.c stack.c tools.c vm.c words.c
@@ -37,8 +41,24 @@ SOFTWORDS= softcore.fr jhlocal.fr marker.fr freebsd.fr ficllocal.fr \
# Optional OO extension softwords
#SOFTWORDS+= oo.fr classes.fr
+.if defined(REALLY_AMD64)
+CFLAGS+= -m32 -I.
+LDFLAGS= -m elf_i386_fbsd
+.endif
+
CFLAGS+= -I${.CURDIR} -I${.CURDIR}/${MACHINE_ARCH} -I${.CURDIR}/../common
softcore.c: ${SOFTWORDS} softcore.awk
(cd ${.CURDIR}/softwords; cat ${SOFTWORDS} \
| awk -f softcore.awk -v datestamp="`LC_ALL=C date`") > ${.TARGET}
+
+.if defined(REALLY_AMD64)
+${SRCS:M*.c:R:S/$/.o/g}: machine
+
+beforedepend ${OBJS}: machine
+
+machine:
+ ln -sf ${.CURDIR}/../../i386/include machine
+
+CLEANFILES+= machine
+.endif
diff --git a/sys/boot/i386/Makefile.inc b/sys/boot/i386/Makefile.inc
index 6aced18..f8c00de 100644
--- a/sys/boot/i386/Makefile.inc
+++ b/sys/boot/i386/Makefile.inc
@@ -4,3 +4,14 @@
LOADER_ADDRESS?= 0x200000
CFLAGS+= -ffreestanding -mpreferred-stack-boundary=2
+
+.if ${MACHINE_ARCH} == "amd64"
+.MAKEFLAGS: MACHINE_ARCH=i386 MACHINE=i386 REALLY_AMD64=true
+.endif
+
+.if defined(REALLY_AMD64) && !defined(__been_to_Makefile_inc)
+__been_to_Makefile_inc= 1
+CFLAGS+= -m32
+LDFLAGS+= -m elf_i386_fbsd
+AFLAGS+= --32
+.endif
diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
index 95fec08b..aa8c0cd 100644
--- a/sys/boot/i386/boot2/Makefile
+++ b/sys/boot/i386/boot2/Makefile
@@ -109,3 +109,15 @@ install:
boot2 ${DESTDIR}${BINDIR}/boot2
.include <bsd.prog.mk>
+
+.if defined(REALLY_AMD64)
+boot2.o: machine
+
+beforedepend ${OBJS}: machine
+
+machine:
+ ln -sf ${.CURDIR}/../../../i386/include machine
+
+CLEANFILES+= machine
+.endif
+
diff --git a/sys/boot/i386/btx/Makefile.inc b/sys/boot/i386/btx/Makefile.inc
new file mode 100644
index 0000000..5a83d8d
--- /dev/null
+++ b/sys/boot/i386/btx/Makefile.inc
@@ -0,0 +1,2 @@
+# $FreeBSD$
+.include <${.CURDIR}/../../Makefile.inc>
diff --git a/sys/boot/i386/btx/btxldr/Makefile b/sys/boot/i386/btx/btxldr/Makefile
index bd69850..c89af62 100644
--- a/sys/boot/i386/btx/btxldr/Makefile
+++ b/sys/boot/i386/btx/btxldr/Makefile
@@ -19,5 +19,4 @@ btxldr.o: btxldr.s
CLEANFILES+= btxldr btxldr.out btxldr.o
-.include <${.CURDIR}/../../Makefile.inc>
.include <bsd.prog.mk>
diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile
index 95fec08b..aa8c0cd 100644
--- a/sys/boot/i386/gptboot/Makefile
+++ b/sys/boot/i386/gptboot/Makefile
@@ -109,3 +109,15 @@ install:
boot2 ${DESTDIR}${BINDIR}/boot2
.include <bsd.prog.mk>
+
+.if defined(REALLY_AMD64)
+boot2.o: machine
+
+beforedepend ${OBJS}: machine
+
+machine:
+ ln -sf ${.CURDIR}/../../../i386/include machine
+
+CLEANFILES+= machine
+.endif
+
diff --git a/sys/boot/i386/loader/Makefile b/sys/boot/i386/loader/Makefile
index b92fcd6..670bd9f 100644
--- a/sys/boot/i386/loader/Makefile
+++ b/sys/boot/i386/loader/Makefile
@@ -85,7 +85,7 @@ CFLAGS+= -elf
vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
- ${CC} -c vers.c
+ ${CC} ${CFLAGS} -c vers.c
${PROG}: ${PROG}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
OpenPOWER on IntegriCloud