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