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