Makefile.powerpc revision 1.5
11.5Smycroft#	$NetBSD: Makefile.powerpc,v 1.5 1997/03/14 23:27:33 mycroft Exp $
21.1Sws#
31.1Sws# Makefile for NetBSD
41.1Sws#
51.1Sws# This makefile is constructed from a machine description:
61.1Sws#	config machineid
71.1Sws# Most changes should be made in the machine description
81.1Sws#	/sys/arch/powerpc/conf/``machineid''
91.1Sws# after which you should do
101.1Sws#	config machineid
111.1Sws# Machine generic makefile changes should be made in
121.1Sws#	/sys/arch/powerpc/conf/Makefile.powerpc
131.1Sws# after which config should be rerun for all machines of that type.
141.1Sws#
151.1Sws# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
161.1Sws#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
171.1Sws#
181.1Sws# -DTRACE	compile in kernel tracing hooks
191.1Sws# -DQUOTA	compile in file system quotas
201.1Sws#
211.1Sws.SUFFIXES:	.S .c .o
221.1Sws
231.1Sws# DEBUG is set to -g if debugging.
241.1Sws# PROF is set to -pg if profiling.
251.1Sws
261.1SwsCC?=	cc
271.1SwsLD?=	ld
281.1SwsMKDEP?=	mkdep
291.1SwsSTRIP?=	strip
301.1SwsSIZE?=	size
311.2SjonathanCOPTS?= 	-O2
321.1Sws
331.1Sws# source tree is located via $S relative to the compilation directory
341.1Sws.ifndef	S
351.1SwsS!=	cd ../../../..; pwd
361.1Sws.endif
371.1SwsPPC=	$S/arch/powerpc
381.1Sws
391.1SwsINCLUDES=	-I. -I$S/arch -I$S -nostdinc
401.1SwsCPPFLAGS=	${INCLUDES} ${IDENT} -D_KERNEL \
411.1Sws		-Dpowerpc
421.1SwsCWARNFLAGS=	-Werror -Wreturn-type
431.2SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
441.1SwsAFLAGS=		-D_LOCORE
451.1SwsLINKFLAGS=	-N -Ttext 100000 -e start
461.1SwsSTRIPFLAGS=	-d
471.1Sws
481.1SwsHOSTD_CC=	${CC}
491.1SwsHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
501.1SwsHOSTED_CFLAGS=	${CFLAGS}
511.1Sws
521.1Sws### find out what to use for libkern
531.1Sws.include "$S/lib/libkern/Makefile.inc"
541.1Sws.ifndef PROF
551.1SwsLIBKERN=	${KERNLIB}
561.1Sws.else
571.1SwsLIBKERN=	${KERNLIB_PROF}
581.1Sws.endif
591.1Sws
601.1Sws### find out what to use for libcompat
611.1Sws.include "$S/compat/common/Makefile.inc"
621.1Sws.ifndef PROF
631.1SwsLIBCOMPAT=	${COMPATLIB}
641.1Sws.else
651.1SwsLIBCOMPAT=	${COMPATLIB_PROF}
661.1Sws.endif
671.1Sws
681.1Sws# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
691.1Sws# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
701.1Sws
711.1SwsNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
721.1Sws
731.1SwsNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
741.1Sws
751.1SwsHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
761.1Sws
771.1Sws#.c.o:
781.1Sws#	${NORMAL_C}
791.1Sws#
801.1Sws#.S.o:
811.1Sws#	${NORMAL_S}
821.1Sws
831.1Sws%OBJS
841.1Sws
851.1Sws%CFILES
861.1Sws
871.1Sws%SFILES
881.1Sws
891.1Sws# load lines for config "xxx" will be emitted as:
901.1Sws# xxx: ${SYSTEM_DEP} swapxxx.o
911.1Sws#	${SYSTEM_LD_HEAD}
921.1Sws#	${SYSTEM_LD} swapxxx.o
931.1Sws#	${SYSTEM_LD_TAIL}
941.1SwsSYSTEM_OBJ=	locore.o \
951.1Sws		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
961.1SwsSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
971.1SwsSYSTEM_LD_HEAD=	rm -f $@
981.1SwsSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
991.1Sws		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1001.1SwsSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1011.1Sws
1021.1SwsDEBUG?=
1031.1Sws.if ${DEBUG} == "-g"
1041.1SwsLINKFLAGS+=	-X
1051.1SwsSYSTEM_LD_TAIL+=; \
1061.1Sws		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1071.1Sws		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1081.1Sws.else
1091.1SwsLINKFLAGS+=	-S
1101.1Sws.endif
1111.1Sws
1121.1Sws%LOAD
1131.1Sws
1141.1Swsassym.h: genassym
1151.1Sws	./genassym > assym.h
1161.1Sws
1171.1Swsgenassym: genassym.o
1181.1Sws	${HOSTED_CC} -o $@ genassym.o
1191.1Sws
1201.1Swsgenassym.o: ${PPC}/powerpc/genassym.c
1211.1Sws	${HOSTED_C}
1221.1Sws
1231.1Swsparam.c: $S/conf/param.c
1241.1Sws	rm -f param.c
1251.1Sws	cp $S/conf/param.c .
1261.1Sws
1271.1Swsparam.o: param.c Makefile
1281.1Sws	${NORMAL_C}
1291.1Sws
1301.1Swsioconf.o: ioconf.c
1311.1Sws	${NORMAL_C}
1321.1Sws
1331.1Swsnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1341.1Sws	sh $S/conf/newvers.sh
1351.1Sws	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1361.1Sws
1371.5Smycroftclean: cleankernel
1381.5Smycroftcleankernel:
1391.1Sws	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1401.1Sws		[Ee]rrs linterrs makelinks genassym genassym.o assym.h
1411.1Sws
1421.1Swslint:
1431.3Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1441.4Sperry		${PPC}/powerpc/Locore.c ${CFILES} \
1451.1Sws		ioconf.c param.c | \
1461.1Sws		grep -v 'static function .* unused'
1471.1Sws
1481.1Swstags:
1491.1Sws	@echo "see $S/kern/Makefile for tags"
1501.1Sws
1511.1Swslinks:
1521.1Sws	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1531.1Sws	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1541.1Sws	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1551.1Sws	  sort -u | comm -23 - dontlink | \
1561.1Sws	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1571.1Sws	sh makelinks && rm -f dontlink
1581.1Sws
1591.1SwsSRCS=	${PPC}/powerpc/locore.S \
1601.1Sws	param.c ioconf.c ${CFILES} ${SFILES}
1611.1Swsdepend:: .depend
1621.1Sws.depend: ${SRCS} assym.h param.c
1631.1Sws	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${PPC}/powerpc/locore.S
1641.1Sws	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1651.1Sws.if ${SFILES} != ""
1661.1Sws	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1671.1Sws.endif
1681.1Sws	${MKDEP} -a ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} \
1691.1Sws	    ${PPC}/powerpc/genassym.c
1701.1Sws
1711.1Sws# depend on root or device configuration
1721.1Swsautoconf.o conf.o: Makefile
1731.1Sws
1741.1Sws# depend on network or filesystem configuration
1751.1Swsuipc_proto.o vfs_conf.o: Makefile
1761.1Sws
1771.1Sws# depend on maxusers
1781.1Swsgenassym.o machdep.o: Makefile
1791.1Sws
1801.1Sws# depend on CPU configuration
1811.1Swslocore.o machdep.o: Makefile
1821.1Sws
1831.1Sws
1841.1Swslocore.o: ${PPC}/powerpc/locore.S assym.h
1851.1Sws	${NORMAL_S}
1861.1Sws
1871.1Sws%RULES
188