Makefile.powerpc revision 1.1
11.1Sws#	$NetBSD: Makefile.powerpc,v 1.1 1996/09/30 16:34:18 ws 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.1Sws
321.1Sws# source tree is located via $S relative to the compilation directory
331.1Sws.ifndef	S
341.1SwsS!=	cd ../../../..; pwd
351.1Sws.endif
361.1SwsPPC=	$S/arch/powerpc
371.1Sws
381.1SwsINCLUDES=	-I. -I$S/arch -I$S -nostdinc
391.1SwsCPPFLAGS=	${INCLUDES} ${IDENT} -D_KERNEL \
401.1Sws		-Dpowerpc
411.1SwsCWARNFLAGS=	-Werror -Wreturn-type
421.1SwsCFLAGS=		${DEBUG} ${CWARNFLAGS} -O2 -msoft-float
431.1SwsAFLAGS=		-D_LOCORE
441.1SwsLINKFLAGS=	-N -Ttext 100000 -e start
451.1SwsSTRIPFLAGS=	-d
461.1Sws
471.1SwsHOSTD_CC=	${CC}
481.1SwsHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
491.1SwsHOSTED_CFLAGS=	${CFLAGS}
501.1Sws
511.1Sws### find out what to use for libkern
521.1Sws.include "$S/lib/libkern/Makefile.inc"
531.1Sws.ifndef PROF
541.1SwsLIBKERN=	${KERNLIB}
551.1Sws.else
561.1SwsLIBKERN=	${KERNLIB_PROF}
571.1Sws.endif
581.1Sws
591.1Sws### find out what to use for libcompat
601.1Sws.include "$S/compat/common/Makefile.inc"
611.1Sws.ifndef PROF
621.1SwsLIBCOMPAT=	${COMPATLIB}
631.1Sws.else
641.1SwsLIBCOMPAT=	${COMPATLIB_PROF}
651.1Sws.endif
661.1Sws
671.1Sws# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
681.1Sws# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
691.1Sws
701.1SwsNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
711.1Sws
721.1SwsNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
731.1Sws
741.1SwsHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
751.1Sws
761.1Sws#.c.o:
771.1Sws#	${NORMAL_C}
781.1Sws#
791.1Sws#.S.o:
801.1Sws#	${NORMAL_S}
811.1Sws
821.1Sws%OBJS
831.1Sws
841.1Sws%CFILES
851.1Sws
861.1Sws%SFILES
871.1Sws
881.1Sws# load lines for config "xxx" will be emitted as:
891.1Sws# xxx: ${SYSTEM_DEP} swapxxx.o
901.1Sws#	${SYSTEM_LD_HEAD}
911.1Sws#	${SYSTEM_LD} swapxxx.o
921.1Sws#	${SYSTEM_LD_TAIL}
931.1SwsSYSTEM_OBJ=	locore.o \
941.1Sws		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
951.1SwsSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
961.1SwsSYSTEM_LD_HEAD=	rm -f $@
971.1SwsSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
981.1Sws		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
991.1SwsSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1001.1Sws
1011.1SwsDEBUG?=
1021.1Sws.if ${DEBUG} == "-g"
1031.1SwsLINKFLAGS+=	-X
1041.1SwsSYSTEM_LD_TAIL+=; \
1051.1Sws		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1061.1Sws		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1071.1Sws.else
1081.1SwsLINKFLAGS+=	-S
1091.1Sws.endif
1101.1Sws
1111.1Sws%LOAD
1121.1Sws
1131.1Swsassym.h: genassym
1141.1Sws	./genassym > assym.h
1151.1Sws
1161.1Swsgenassym: genassym.o
1171.1Sws	${HOSTED_CC} -o $@ genassym.o
1181.1Sws
1191.1Swsgenassym.o: ${PPC}/powerpc/genassym.c
1201.1Sws	${HOSTED_C}
1211.1Sws
1221.1Swsparam.c: $S/conf/param.c
1231.1Sws	rm -f param.c
1241.1Sws	cp $S/conf/param.c .
1251.1Sws
1261.1Swsparam.o: param.c Makefile
1271.1Sws	${NORMAL_C}
1281.1Sws
1291.1Swsioconf.o: ioconf.c
1301.1Sws	${NORMAL_C}
1311.1Sws
1321.1Swsnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1331.1Sws	sh $S/conf/newvers.sh
1341.1Sws	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1351.1Sws
1361.1Swsclean::
1371.1Sws	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1381.1Sws		[Ee]rrs linterrs makelinks genassym genassym.o assym.h
1391.1Sws
1401.1Swslint:
1411.1Sws	@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \
1421.1Sws		${PPC}/powerpc/Locore.c ${CFILES} ${PPC}/powerpc/swapgeneric.c \
1431.1Sws		ioconf.c param.c | \
1441.1Sws		grep -v 'static function .* unused'
1451.1Sws
1461.1Swstags:
1471.1Sws	@echo "see $S/kern/Makefile for tags"
1481.1Sws
1491.1Swslinks:
1501.1Sws	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1511.1Sws	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1521.1Sws	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1531.1Sws	  sort -u | comm -23 - dontlink | \
1541.1Sws	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1551.1Sws	sh makelinks && rm -f dontlink
1561.1Sws
1571.1SwsSRCS=	${PPC}/powerpc/locore.S \
1581.1Sws	param.c ioconf.c ${CFILES} ${SFILES}
1591.1Swsdepend:: .depend
1601.1Sws.depend: ${SRCS} assym.h param.c
1611.1Sws	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${PPC}/powerpc/locore.S
1621.1Sws	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1631.1Sws.if ${SFILES} != ""
1641.1Sws	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1651.1Sws.endif
1661.1Sws	${MKDEP} -a ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} \
1671.1Sws	    ${PPC}/powerpc/genassym.c
1681.1Sws
1691.1Sws# depend on root or device configuration
1701.1Swsautoconf.o conf.o: Makefile
1711.1Sws
1721.1Sws# depend on network or filesystem configuration
1731.1Swsuipc_proto.o vfs_conf.o: Makefile
1741.1Sws
1751.1Sws# depend on maxusers
1761.1Swsgenassym.o machdep.o: Makefile
1771.1Sws
1781.1Sws# depend on CPU configuration
1791.1Swslocore.o machdep.o: Makefile
1801.1Sws
1811.1Sws
1821.1Swslocore.o: ${PPC}/powerpc/locore.S assym.h
1831.1Sws	${NORMAL_S}
1841.1Sws
1851.1Sws%RULES
186