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