Home | History | Annotate | Line # | Download | only in boot
      1 #	$NetBSD: Makefile,v 1.31 2023/02/09 15:20:40 tsutsui Exp $
      2 
      3 NOMAN=	# defined
      4 
      5 S=	${.CURDIR}/../../../..
      6 
      7 ### find out what to use for libkern
      8 KERN_AS=        library
      9 .include "${S}/lib/libkern/Makefile.inc"
     10 #LIBKERN=        ${KERNLIB}
     11 
     12 ### find out what to use for libz
     13 Z_AS=           library
     14 .include "${S}/lib/libz/Makefile.inc"
     15 #LIBZ=           ${ZLIB}
     16 
     17 ### find out what to use for libsa
     18 SA_AS=          library
     19 SAMISCMAKEFLAGS= SA_USE_LOADFILE=yes # SA_USE_CREAD=yes
     20 .include "${S}/lib/libsa/Makefile.inc"
     21 #LIBSA=          ${SALIB}
     22 
     23 RELOC=	4380000
     24 
     25 # XXX make defs arch-indep.
     26 INCLUDES+=	-I${.OBJDIR} -I${S}/arch -I${S} -I${S}/lib/libsa
     27 DEFS+=		-D_STANDALONE -DMC68040 -DSUPPORT_BOOTP -DSUPPORT_DHCP
     28 #DEFS+=		-DDEBUG -DSD_DEBUG -DSCSI_DEBUG -DEN_DEBUG -DNETIF_DEBUG
     29 SAMISCCPPFLAGS=	-DSUPPORT_DHCP -DSUPPORT_BOOTP -DSA_EXEC_ANYOWNER
     30 #SAMISCCPPFLAGS+= -DBOOTP_DEBUG -DETHER_DEBUG -DNET_DEBUG-DNETIF_DEBUG
     31 #SAMISCCPPFLAGS+= -DNFS_DEBUG -DARP_DEBUG
     32 WARNS=1
     33 CFLAGS+=	-ffreestanding -nostdinc ${INCLUDES} ${DEFS}
     34 CFLAGS+=	-Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
     35 AFLAGS+=	${INCLUDES}
     36 # XXX SHOULD NOT NEED TO DEFINE THESE!
     37 LIBCRT0=
     38 LIBCRTI=
     39 LIBC=
     40 LIBCRTBEGIN=
     41 LIBCRTEND=
     42 
     43 PROG=	boot
     44 SRCS=   boot.c machdep.c conf.c devopen.c rtc.c sd.c scsi.c en.c build.c
     45 
     46 # @@@ dev_net.c should really be in libsa, but it doesn't
     47 # declare ip_convertaddr correctly, so I put it here _temporarily_.
     48 .PATH: ${S}/lib/libsa
     49 SRCS+=	dev_net.c
     50 
     51 CLEANFILES+= srt0.o boot.elf boot.raw limits.h
     52 CLEANFILES+= build.c build	# generated dynamically
     53 
     54 BINDIR=	/usr/mdec
     55 #LIBS=	${SALIB} ${KERNLIB} ${ZLIB}
     56 LIBS=	${SALIB} ${KERNLIB}
     57 
     58 # do not strip ${PROG} on install
     59 STRIPFLAG=	# defined
     60 
     61 AWKPROG='\
     62 function x(v) { printf "\\0\\%o\\%o\\%o", (v / 65536) % 256, (v / 256) % 256, v % 256 } \
     63 { \
     64 	printf "\047\\0\\207\\01\\07"; \
     65 	x($$1); \
     66 	x($$2); \
     67 	x($$3); \
     68 	printf "\\0\\0\\0\\0\\04\\070\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\047" \
     69 }'
     70 
     71 ${PROG}: srt0.o ${OBJS} ${LIBS}
     72 	${_MKTARGET_LINK}
     73 	${LD} -N -Ttext ${RELOC} -e start srt0.o ${OBJS} ${LIBS} -o $@.elf
     74 	${SIZE} $@.elf
     75 	${OBJCOPY} -O binary $@.elf $@.raw
     76 	(${SIZE} $@.elf | tail +2 | ${TOOL_AWK} ${AWKPROG} | \
     77 		xargs printf ; cat $@.raw) > $@
     78 
     79 # startup
     80 
     81 srt0.o: ${.CURDIR}/srt0.s
     82 	${CC} -m68040 -x assembler-with-cpp ${INCLUDES} ${DEFS} -c ${.CURDIR}/srt0.s
     83 
     84 .PHONY: build.c
     85 build.c:
     86 	${HOST_SH} ${.CURDIR}/newvers.sh
     87 
     88 .include "${S}/conf/newvers_stand.mk"
     89 
     90 #installboot: ${.CURDIR}/installboot.sh
     91 #	@rm -f installboot
     92 #	cp -p ${.CURDIR}/installboot.sh installboot
     93 
     94 # utilities
     95 
     96 .include <bsd.prog.mk>
     97 .include <bsd.klinks.mk>
     98