1 1.26.4.7 nathanw # $NetBSD: Makefile.booters,v 1.26.4.9 2002/12/11 06:01:04 thorpej Exp $ 2 1.26.4.4 nathanw 3 1.26.4.4 nathanw .include <bsd.own.mk> 4 1.1 perry 5 1.2 thorpej STRIPFLAG= 6 1.1 perry BINMODE=444 7 1.1 perry 8 1.26.4.5 nathanw # Make sure we override any optimization options specified by the 9 1.26.4.5 nathanw # user. 10 1.26.4.9 thorpej .if ${MACHINE_ARCH} == "x86_64" 11 1.26.4.9 thorpej COPTS= -Os -m32 12 1.26.4.9 thorpej CPPFLAGS+= -DBOOT_ELF64 13 1.26.4.9 thorpej .else 14 1.26.4.7 nathanw COPTS= -Os -mcpu=i386 15 1.26.4.9 thorpej .endif 16 1.26.4.6 nathanw COPTS+= -ffreestanding 17 1.26.4.2 nathanw 18 1.8 drochner I386_STAND_DIR?= $S/arch/i386/stand 19 1.8 drochner 20 1.8 drochner .PATH: ${I386_STAND_DIR}/lib/crt/bootsect ${I386_STAND_DIR}/lib 21 1.26.4.4 nathanw BSSTART= start_bootsect.o fraglist.o bootsectmain.o biosdisk_ll.o \ 22 1.26.4.4 nathanw bios_disk.o diskbuf.o 23 1.26.4.4 nathanw 24 1.8 drochner .PATH: ${I386_STAND_DIR}/lib/crt/rom 25 1.16 christos ROMSTART= start_rom.o 26 1.8 drochner GENPROMDIR= ${I386_STAND_DIR}/genprom 27 1.26.4.4 nathanw GENPROMOBJDIR!= cd ${GENPROMDIR} && ${PRINTOBJDIR} 28 1.26.4.4 nathanw GENPROM= ${GENPROMOBJDIR}/genprom 29 1.26.4.4 nathanw 30 1.8 drochner .PATH: ${I386_STAND_DIR}/lib/crt/dos 31 1.16 christos DOSSTART= start_dos.o doscommain.o 32 1.1 perry 33 1.26.4.4 nathanw .PATH: ${I386_STAND_DIR}/lib/crt/pxe 34 1.26.4.4 nathanw PXESTART= start_pxe.o 35 1.26.4.4 nathanw 36 1.13 cgd CPPFLAGS += -nostdinc -I${.OBJDIR} -I$S -I${I386_STAND_DIR}/lib -I$S/lib/libsa 37 1.5 drochner CPPFLAGS+= -D_STANDALONE 38 1.26.4.9 thorpej 39 1.26.4.9 thorpej # XXX 40 1.26.4.9 thorpej .if ${MACHINE_ARCH} == "x86_64" 41 1.26.4.9 thorpej CPPFLAGS+=-m32 42 1.26.4.9 thorpej LD+=-m elf_i386 43 1.26.4.9 thorpej LIBKERN_ARCH=i386 44 1.26.4.9 thorpej KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386" 45 1.26.4.9 thorpej .endif 46 1.1 perry 47 1.26.4.4 nathanw CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list 48 1.26 jdolecek SRCS+= vers.c 49 1.7 thorpej 50 1.26.4.3 nathanw .if !make(obj) && !make(clean) && !make(cleandir) 51 1.25 mycroft .BEGIN: machine 52 1.25 mycroft .NOPATH: machine 53 1.26.4.3 nathanw .endif 54 1.26.4.3 nathanw 55 1.25 mycroft realdepend realall: machine 56 1.25 mycroft CLEANFILES+= machine 57 1.6 drochner 58 1.25 mycroft machine:: 59 1.10 hubertf -rm -f $@ 60 1.6 drochner ln -s $S/arch/i386/include $@ 61 1.23 drochner 62 1.26.4.4 nathanw ${OBJS} ${BSSTART} ${ROMSTART} ${DOSSTART} ${PXESTART}: machine 63 1.6 drochner 64 1.1 perry ### find out what to use for libkern 65 1.1 perry KERN_AS= library 66 1.1 perry .include "${S}/lib/libkern/Makefile.inc" 67 1.1 perry LIBKERN= ${KERNLIB} 68 1.1 perry 69 1.1 perry ### find out what to use for libz 70 1.1 perry Z_AS= library 71 1.1 perry .include "${S}/lib/libz/Makefile.inc" 72 1.1 perry LIBZ= ${ZLIB} 73 1.1 perry 74 1.1 perry ### find out what to use for libsa 75 1.1 perry SA_AS= library 76 1.22 christos SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 77 1.1 perry .include "${S}/lib/libsa/Makefile.inc" 78 1.1 perry LIBSA= ${SALIB} 79 1.1 perry 80 1.1 perry ### find out what to use for libi386 81 1.8 drochner I386DIR= ${I386_STAND_DIR}/lib 82 1.1 perry .include "${I386DIR}/Makefile.inc" 83 1.1 perry LIBI386= ${I386LIB} 84 1.17 tron 85 1.18 tron cleandir distclean: cleanlibdir 86 1.17 tron 87 1.17 tron cleanlibdir: 88 1.17 tron rm -rf lib 89 1.16 christos 90 1.16 christos .if ${OBJECT_FMT} == "ELF" 91 1.16 christos LDFLAGS=-M -e start # -N does not work properly. 92 1.16 christos .else 93 1.16 christos LDFLAGS=-N -M -e _start 94 1.16 christos .endif 95 1.16 christos 96 1.22 christos LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA} 97 1.22 christos 98 1.26.4.8 nathanw vers.c: ${VERSIONFILE} ${SOURCES} 99 1.26 jdolecek sh ${S}conf/newvers_stand.sh ${.ALLSRC} 'i386' ${NEWVERSWHAT} 100 1.7 thorpej 101 1.26.4.4 nathanw CLEANFILES+= ${BASE}.sym 102 1.26.4.4 nathanw ${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 103 1.26.4.4 nathanw ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \ 104 1.26.4.4 nathanw ${LIBLIST} >${BASE}.list 105 1.26.4.4 nathanw 106 1.26.4.4 nathanw CLEANFILES+= ${BASE}.rom 107 1.26.4.4 nathanw ${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 108 1.26.4.4 nathanw ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \ 109 1.26.4.4 nathanw ${LIBLIST} >${BASE}.list 110 1.26.4.4 nathanw ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin 111 1.26.4.4 nathanw ${GENPROM} ${ROM_SIZE} < ${BASE}.bin > ${BASE}.rom || \ 112 1.26.4.4 nathanw rm -f ${BASE}.rom 113 1.9 drochner rm -f ${BASE}.bin 114 1.9 drochner 115 1.26.4.4 nathanw CLEANFILES+= ${BASE}.com 116 1.26.4.4 nathanw ${BASE}.com: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 117 1.26.4.4 nathanw ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \ 118 1.26.4.4 nathanw ${LIBLIST} >${BASE}.list 119 1.26.4.4 nathanw ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.com 120 1.26.4.4 nathanw 121 1.26.4.4 nathanw CLEANFILES+= ${BASE}.bin 122 1.26.4.4 nathanw ${BASE}.bin: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 123 1.26.4.4 nathanw ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \ 124 1.26.4.4 nathanw ${LIBLIST} > ${BASE}.list 125 1.26.4.4 nathanw ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin 126 1.9 drochner 127 1.9 drochner .include <bsd.prog.mk> 128