1 # $NetBSD: Makefile.booters,v 1.90 2015/03/08 19:47:17 martin Exp $
10 LIBCRTBEGIN= # nothing
14 # Make sure we override any optimization options specified by the
16 .if ${MACHINE_ARCH} == "x86_64"
17 CPUFLAGS= -m32 -march=i386 -mtune=i386
19 CPUFLAGS= -march=i386 -mtune=i386
21 COPTS= ${OPT_SIZE.${ACTIVE_CC}}
23 I386_STAND_DIR?= $S/arch/i386/stand
25 .PATH: ${I386_STAND_DIR}/lib
28 GENPROMDIR= ${I386_STAND_DIR}/genprom
29 GENPROMOBJDIR!= cd ${GENPROMDIR} && ${PRINTOBJDIR}
30 GENPROM= ${GENPROMOBJDIR}/genprom
32 .PATH: ${I386_STAND_DIR}/lib/crt/dos
33 DOSSTART= start_dos.o doscommain.o
35 .PATH: ${I386_STAND_DIR}/lib/crt/pxe
38 CPPFLAGS+= -nostdinc -I${.OBJDIR} -I$S -I${I386_STAND_DIR}/lib -I$S/lib/libsa
39 CPPFLAGS+= -D_STANDALONE
43 .if ${MACHINE_ARCH} == "x86_64"
45 LDFLAGS+=-Wl,-m,elf_i386
47 KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386"
50 CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list
53 ### find out what to use for libkern
55 .include "${S}/lib/libkern/Makefile.inc"
58 ### find out what to use for libz
60 .include "${S}/lib/libz/Makefile.inc"
63 ### find out what to use for libsa
65 SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
66 .include "${S}/lib/libsa/Makefile.inc"
69 ### find out what to use for libi386
70 I386DIR= ${I386_STAND_DIR}/lib
71 .include "${I386DIR}/Makefile.inc"
74 cleandir distclean: .WAIT cleanlibdir
79 LDFLAGS+=-Wl,-M -Wl,-e,start # -N does not work properly.
81 LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA}
83 vers.c: ${VERSIONFILE} ${SOURCES} ${S}/conf/newvers_stand.sh
84 ${HOST_SH} ${S}/conf/newvers_stand.sh ${VERSIONFILE} x86 ${NEWVERSWHAT}
86 CLEANFILES+= ${BASE}.sym
87 ${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
89 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
90 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list
92 CLEANFILES+= ${BASE}.rom ${BASE}.rom.tmp
93 ${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
95 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
96 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list
97 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.rom.tmp
98 ${GENPROM} ${ROM_SIZE} < ${BASE}.rom.tmp > ${BASE}.rom || \
99 ( rm -f ${BASE}.rom && false )
100 rm -f ${BASE}.rom.tmp
102 CLEANFILES+= ${BASE}.com
103 ${BASE}.com: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
105 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
106 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list
107 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.com
109 CLEANFILES+= ${BASE}.bin
110 ${BASE}.bin: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
112 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
113 ${STARTFILE} ${OBJS} ${LIBLIST} > ${BASE}.list
114 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin
116 .include <bsd.prog.mk>
118 .include <bsd.klinks.mk>