Makefile.alpha revision 1.39
11.39Sthorpej# $NetBSD: Makefile.alpha,v 1.39 1997/11/12 22:25:31 thorpej Exp $
21.10Smycroft
31.1Scgd# Makefile for NetBSD
41.1Scgd#
51.1Scgd# This makefile is constructed from a machine description:
61.1Scgd#	config machineid
71.1Scgd# Most changes should be made in the machine description
81.10Smycroft#	/sys/arch/alpha/conf/``machineid''
91.1Scgd# after which you should do
101.10Smycroft#	config machineid
111.1Scgd# Machine generic makefile changes should be made in
121.10Smycroft#	/sys/arch/alpha/conf/Makefile.alpha
131.1Scgd# after which config should be rerun for all machines of that type.
141.1Scgd#
151.1Scgd# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
161.1Scgd#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
171.1Scgd#
181.1Scgd# -DTRACE	compile in kernel tracing hooks
191.1Scgd# -DQUOTA	compile in file system quotas
201.1Scgd
211.1Scgd# DEBUG is set to -g if debugging.
221.1Scgd# PROF is set to -pg if profiling.
231.1Scgd
241.13SmycroftCC?=	cc
251.34ScgdCPP?=	cpp
261.13SmycroftLD?=	ld
271.39SthorpejLORDER?=lorder
281.19SmycroftMKDEP?=	mkdep
291.39SthorpejNM?=	nm
301.34ScgdSIZE?=	size
311.24SmycroftSTRIP?=	strip
321.39SthorpejTSORT?=	tsort -q
331.1Scgd
341.1Scgd# source tree is located via $S relative to the compilation directory
351.23Smycroft.ifndef S
361.19SmycroftS!=	cd ../../../..; pwd
371.23Smycroft.endif
381.19SmycroftALPHA=	$S/arch/alpha
391.1Scgd
401.20SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
411.21SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
421.21Smycroft		-Dalpha
431.34ScgdCOPTS?=		-O2
441.26ScgdCWARNFLAGS?=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
451.28Scgd		-Wno-format
461.27SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -mno-fp-regs
471.25ScgdAFLAGS=		-traditional -D_LOCORE
481.29ScgdLOADADDRESS?=	fffffc0000230000
491.38SrossLINKFLAGS=	-N -Ttext ${LOADADDRESS} -e __transfer -G 4
501.24SmycroftSTRIPFLAGS=	-g -X -x
511.24Smycroft
521.1Scgd### find out what to use for libkern
531.1Scgd.include "$S/lib/libkern/Makefile.inc"
541.1Scgd.ifndef PROF
551.1ScgdLIBKERN=	${KERNLIB}
561.1Scgd.else
571.1ScgdLIBKERN=	${KERNLIB_PROF}
581.1Scgd.endif
591.1Scgd
601.5Schristos### find out what to use for libcompat
611.5Schristos.include "$S/compat/common/Makefile.inc"
621.5Schristos.ifndef PROF
631.5SchristosLIBCOMPAT=	${COMPATLIB}
641.5Schristos.else
651.5SchristosLIBCOMPAT=	${COMPATLIB_PROF}
661.5Schristos.endif
671.5Schristos
681.21Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
691.21Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
701.1Scgd
711.10SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
721.25ScgdNORMAL_S=	${CPP} ${AFLAGS} ${CPPFLAGS} $< | sed -e 's,^\#.*,,' | ${AS} -o ${.TARGET}
731.1Scgd
741.1Scgd%OBJS
751.1Scgd
761.1Scgd%CFILES
771.1Scgd
781.10Smycroft%SFILES
791.10Smycroft
801.1Scgd# load lines for config "xxx" will be emitted as:
811.1Scgd# xxx: ${SYSTEM_DEP} swapxxx.o
821.1Scgd#	${SYSTEM_LD_HEAD}
831.1Scgd#	${SYSTEM_LD} swapxxx.o
841.1Scgd#	${SYSTEM_LD_TAIL}
851.38SrossSYSTEM_OBJ=	locore.o transfer.o \
861.14Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
871.1ScgdSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
881.10SmycroftSYSTEM_LD_HEAD=	@rm -f $@
891.10SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
901.10Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
911.34ScgdSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
921.10Smycroft
931.10SmycroftDEBUG?=
941.8Scgd.if ${DEBUG} == "-g"
951.10SmycroftLINKFLAGS+=	-X
961.10SmycroftSYSTEM_LD_TAIL+=; \
971.10Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
981.24Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
991.8Scgd.else
1001.19SmycroftLINKFLAGS+=	-S
1011.8Scgd.endif
1021.1Scgd
1031.1Scgd%LOAD
1041.1Scgd
1051.34Scgd# Use awk to cross-build assym.h from the genassym.s file.
1061.37Sgwrassym.h: genassym.o $S/kern/genassym.awk
1071.37Sgwr	awk -f $S/kern/genassym.awk < genassym.s > $@
1081.34Scgd
1091.34Scgd# The above rule lists genassym.o as a prerequisite so that the
1101.34Scgd# generated .depend rule is effective, even though we actually
1111.34Scgd# use genassym.s instead.   This always creates both.
1121.10Smycroftgenassym.o: ${ALPHA}/alpha/genassym.c
1131.34Scgd	${CC} ${CPPFLAGS} -S $<
1141.34Scgd	${CC} -c $*.s
1151.10Smycroft
1161.10Smycroftparam.c: $S/conf/param.c
1171.10Smycroft	rm -f param.c
1181.10Smycroft	cp $S/conf/param.c .
1191.1Scgd
1201.10Smycroftparam.o: param.c Makefile
1211.21Smycroft	${NORMAL_C}
1221.1Scgd
1231.10Smycroftioconf.o: ioconf.c
1241.10Smycroft	${NORMAL_C}
1251.1Scgd
1261.10Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1271.10Smycroft	sh $S/conf/newvers.sh
1281.10Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1291.1Scgd
1301.1Scgd
1311.36Schristos__CLEANKERNEL: .USE
1321.36Schristos	@echo "${.TARGET}ing the kernel objects"
1331.14Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1341.36Schristos	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1351.36Schristos
1361.36Schristos__CLEANDEPEND: .USE
1371.36Schristos	rm -f .depend
1381.36Schristos
1391.36Schristosclean: __CLEANKERNEL
1401.36Schristos
1411.36Schristoscleandir: __CLEANKERNEL __CLEANDEPEND
1421.1Scgd
1431.10Smycroftlint:
1441.31Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1451.32Sperry	    ${ALPHA}/alpha/Locore.c ${CFILES} \
1461.10Smycroft	    ioconf.c param.c | \
1471.10Smycroft	    grep -v 'static function .* unused'
1481.1Scgd
1491.10Smycrofttags:
1501.10Smycroft	@echo "see $S/kern/Makefile for tags"
1511.1Scgd
1521.1Scgdlinks:
1531.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1541.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1551.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1561.1Scgd	  sort -u | comm -23 - dontlink | \
1571.10Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1581.1Scgd	sh makelinks && rm -f dontlink
1591.1Scgd
1601.38SrossSRCS=	${ALPHA}/alpha/locore.s ${ALPHA}/alpha/transfer.s \
1611.14Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1621.30Scgddepend: .depend
1631.14Scgd.depend: ${SRCS} assym.h param.c
1641.35Scgd	${MKDEP} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \
1651.35Scgd	    ${ALPHA}/alpha/locore.s
1661.38Sross	${MKDEP} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \
1671.38Sross	    ${ALPHA}/alpha/transfer.s
1681.19Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1691.35Scgd	${MKDEP} -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${SFILES}
1701.34Scgd	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} ${ALPHA}/alpha/genassym.c
1711.10Smycroft
1721.1Scgd
1731.10Smycroft# depend on root or device configuration
1741.10Smycroftautoconf.o conf.o: Makefile
1751.10Smycroft 
1761.10Smycroft# depend on network or filesystem configuration 
1771.10Smycroftuipc_proto.o vfs_conf.o: Makefile 
1781.10Smycroft
1791.10Smycroft# depend on maxusers
1801.10Smycroftgenassym.o machdep.o: Makefile
1811.1Scgd
1821.10Smycroft# depend on CPU configuration 
1831.10Smycroftclock.o machdep.o apecs.o cia.o lca.o ioasic.o scc.o icasic.o: Makefile
1841.1Scgd
1851.10Smycroftlocore.o: ${ALPHA}/alpha/locore.s assym.h
1861.38Sross	${NORMAL_S}
1871.38Sross
1881.38Srosstransfer.o: ${ALPHA}/alpha/transfer.s
1891.10Smycroft	${NORMAL_S}
1901.1Scgd
1911.1Scgd%RULES
192