xref: /netbsd-src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile (revision eb7c1594f145c931049e1fd9eb056a5987e87e59)
1#	$NetBSD: Makefile,v 1.5 2003/02/03 07:17:13 mhitch Exp $
2
3### what we need:
4
5DIR_TOP=	${.CURDIR}/../../../../..
6DIR_SA = 	${DIR_TOP}/lib/libsa
7DIR_KERN=	${DIR_TOP}/lib/libkern
8DIR_KERN_MD=	${DIR_TOP}/lib/libkern/arch/$(MACHINE_ARCH)
9
10.PATH:  ${.CURDIR}/../boot $(DIR_SA) $(DIR_KERN) $(DIR_KERN_MD)
11
12# prefer our assembler versions over assembler, and assembler over C:
13
14.SUFFIXES:
15.SUFFIXES: .out .o .po .so .s .S .c .cc .C .f .y .l .ln .m4 .sh
16
17FILES= bootxx_ffs bootxx_fd
18BINDIR=/usr/mdec
19
20COBJS = main.o console.o xd.o twiddle.o bzero.o gets.o
21COBJS+=  lseek.o open.o read.o close.o dev.o errno.o
22COBJS+=  ufs.o ustarfs.o panic.o vers.o files.o
23
24SOBJS = alloc.o ashrdi3.o ashldi3.o bcopy.o muldi3.o printf.o startit.o
25SOBJS += strlen.o strcmp.o fstat.o
26SOBJS += libstubs.o  memset.o strncmp.o
27
28OBJS=	$(SOBJS) $(COBJS)
29
30DEFS = -D_STANDALONE -DINSECURE -D_PRIMARY_BOOT
31
32.NOPATH: ${OBJS} x.out f.out libboot.a xxstart.o
33
34### main target: ###
35
36realall: machine m68k ${FILES}
37
38CLEANFILES += bootxx_ffs bootxx_fd x.out f.out xxstart.o fdstart.o libboot.a vers.c machine m68k
39
40.include <bsd.prog.mk>
41
42### special  rules for bootblocks ###
43
44INCPATH = -nostdinc -I${DIR_TOP} -I${DIR_TOP}/lib/libsa -I${.CURDIR}
45INCPATH += -I${.CURDIR}/../boot -I${.CURDIR}/../../..
46INCPATH += -I${.CURDIR}/../aout2bb -I$(.CURDIR) -I${DESTDIR}/usr/include
47
48AFLAGS += -m68030 -l
49CAFLAGS += -Wa,-l -Wa,-m68030 ${INCPATH} -D_PRIMARY_BOOT
50
51COPTIM= -O -fomit-frame-pointer -fcse-follow-jumps -fcse-skip-blocks  -Wa,-l -m68060 -Wa,-m68030
52CFLAGS= -ffreestanding ${COPTIM} ${INCPATH} ${DEFS} -Wall #-Wstrict-prototypes
53
54NETBSD_VERS!=	sh ${.CURDIR}/../../../../../conf/osrelease.sh
55DEFS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
56
57# Use small daddr_t to avoid code bloat
58DEFS+=	-D__daddr_t=int32_t
59
60.c.o:
61	${CC} ${CFLAGS} -S $< -o $*.s
62	${TXLT} < $*.s | ${AS} ${AFLAGS} -o $*.o
63	rm $*.s
64
65.s.o: ; ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $<
66
67.S.o: ; ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $<
68
69bootxx_ffs: x.out
70	${RELOC2BB} x.out $@ || ${NM} -u x.out
71
72bootxx_fd: f.out
73	${RELOC2BB} -F f.out $@ || ${NM} -u f.out
74
75x.out: xxstart.o libboot.a
76	${LD} ${LDFLAGS} -r -dc -e _start -o $@ $>
77	${SIZE} $@
78	${NM} -u $@
79
80f.out: fdstart.o libboot.a
81	${LD} ${LDFLAGS} -r -dc -e _start -o $@ $>
82	${SIZE} $@
83	${NM} -u $@
84
85xxstart.o: ${.CURDIR}/../boot/bbstart.s
86	${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp \
87		-o $@ -c $>
88
89fdstart.o: ${.CURDIR}/../boot//bbstart.s
90	${CC} -DAUTOLOAD=8192 ${CAFLAGS} ${COPTS} -x assembler-with-cpp \
91		-o $@ -c $>
92
93libboot.a: ${OBJS}
94	${AR} r $@ $> && ${RANLIB} $@
95
96.PHONY:	vers.c
97vers.c:	${.CURDIR}/../boot/version
98	sh ${DIR_TOP}/conf/newvers_stand.sh -NDM ${.CURDIR}/../boot/version "amiga"
99
100machine:
101	-rm -f $@
102	ln -s ${DIR_TOP}/arch/amiga/include $@
103
104m68k:
105	-rm -f $@
106	ln -s ${DIR_TOP}/arch/m68k/include $@
107
108# make sure these are built:
109
110${COBJS}: ${TXLT}
111${FILES}: ${RELOC2BB}
112
113.include "${.CURDIR}/../Makefile.booters"
114