Makefile revision 1.38
11.38Sis#	$NetBSD: Makefile,v 1.38 2006/01/25 13:23:50 is Exp $
21.34Slukem
31.34Slukem.include <bsd.sys.mk>		# for HOST_SH
41.1Sis
51.2Sis### what we need:
61.1Sis
71.38Sis#XX# lines replace similar lines, or are added, in case we want to
81.38Sis#XX# compile LIBZ ourselves to save a few bytes (think TXLT)
91.38Sis
101.38Sis#XX#DIR_LIBZ =	${DIR_TOP}/../common/dist/zlib
111.38Sis
121.10SisDIR_TOP=	${.CURDIR}/../../../../..
131.10SisDIR_SA = 	${DIR_TOP}/lib/libsa
141.38SisDIR_LIBZ=
151.10SisDIR_KERN=	${DIR_TOP}/lib/libkern
161.10SisDIR_KERN_MD=	${DIR_TOP}/lib/libkern/arch/$(MACHINE_ARCH)
171.36SisDIR_LIBC=	${DIR_TOP}/../common/lib/libc
181.1Sis
191.36Sis.PATH:  $(DIR_SA) ${DIR_LIBZ} $(DIR_KERN) $(DIR_KERN_MD) \
201.36Sis	${DIR_LIBC}/gen ${DIR_LIBC}/arch/m68k/gen \
211.36Sis	${DIR_LIBC}/inet ${DIR_LIBC}/arch/m68k/inet \
221.36Sis	${DIR_LIBC}/quad ${DIR_LIBC}/arch/m68k/quad \
231.36Sis	${DIR_LIBC}/string ${DIR_LIBC}/arch/m68k/string
241.1Sis
251.38Sis### find out what to use for libz
261.38Sis
271.38SisS=	${DIR_TOP}	# ????
281.38SisZ_AS= library
291.38SisZMISCCPPFLAGS=-DDYNAMIC_CRC_TABLE -DNOBYFOUR -UBYFOUR 
301.38Sis.include "${DIR_TOP}/lib/libz/Makefile.inc"
311.38SisLIBZ= ${ZLIB}
321.38Sis
331.2Sis# prefer our assembler versions over assembler, and assembler over C:
341.1Sis
351.2Sis.SUFFIXES:
361.2Sis.SUFFIXES: .out .o .po .so .s .S .c .cc .C .f .y .l .ln .m4 .sh
371.1Sis
381.24SmhitchFILES= boot.amiga
391.13SveegoBINDIR=/usr/mdec
401.1Sis
411.15SisCOBJS = main.o console.o xd.o twiddle.o bzero.o gets.o
421.19SisCOBJS+=  lseek.o open.o read.o close.o dev.o errno.o
431.27SmhitchCOBJS+=  ufs.o ustarfs.o panic.o vers.o files.o
441.37SisCOBJS+=  divdi3.o moddi3.o qdivrem.o
451.1Sis
461.23SmhitchSOBJS = alloc.o ashrdi3.o ashldi3.o bcopy.o muldi3.o printf.o startit.o
471.38SisSOBJS += strlen.o memcmp.o memset.o strerror.o strncmp.o
481.38SisSOBJS += libstubs.o
491.37Sis
501.2SisOBJS=	$(SOBJS) $(COBJS)
511.1Sis
521.38Sis#XX#DEFS = -D_STANDALONE -DINSECURE -DDYNAMIC_CRC_TABLE -DNOBYFOUR -UBYFOUR 
531.38SisDEFS = -D_STANDALONE -DINSECURE 
541.24SmhitchDEFS += -D__INTERNAL_LIBSA_CREAD
551.24SmhitchSOBJS += cread.o
561.38Sis
571.38Sis#XX#SOBJS += adler32.o crc32.o inflate.o trees.o \
581.38Sis#XX#       zutil.o infback.o inftrees.o inffast.o
591.38Sis
601.25Saymeric#DEFS += -DBOOT_ELF32 -DBOOT_AOUT
611.24SmhitchSOBJS += loadfile.o loadfile_aout.o loadfile_elf32.o
621.24Smhitch
631.34SlukemNETBSD_VERS!=	${HOST_SH} ${.CURDIR}/../../../../../conf/osrelease.sh
641.24SmhitchDEFS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
651.1Sis
661.2Sis### main target: ###
671.1Sis
681.24Smhitchrealall: machine m68k ${FILES}
691.24Smhitch
701.24SmhitchCLEANFILES += boot.amiga x.out xxstart.o libboot.a vers.c machine m68k
711.1Sis
721.18Stron.include <bsd.prog.mk>
731.18Stron
741.2Sis### special  rules for bootblocks ###
751.1Sis
761.24SmhitchINCPATH = -nostdinc -I${DIR_TOP} -I${DIR_TOP}/lib/libsa -I${.CURDIR}
771.24SmhitchINCPATH += -I${.CURDIR}/../../.. -I${.OBJDIR}
781.24SmhitchINCPATH += -I${.CURDIR}/../aout2bb -I${DESTDIR}/usr/include
791.10Sis
801.2SisAFLAGS += -m68030 -l
811.10SisCAFLAGS += -Wa,-l -Wa,-m68030 ${INCPATH}
821.1Sis
831.33SmhitchCOPTIM= -Os -fomit-frame-pointer -fcse-follow-jumps -fcse-skip-blocks  -Wa,-l -m68060 -Wa,-m68030
841.29SthorpejCFLAGS= -ffreestanding ${COPTIM} ${INCPATH} ${DEFS} -Wall #-Wstrict-prototypes
851.1Sis
861.2Sis.c.o:
871.18Stron	${CC} ${CFLAGS} -S $< -o $*.s
881.18Stron	${TXLT} < $*.s | ${AS} ${AFLAGS} -o $*.o
891.2Sis	rm $*.s
901.1Sis
911.18Stron.s.o: ; ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $<
921.1Sis
931.18Stron.S.o: ; ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $<
941.1Sis
951.24Smhitchboot.amiga: x.out
961.27Smhitch	${RELOC2BB} -S x.out $@ || ${NM} -u x.out
971.2Sis
981.38Sisx.out: xxstart.o libboot.a ${LIBZ}
991.18Stron	${LD} ${LDFLAGS} -r -dc -e _start -o $@ $>
1001.22Smhitch	${SIZE} $@
1011.22Smhitch	${NM} -u $@
1021.2Sis
1031.2Sisxxstart.o: ${.CURDIR}/bbstart.s
1041.18Stron	${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp \
1051.2Sis		-o $@ -c $>
1061.2Sis
1071.18Stronlibboot.a: ${OBJS}
1081.18Stron	${AR} r $@ $> && ${RANLIB} $@
1091.2Sis
1101.24Smhitch.PHONY:	vers.c
1111.24Smhitchvers.c:	${.CURDIR}/version
1121.34Slukem	${HOST_SH} ${DIR_TOP}/conf/newvers_stand.sh -N ${.CURDIR}/version "amiga"
1131.24Smhitch
1141.24Smhitchmachine:
1151.24Smhitch	-rm -f $@
1161.24Smhitch	ln -s ${DIR_TOP}/arch/amiga/include $@
1171.24Smhitch
1181.24Smhitchm68k:
1191.24Smhitch	-rm -f $@
1201.24Smhitch	ln -s ${DIR_TOP}/arch/m68k/include $@
1211.24Smhitch
1221.10Sis# make sure these are built:
1231.2Sis
1241.10Sis${COBJS}: ${TXLT}
1251.24Smhitch${FILES}: ${RELOC2BB}
1261.26Saymeric
1271.26Saymeric.include "${.CURDIR}/../Makefile.booters"
128