Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
# $NetBSD: Makefile.boot,v 1.58 2012/08/10 12:18:15 joerg Exp $
|
2012-01-09 15:07:58 +01:00
|
|
|
|
|
|
|
S= ${.CURDIR}/../../../../..
|
|
|
|
|
|
|
|
NOMAN=
|
|
|
|
PROG?= boot
|
|
|
|
NEWVERSWHAT?= "BIOS Boot"
|
|
|
|
VERSIONFILE?= ${.CURDIR}/../version
|
|
|
|
|
|
|
|
AFLAGS.biosboot.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
|
|
|
|
|
|
|
|
SOURCES?= biosboot.S boot2.c conf.c devopen.c exec.c
|
|
|
|
SRCS= ${SOURCES}
|
|
|
|
.if !make(depend)
|
|
|
|
SRCS+= vers.c
|
|
|
|
.endif
|
|
|
|
|
|
|
|
PIE_CFLAGS=
|
|
|
|
PIE_AFLAGS=
|
|
|
|
PIE_LDFLAGS=
|
|
|
|
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
|
|
|
|
STRIPFLAG= # nothing
|
|
|
|
|
|
|
|
LIBCRT0= # nothing
|
|
|
|
LIBCRTBEGIN= # nothing
|
|
|
|
LIBCRTEND= # nothing
|
|
|
|
LIBC= # nothing
|
|
|
|
|
|
|
|
BINDIR=/usr/mdec
|
|
|
|
BINMODE=444
|
|
|
|
|
|
|
|
.PATH: ${.CURDIR}/.. ${.CURDIR}/../../lib
|
|
|
|
|
2012-11-15 12:06:41 +01:00
|
|
|
LDFLAGS+= -nostdlib -Wl,-N -Wl,-e,boot_start
|
2012-01-09 15:07:58 +01:00
|
|
|
CPPFLAGS+= -I ${.CURDIR}/.. -I ${.CURDIR}/../../lib -I ${S}/lib/libsa
|
|
|
|
CPPFLAGS+= -I ${.OBJDIR}
|
|
|
|
# Make sure we override any optimization options specified by the user
|
|
|
|
COPTS= -Os
|
|
|
|
|
|
|
|
.if ${MACHINE_ARCH} == "x86_64"
|
|
|
|
LDFLAGS+= -Wl,-m,elf_i386
|
|
|
|
AFLAGS+= -m32
|
|
|
|
CPUFLAGS= -m32
|
|
|
|
LIBKERN_ARCH=i386
|
|
|
|
KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386"
|
|
|
|
.else
|
|
|
|
CPUFLAGS= -march=i386 -mtune=i386
|
|
|
|
.endif
|
|
|
|
|
|
|
|
CFLAGS+= -mno-sse -mno-sse2 -mno-sse3
|
|
|
|
|
|
|
|
COPTS+= -ffreestanding
|
2013-08-26 18:43:05 +02:00
|
|
|
.if defined(__MINIX)
|
|
|
|
CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes
|
|
|
|
.else
|
2012-01-09 15:07:58 +01:00
|
|
|
CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes
|
2013-08-26 18:43:05 +02:00
|
|
|
.endif
|
2012-01-09 15:07:58 +01:00
|
|
|
CPPFLAGS+= -nostdinc -D_STANDALONE
|
|
|
|
CPPFLAGS+= -I$S
|
|
|
|
|
|
|
|
CPPFLAGS+= -DSUPPORT_PS2
|
|
|
|
CPPFLAGS+= -DDIRECT_SERIAL
|
|
|
|
CPPFLAGS+= -DSUPPORT_SERIAL=boot_params.bp_consdev
|
|
|
|
|
|
|
|
CPPFLAGS+= -DCONSPEED=boot_params.bp_conspeed
|
|
|
|
CPPFLAGS+= -DCONSADDR=boot_params.bp_consaddr
|
|
|
|
CPPFLAGS+= -DCONSOLE_KEYMAP=boot_params.bp_keymap
|
|
|
|
|
|
|
|
CPPFLAGS+= -DSUPPORT_CD9660
|
|
|
|
CPPFLAGS+= -DSUPPORT_USTARFS
|
|
|
|
CPPFLAGS+= -DSUPPORT_DOSFS
|
|
|
|
CPPFLAGS+= -DSUPPORT_EXT2FS
|
|
|
|
CPPFLAGS+= -DSUPPORT_MINIXFS3
|
|
|
|
CPPFLAGS+= -DPASS_BIOSGEOM
|
|
|
|
CPPFLAGS+= -DPASS_MEMMAP
|
|
|
|
#CPPFLAGS+= -DBOOTPASSWD
|
|
|
|
CPPFLAGS+= -DEPIA_HACK
|
|
|
|
#CPPFLAGS+= -DDEBUG_MEMSIZE
|
|
|
|
#CPPFLAGS+= -DBOOT_MSG_COM0
|
|
|
|
CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
|
|
|
|
|
|
|
|
# The biosboot code is linked to 'virtual' address of zero and is
|
|
|
|
# loaded at physical address 0x10000.
|
|
|
|
# XXX The heap values should be determined from _end.
|
|
|
|
SAMISCCPPFLAGS+= -DHEAP_START=0x40000 -DHEAP_LIMIT=0x70000
|
|
|
|
SAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT
|
|
|
|
SAMISCMAKEFLAGS+= SA_USE_CREAD=yes # Read compressed kernels
|
|
|
|
SAMISCMAKEFLAGS+= SA_INCLUDE_NET=no # Netboot via TFTP, NFS
|
|
|
|
|
|
|
|
CPPFLAGS+= -Wno-pointer-sign
|
|
|
|
|
|
|
|
# CPPFLAGS+= -DBOOTXX_RAID1_SUPPORT
|
|
|
|
|
|
|
|
I386_STAND_DIR?= $S/arch/i386/stand
|
|
|
|
|
|
|
|
CLEANFILES+= machine x86
|
|
|
|
|
|
|
|
.if !make(obj) && !make(clean) && !make(cleandir)
|
|
|
|
.BEGIN:
|
|
|
|
-rm -f machine && ln -s $S/arch/i386/include machine
|
|
|
|
-rm -f x86 && ln -s $S/arch/x86/include x86
|
|
|
|
.ifdef LIBOBJ
|
|
|
|
-rm -f lib && ln -s ${LIBOBJ}/lib lib
|
|
|
|
mkdir -p ${LIBOBJ}/lib
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
### find out what to use for libi386
|
|
|
|
I386DIR= ${I386_STAND_DIR}/lib
|
|
|
|
.include "${I386DIR}/Makefile.inc"
|
|
|
|
LIBI386= ${I386LIB}
|
|
|
|
|
|
|
|
### find out what to use for libsa
|
|
|
|
SA_AS= library
|
|
|
|
SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
|
|
|
|
SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
|
|
|
|
.include "${S}/lib/libsa/Makefile.inc"
|
|
|
|
LIBSA= ${SALIB}
|
|
|
|
|
2012-01-25 13:29:07 +01:00
|
|
|
.ifndef __MINIX
|
2012-01-09 15:07:58 +01:00
|
|
|
### find out what to use for libkern
|
|
|
|
KERN_AS= library
|
|
|
|
.include "${S}/lib/libkern/Makefile.inc"
|
|
|
|
LIBKERN= ${KERNLIB}
|
2012-01-25 13:29:07 +01:00
|
|
|
.else
|
2013-06-11 21:08:05 +02:00
|
|
|
|
|
|
|
# When using gold linker, specify the linker script
|
|
|
|
GOLDLINKERSCRIPT?= ${LDS_N}
|
2013-06-17 16:51:49 +02:00
|
|
|
USE_BITCODE=no
|
2013-06-11 21:08:05 +02:00
|
|
|
|
2012-11-15 12:06:41 +01:00
|
|
|
# use MINIX minc
|
|
|
|
LIBKERN= ${DESTDIR}/usr/lib/libminc.a
|
2012-01-25 13:29:07 +01:00
|
|
|
.endif
|
2012-01-09 15:07:58 +01:00
|
|
|
|
|
|
|
### find out what to use for libz
|
|
|
|
Z_AS= library
|
|
|
|
.include "${S}/lib/libz/Makefile.inc"
|
|
|
|
LIBZ= ${ZLIB}
|
|
|
|
|
|
|
|
|
|
|
|
cleandir distclean: .WAIT cleanlibdir
|
|
|
|
|
|
|
|
cleanlibdir:
|
|
|
|
-rm -rf lib
|
|
|
|
|
|
|
|
LIBLIST= ${LIBI386} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} ${LIBSA}
|
|
|
|
# LIBLIST= ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA} ${LIBZ} ${LIBKERN}
|
|
|
|
|
|
|
|
CLEANFILES+= ${PROG}.tmp ${PROG}.map ${PROG}.syms vers.c
|
|
|
|
|
|
|
|
vers.c: ${VERSIONFILE} ${SOURCES} ${LIBLIST} ${.CURDIR}/../Makefile.boot
|
|
|
|
${HOST_SH} ${S}/conf/newvers_stand.sh ${VERSIONFILE} x86 ${NEWVERSWHAT}
|
|
|
|
|
|
|
|
# Anything that calls 'real_to_prot' must have a %pc < 0x10000.
|
|
|
|
# We link the program, find the callers (all in libi386), then
|
|
|
|
# explicitly pull in the required objects before any other library code.
|
|
|
|
${PROG}: ${OBJS} ${LIBLIST} ${.CURDIR}/../Makefile.boot
|
|
|
|
${_MKTARGET_LINK}
|
|
|
|
bb="$$( ${CC} -o ${PROG}.syms ${LDFLAGS} -Wl,-Ttext,0 -Wl,-cref \
|
2012-11-15 12:06:41 +01:00
|
|
|
${OBJS} ${LIBLIST} | ( \
|
2012-01-09 15:07:58 +01:00
|
|
|
while read symbol file; do \
|
|
|
|
[ -z "$$file" ] && continue; \
|
|
|
|
[ "$$symbol" = real_to_prot ] && break; \
|
|
|
|
done; \
|
|
|
|
while \
|
|
|
|
oifs="$$IFS"; \
|
|
|
|
IFS='()'; \
|
|
|
|
set -- $$file; \
|
|
|
|
IFS="$$oifs"; \
|
|
|
|
[ -n "$$2" ] && echo "${I386DST}/$$2"; \
|
|
|
|
read file rest && [ -z "$$rest" ]; \
|
|
|
|
do :; \
|
|
|
|
done; \
|
|
|
|
) )"; \
|
|
|
|
${CC} -o ${PROG}.syms ${LDFLAGS} -Wl,-Ttext,0 \
|
2012-11-15 12:06:41 +01:00
|
|
|
-Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} $$bb ${LIBLIST}
|
2012-01-09 15:07:58 +01:00
|
|
|
${OBJCOPY} -O binary ${PROG}.syms ${PROG}
|
|
|
|
|
|
|
|
.include <bsd.prog.mk>
|