1 # $NetBSD: Makefile.booters,v 1.77 2009/01/08 19:02:12 jakllsch Exp $
13 # Make sure we override any optimization options specified by the
16 .if ${MACHINE_ARCH} == "x86_64"
19 CPUFLAGS+= -Wno-attributes
25 CPUFLAGS= -march=i386 -mtune=i386 -Wno-attributes
29 COPTS= -Os -ffreestanding
31 I386_STAND_DIR?= $S/arch/i386/stand
33 .PATH: ${I386_STAND_DIR}/lib
36 GENPROMDIR= ${I386_STAND_DIR}/genprom
37 GENPROMOBJDIR!= cd ${GENPROMDIR} && ${PRINTOBJDIR}
38 GENPROM= ${GENPROMOBJDIR}/genprom
40 .PATH: ${I386_STAND_DIR}/lib/crt/dos
41 DOSSTART= start_dos.o doscommain.o
43 .PATH: ${I386_STAND_DIR}/lib/crt/pxe
46 CPPFLAGS+= -nostdinc -I${.OBJDIR} -I$S -I${I386_STAND_DIR}/lib -I$S/lib/libsa
47 CPPFLAGS+= -D_STANDALONE
51 .if ${MACHINE_ARCH} == "x86_64"
53 LDFLAGS+=-Wl,-m,elf_i386
55 KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386"
58 CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list
61 CLEANFILES+= machine x86
63 .if !make(obj) && !make(clean) && !make(cleandir)
65 -rm -f machine && ln -s $S/arch/i386/include machine
66 -rm -f x86 && ln -s $S/arch/x86/include x86
68 -rm -f lib && ln -s ${LIBOBJ}/lib lib
69 mkdir -p ${LIBOBJ}/lib
73 ### find out what to use for libkern
75 .include "${S}/lib/libkern/Makefile.inc"
78 ### find out what to use for libz
80 .include "${S}/lib/libz/Makefile.inc"
83 ### find out what to use for libsa
85 SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
86 .include "${S}/lib/libsa/Makefile.inc"
89 ### find out what to use for libi386
90 I386DIR= ${I386_STAND_DIR}/lib
91 .include "${I386DIR}/Makefile.inc"
94 cleandir distclean: cleanlibdir
99 .if ${OBJECT_FMT} == "ELF"
100 LDFLAGS+=-Wl,-M -Wl,-e,start # -N does not work properly.
102 LDFLAGS+=-Wl,-N -Wl,-M -Wl,-e,_start
105 LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA}
107 vers.c: ${VERSIONFILE} ${SOURCES} ${S}/conf/newvers_stand.sh
108 ${HOST_SH} ${S}/conf/newvers_stand.sh -DM ${VERSIONFILE} x86 ${NEWVERSWHAT}
110 CLEANFILES+= ${BASE}.sym
111 ${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
113 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
114 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list
116 CLEANFILES+= ${BASE}.rom ${BASE}.rom.tmp
117 ${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
119 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
120 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list
121 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.rom.tmp
122 ${GENPROM} ${ROM_SIZE} < ${BASE}.rom.tmp > ${BASE}.rom || \
124 rm -f ${BASE}.rom.tmp
126 CLEANFILES+= ${BASE}.com
127 ${BASE}.com: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
129 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
130 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list
131 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.com
133 CLEANFILES+= ${BASE}.bin
134 ${BASE}.bin: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
136 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
137 ${STARTFILE} ${OBJS} ${LIBLIST} > ${BASE}.list
138 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin
140 .include <bsd.prog.mk>