Makefile.booters revision 1.83 1 1.83 joerg # $NetBSD: Makefile.booters,v 1.83 2011/04/09 00:26:52 joerg Exp $
2 1.32 thorpej
3 1.32 thorpej .include <bsd.own.mk>
4 1.1 perry
5 1.2 thorpej STRIPFLAG=
6 1.1 perry BINMODE=444
7 1.38 thorpej
8 1.38 thorpej LIBCRT0= # nothing
9 1.38 thorpej LIBCRTBEGIN= # nothing
10 1.38 thorpej LIBCRTEND= # nothing
11 1.38 thorpej LIBC= # nothing
12 1.29 tls
13 1.33 thorpej # Make sure we override any optimization options specified by the
14 1.33 thorpej # user.
15 1.76 gmcgarry .if defined(HAVE_GCC)
16 1.37 fvdl .if ${MACHINE_ARCH} == "x86_64"
17 1.58 thorpej CPUFLAGS= -m32
18 1.37 fvdl .else
19 1.63 mrg .if ${HAVE_GCC} == 3
20 1.63 mrg CPUFLAGS= -mcpu=i386
21 1.63 mrg .else
22 1.81 jakllsch CPUFLAGS= -march=i386 -mtune=i386
23 1.63 mrg .endif
24 1.37 fvdl .endif
25 1.76 gmcgarry .endif
26 1.58 thorpej COPTS= -Os -ffreestanding
27 1.1 perry
28 1.8 drochner I386_STAND_DIR?= $S/arch/i386/stand
29 1.8 drochner
30 1.52 dsl .PATH: ${I386_STAND_DIR}/lib
31 1.32 thorpej
32 1.16 christos ROMSTART= start_rom.o
33 1.8 drochner GENPROMDIR= ${I386_STAND_DIR}/genprom
34 1.32 thorpej GENPROMOBJDIR!= cd ${GENPROMDIR} && ${PRINTOBJDIR}
35 1.32 thorpej GENPROM= ${GENPROMOBJDIR}/genprom
36 1.32 thorpej
37 1.8 drochner .PATH: ${I386_STAND_DIR}/lib/crt/dos
38 1.16 christos DOSSTART= start_dos.o doscommain.o
39 1.32 thorpej
40 1.31 thorpej .PATH: ${I386_STAND_DIR}/lib/crt/pxe
41 1.31 thorpej PXESTART= start_pxe.o
42 1.1 perry
43 1.70 yamt CPPFLAGS+= -nostdinc -I${.OBJDIR} -I$S -I${I386_STAND_DIR}/lib -I$S/lib/libsa
44 1.5 drochner CPPFLAGS+= -D_STANDALONE
45 1.68 lukem LDFLAGS+= -nostdlib
46 1.37 fvdl
47 1.37 fvdl # XXX
48 1.37 fvdl .if ${MACHINE_ARCH} == "x86_64"
49 1.37 fvdl CPPFLAGS+=-m32
50 1.68 lukem LDFLAGS+=-Wl,-m,elf_i386
51 1.37 fvdl LIBKERN_ARCH=i386
52 1.37 fvdl KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386"
53 1.37 fvdl .endif
54 1.1 perry
55 1.41 dsl CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list
56 1.26 jdolecek SRCS+= vers.c
57 1.7 thorpej
58 1.44 drochner CLEANFILES+= machine x86
59 1.6 drochner
60 1.61 chs .if !make(obj) && !make(clean) && !make(cleandir)
61 1.61 chs .BEGIN:
62 1.61 chs -rm -f machine && ln -s $S/arch/i386/include machine
63 1.61 chs -rm -f x86 && ln -s $S/arch/x86/include x86
64 1.53 dsl .ifdef LIBOBJ
65 1.61 chs -rm -f lib && ln -s ${LIBOBJ}/lib lib
66 1.61 chs mkdir -p ${LIBOBJ}/lib
67 1.61 chs .endif
68 1.53 dsl .endif
69 1.6 drochner
70 1.1 perry ### find out what to use for libkern
71 1.1 perry KERN_AS= library
72 1.1 perry .include "${S}/lib/libkern/Makefile.inc"
73 1.1 perry LIBKERN= ${KERNLIB}
74 1.1 perry
75 1.1 perry ### find out what to use for libz
76 1.1 perry Z_AS= library
77 1.1 perry .include "${S}/lib/libz/Makefile.inc"
78 1.1 perry LIBZ= ${ZLIB}
79 1.1 perry
80 1.1 perry ### find out what to use for libsa
81 1.1 perry SA_AS= library
82 1.22 christos SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
83 1.1 perry .include "${S}/lib/libsa/Makefile.inc"
84 1.1 perry LIBSA= ${SALIB}
85 1.1 perry
86 1.1 perry ### find out what to use for libi386
87 1.8 drochner I386DIR= ${I386_STAND_DIR}/lib
88 1.1 perry .include "${I386DIR}/Makefile.inc"
89 1.1 perry LIBI386= ${I386LIB}
90 1.17 tron
91 1.79 dholland cleandir distclean: .WAIT cleanlibdir
92 1.17 tron
93 1.17 tron cleanlibdir:
94 1.57 jmc -rm -rf lib
95 1.16 christos
96 1.68 lukem LDFLAGS+=-Wl,-M -Wl,-e,start # -N does not work properly.
97 1.16 christos
98 1.22 christos LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA}
99 1.22 christos
100 1.78 tsutsui vers.c: ${VERSIONFILE} ${SOURCES} ${S}/conf/newvers_stand.sh
101 1.82 joerg ${HOST_SH} ${S}/conf/newvers_stand.sh ${VERSIONFILE} x86 ${NEWVERSWHAT}
102 1.7 thorpej
103 1.32 thorpej CLEANFILES+= ${BASE}.sym
104 1.32 thorpej ${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
105 1.64 lukem ${_MKTARGET_LINK}
106 1.68 lukem ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
107 1.39 dsl ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list
108 1.32 thorpej
109 1.65 lukem CLEANFILES+= ${BASE}.rom ${BASE}.rom.tmp
110 1.32 thorpej ${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
111 1.64 lukem ${_MKTARGET_LINK}
112 1.68 lukem ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
113 1.68 lukem ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list
114 1.65 lukem ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.rom.tmp
115 1.65 lukem ${GENPROM} ${ROM_SIZE} < ${BASE}.rom.tmp > ${BASE}.rom || \
116 1.83 joerg ( rm -f ${BASE}.rom && false )
117 1.65 lukem rm -f ${BASE}.rom.tmp
118 1.9 drochner
119 1.32 thorpej CLEANFILES+= ${BASE}.com
120 1.32 thorpej ${BASE}.com: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
121 1.64 lukem ${_MKTARGET_LINK}
122 1.68 lukem ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
123 1.68 lukem ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list
124 1.32 thorpej ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.com
125 1.32 thorpej
126 1.32 thorpej CLEANFILES+= ${BASE}.bin
127 1.32 thorpej ${BASE}.bin: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
128 1.64 lukem ${_MKTARGET_LINK}
129 1.68 lukem ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
130 1.68 lukem ${STARTFILE} ${OBJS} ${LIBLIST} > ${BASE}.list
131 1.32 thorpej ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin
132 1.9 drochner
133 1.9 drochner .include <bsd.prog.mk>
134