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