Makefile revision 115423
1314125Sdelphij# $FreeBSD: head/sys/boot/i386/loader/Makefile 115423 2003-05-31 05:25:18Z scottl $ 2238405Sjkim 3238405SjkimPROG= loader 4238405SjkimSTRIP= 5238405SjkimNEWVERSWHAT= "bootstrap loader" i386 6238405SjkimBINDIR?= /boot 7238405SjkimINSTALLFLAGS= -b 8238405Sjkim 9238405Sjkim# architecture-specific loader code 10238405SjkimSRCS= main.c conf.c 11238405Sjkim 12238405SjkimCFLAGS+= -ffreestanding 13238405Sjkim# Enable PXE TFTP or NFS support, not both. 14238405Sjkim.if defined(LOADER_TFTP_SUPPORT) 15238405SjkimCFLAGS+= -DLOADER_TFTP_SUPPORT 16238405Sjkim.else 17238405SjkimCFLAGS+= -DLOADER_NFS_SUPPORT 18238405Sjkim.endif 19238405Sjkim 20238405Sjkim# Enable PnP and ISA-PnP code. 21238405SjkimHAVE_PNP= yes 22238405SjkimHAVE_ISABUS= yes 23238405Sjkim 24238405Sjkim.if !defined(NOFORTH) 25238405Sjkim# Enable BootForth 26238405SjkimBOOT_FORTH= yes 27238405SjkimCFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386 28238405Sjkim.if exists(${.OBJDIR}/../../ficl/libficl.a) 29238405SjkimLIBFICL= ${.OBJDIR}/../../ficl/libficl.a 30238405Sjkim.else 31238405SjkimLIBFICL= ${.CURDIR}/../../ficl/libficl.a 32238405Sjkim.endif 33238405Sjkim.endif 34238405Sjkim 35238405Sjkim.if defined(LOADER_BZIP2_SUPPORT) 36238405SjkimCFLAGS+= -DLOADER_BZIP2_SUPPORT 37238405Sjkim.endif 38238405Sjkim.if !defined(LOADER_NO_GZIP_SUPPORT) 39238405SjkimCFLAGS+= -DLOADER_GZIP_SUPPORT 40238405Sjkim.endif 41276861Sjkim 42276861Sjkim# Always add MI sources 43238405Sjkim.PATH: ${.CURDIR}/../../common 44238405Sjkim.include <${.CURDIR}/../../common/Makefile.inc> 45238405SjkimCFLAGS+= -I${.CURDIR}/../../common 46238405SjkimCFLAGS+= -I${.CURDIR}/../../.. -I. 47238405Sjkim 48238405SjkimCLEANFILES+= vers.c vers.o ${PROG}.list ${PROG}.bin ${PROG}.sym ${PROG}.help 49314125Sdelphij 50238405SjkimCFLAGS+= -Wall 51238405SjkimLDFLAGS= -nostdlib -static -Ttext 0x0 52238405Sjkim 53276861Sjkim# i386 standalone support library 54276861SjkimLIBI386= ${.OBJDIR}/../libi386/libi386.a 55276861SjkimCFLAGS+= -I${.CURDIR}/.. 56238405Sjkim 57314125Sdelphij# where to get libstand from 58314125Sdelphij#XXX need a better way to do this 59314125SdelphijLIBSTAND= ${.CURDIR}/../../../../lib/libstand/libstand.a 60314125Sdelphij.if !exists(${LIBSTAND}) 61238405SjkimLIBSTAND= ${.OBJDIR}/../../../../lib/libstand/libstand.a 62314125Sdelphij.if !exists(${LIBSTAND}) 63314125SdelphijLIBSTAND= -lstand 64314125Sdelphij.endif 65276861Sjkim.endif 66238405SjkimCFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ 67238405Sjkim 68238405Sjkim# BTX components 69238405Sjkim.if exists(${.OBJDIR}/../btx) 70238405SjkimBTXDIR= ${.OBJDIR}/../btx 71238405Sjkim.else 72238405SjkimBTXDIR= ${.CURDIR}/../btx 73238405Sjkim.endif 74238405SjkimBTXLDR= ${BTXDIR}/btxldr/btxldr 75238405SjkimBTXKERN= ${BTXDIR}/btx/btx 76238405SjkimBTXCRT= ${BTXDIR}/lib/crt0.o 77238405SjkimCFLAGS+= -I${.CURDIR}/../btx/lib 78238405Sjkim 79238405Sjkim# BTX is expecting ELF components 80238405SjkimCFLAGS+= -elf 81238405Sjkim 82238405Sjkim# Debug me! 83238405Sjkim#CFLAGS+= -g 84238405Sjkim#LDFLAGS+= -g 85238405Sjkim 86238405Sjkimvers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version 87238405Sjkim sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} 88238405Sjkim ${CC} -c vers.c 89238405Sjkim 90238405Sjkim${PROG}: ${PROG}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT} 91238405Sjkim btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ 92238405Sjkim -b ${BTXKERN} ${PROG}.bin 93238405Sjkim# /usr/bin/kzip ${.TARGET} 94238405Sjkim# mv ${.TARGET}.kz ${.TARGET} 95238405Sjkim 96238405Sjkim${PROG}.bin: ${PROG}.sym 97238405Sjkim cp ${.ALLSRC} ${.TARGET} 98238405Sjkim strip -R .comment -R .note ${.TARGET} 99238405Sjkim 100238405Sjkim${PROG}.help: help.common help.i386 101238405Sjkim cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} 102238405Sjkim 103238405Sjkim.PATH: ${.CURDIR}/../../forth 104238405SjkimFILES= ${PROG}.help loader.4th support.4th loader.conf 105238405SjkimFILES+= screen.4th frames.4th beastie.4th 106238405SjkimFILESDIR_loader.conf= /boot/defaults 107238405Sjkim 108238405Sjkim.if !exists(${DESTDIR}/boot/loader.rc) 109238405SjkimFILES+= ${.CURDIR}/loader.rc 110238405Sjkim.endif 111238405Sjkim 112238405Sjkim.include <${.CURDIR}/../Makefile.inc> 113238405Sjkim 114238405Sjkim# Cannot use ${OBJS} above this line 115238405Sjkim.include <bsd.prog.mk> 116238405Sjkim 117238405Sjkim${PROG}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBFICL} vers.o 118238405Sjkim ${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \ 119238405Sjkim ${LIBFICL} ${LIBI386} ${LIBSTAND} 120238405Sjkim 121238405Sjkim# If it's not there, don't consider it a target 122238405Sjkim.if exists(${.CURDIR}/../../../i386/include) 123238405Sjkimbeforedepend ${OBJS}: machine 124238405Sjkim 125238405Sjkimmachine: 126238405Sjkim ln -sf ${.CURDIR}/../../../i386/include machine 127238405Sjkim 128238405Sjkim.endif 129238405Sjkim 130238405SjkimCLEANFILES+= machine 131238405Sjkim