Makefile.alpha revision 1.59
11.59Sjdolecek# $NetBSD: Makefile.alpha,v 1.59 2000/11/29 12:55:11 jdolecek 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.40SthorpejAR?=	ar
251.40SthorpejAS?=	as
261.13SmycroftCC?=	cc
271.34ScgdCPP?=	cpp
281.13SmycroftLD?=	ld
291.39SthorpejLORDER?=lorder
301.19SmycroftMKDEP?=	mkdep
311.39SthorpejNM?=	nm
321.40SthorpejRANLIB?=ranlib
331.34ScgdSIZE?=	size
341.56StsutsuiSTRIP?=	strip
351.39SthorpejTSORT?=	tsort -q
361.1Scgd
371.1Scgd# source tree is located via $S relative to the compilation directory
381.23Smycroft.ifndef S
391.19SmycroftS!=	cd ../../../..; pwd
401.23Smycroft.endif
411.19SmycroftALPHA=	$S/arch/alpha
421.1Scgd
431.57SthorpejHAVE_EGCS!=	${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 
441.20SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
451.47SthorpejCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -Dalpha
461.34ScgdCOPTS?=		-O2
471.26ScgdCWARNFLAGS?=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
481.49Sthorpej		-Wpointer-arith
491.57Sthorpej# XXX Delete -Wuninitialized for now, since the compiler doesn't
501.57Sthorpej# XXX always get it right.  --thorpej 
511.57SthorpejCWARNFLAGS+=	-Wno-uninitialized
521.57Sthorpej.if (${HAVE_EGCS} != "")
531.42StvCWARNFLAGS+=	-Wno-main
541.42Stv.endif
551.27SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -mno-fp-regs
561.25ScgdAFLAGS=		-traditional -D_LOCORE
571.41SrossLOADADDRESS?=	fffffc0000300000
581.38SrossLINKFLAGS=	-N -Ttext ${LOADADDRESS} -e __transfer -G 4
591.51SrossSTRIPFLAGS=	-g -X
601.52Smrg
611.52Smrg%INCLUDES
621.24Smycroft
631.1Scgd### find out what to use for libkern
641.1Scgd.include "$S/lib/libkern/Makefile.inc"
651.1Scgd.ifndef PROF
661.1ScgdLIBKERN=	${KERNLIB}
671.1Scgd.else
681.1ScgdLIBKERN=	${KERNLIB_PROF}
691.1Scgd.endif
701.1Scgd
711.5Schristos### find out what to use for libcompat
721.5Schristos.include "$S/compat/common/Makefile.inc"
731.5Schristos.ifndef PROF
741.5SchristosLIBCOMPAT=	${COMPATLIB}
751.5Schristos.else
761.5SchristosLIBCOMPAT=	${COMPATLIB_PROF}
771.5Schristos.endif
781.5Schristos
791.21Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
801.21Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
811.1Scgd
821.10SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
831.43SthorpejNOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
841.25ScgdNORMAL_S=	${CPP} ${AFLAGS} ${CPPFLAGS} $< | sed -e 's,^\#.*,,' | ${AS} -o ${.TARGET}
851.1Scgd
861.1Scgd%OBJS
871.1Scgd
881.1Scgd%CFILES
891.1Scgd
901.10Smycroft%SFILES
911.10Smycroft
921.1Scgd# load lines for config "xxx" will be emitted as:
931.1Scgd# xxx: ${SYSTEM_DEP} swapxxx.o
941.1Scgd#	${SYSTEM_LD_HEAD}
951.1Scgd#	${SYSTEM_LD} swapxxx.o
961.1Scgd#	${SYSTEM_LD_TAIL}
971.38SrossSYSTEM_OBJ=	locore.o transfer.o \
981.45Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
991.1ScgdSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1001.10SmycroftSYSTEM_LD_HEAD=	@rm -f $@
1011.10SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1021.10Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1031.34ScgdSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1041.10Smycroft
1051.10SmycroftDEBUG?=
1061.8Scgd.if ${DEBUG} == "-g"
1071.10SmycroftLINKFLAGS+=	-X
1081.10SmycroftSYSTEM_LD_TAIL+=; \
1091.53Scgd		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
1101.56Stsutsui		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
1111.56Stsutsui		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
1121.8Scgd.else
1131.19SmycroftLINKFLAGS+=	-S
1141.8Scgd.endif
1151.1Scgd
1161.1Scgd%LOAD
1171.1Scgd
1181.34Scgd# Use awk to cross-build assym.h from the genassym.s file.
1191.59Sjdolecekassym.h: $S/kern/genassym.sh ${ALPHA}/alpha/genassym.cf
1201.59Sjdolecek	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1211.59Sjdolecek	    < ${ALPHA}/alpha/genassym.cf > assym.h.tmp && \
1221.59Sjdolecek	mv -f assym.h.tmp assym.h
1231.34Scgd
1241.34Scgd# The above rule lists genassym.o as a prerequisite so that the
1251.34Scgd# generated .depend rule is effective, even though we actually
1261.34Scgd# use genassym.s instead.   This always creates both.
1271.10Smycroftgenassym.o: ${ALPHA}/alpha/genassym.c
1281.34Scgd	${CC} ${CPPFLAGS} -S $<
1291.34Scgd	${CC} -c $*.s
1301.10Smycroft
1311.10Smycroftparam.c: $S/conf/param.c
1321.10Smycroft	rm -f param.c
1331.10Smycroft	cp $S/conf/param.c .
1341.1Scgd
1351.10Smycroftparam.o: param.c Makefile
1361.21Smycroft	${NORMAL_C}
1371.1Scgd
1381.10Smycroftioconf.o: ioconf.c
1391.10Smycroft	${NORMAL_C}
1401.1Scgd
1411.10Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1421.10Smycroft	sh $S/conf/newvers.sh
1431.10Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1441.1Scgd
1451.1Scgd
1461.36Schristos__CLEANKERNEL: .USE
1471.36Schristos	@echo "${.TARGET}ing the kernel objects"
1481.14Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1491.36Schristos	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1501.36Schristos
1511.36Schristos__CLEANDEPEND: .USE
1521.36Schristos	rm -f .depend
1531.36Schristos
1541.36Schristosclean: __CLEANKERNEL
1551.36Schristos
1561.44Slukemcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1571.1Scgd
1581.10Smycroftlint:
1591.31Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1601.32Sperry	    ${ALPHA}/alpha/Locore.c ${CFILES} \
1611.10Smycroft	    ioconf.c param.c | \
1621.10Smycroft	    grep -v 'static function .* unused'
1631.1Scgd
1641.10Smycrofttags:
1651.10Smycroft	@echo "see $S/kern/Makefile for tags"
1661.1Scgd
1671.1Scgdlinks:
1681.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1691.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1701.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1711.1Scgd	  sort -u | comm -23 - dontlink | \
1721.10Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1731.1Scgd	sh makelinks && rm -f dontlink
1741.1Scgd
1751.38SrossSRCS=	${ALPHA}/alpha/locore.s ${ALPHA}/alpha/transfer.s \
1761.14Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1771.30Scgddepend: .depend
1781.14Scgd.depend: ${SRCS} assym.h param.c
1791.35Scgd	${MKDEP} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \
1801.35Scgd	    ${ALPHA}/alpha/locore.s
1811.50Sross	${MKDEP} -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \
1821.38Sross	    ${ALPHA}/alpha/transfer.s
1831.19Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1841.48Stron	test -z "${SFILES}" || \
1851.35Scgd	${MKDEP} -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${SFILES}
1861.34Scgd	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} ${ALPHA}/alpha/genassym.c
1871.55Stron
1881.55Strondependall: depend all
1891.10Smycroft
1901.1Scgd
1911.10Smycroft# depend on root or device configuration
1921.10Smycroftautoconf.o conf.o: Makefile
1931.10Smycroft 
1941.10Smycroft# depend on network or filesystem configuration 
1951.10Smycroftuipc_proto.o vfs_conf.o: Makefile 
1961.10Smycroft
1971.10Smycroft# depend on maxusers
1981.10Smycroftgenassym.o machdep.o: Makefile
1991.1Scgd
2001.10Smycroft# depend on CPU configuration 
2011.10Smycroftclock.o machdep.o apecs.o cia.o lca.o ioasic.o scc.o icasic.o: Makefile
2021.1Scgd
2031.10Smycroftlocore.o: ${ALPHA}/alpha/locore.s assym.h
2041.38Sross	${NORMAL_S}
2051.38Sross
2061.38Srosstransfer.o: ${ALPHA}/alpha/transfer.s
2071.10Smycroft	${NORMAL_S}
2081.58Shubertf
2091.58Shubertf# The install target can be redefined by putting a
2101.58Shubertf# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
2111.58ShubertfMACHINE_NAME!=  uname -n
2121.58Shubertfinstall: install-kernel-${MACHINE_NAME}
2131.58Shubertf.if !target(install-kernel-${MACHINE_NAME}})
2141.58Shubertfinstall-kernel-${MACHINE_NAME}:
2151.58Shubertf	rm -f /onetbsd
2161.58Shubertf	ln /netbsd /onetbsd
2171.58Shubertf	cp netbsd /nnetbsd
2181.58Shubertf	mv /nnetbsd /netbsd
2191.58Shubertf.endif
2201.1Scgd
2211.1Scgd%RULES
222