Makefile.alpha revision 1.29
11.29Scgd#	$NetBSD: Makefile.alpha,v 1.29 1997/01/21 23:37:10 cgd 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.13SmycroftLD?=	ld
261.19SmycroftMKDEP?=	mkdep
271.24SmycroftSTRIP?=	strip
281.27SjonathanCOPTS?= 	-O2
291.1Scgd
301.1Scgd# source tree is located via $S relative to the compilation directory
311.23Smycroft.ifndef S
321.19SmycroftS!=	cd ../../../..; pwd
331.23Smycroft.endif
341.19SmycroftALPHA=	$S/arch/alpha
351.1Scgd
361.20SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
371.21SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
381.21Smycroft		-Dalpha
391.26ScgdCWARNFLAGS?=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
401.28Scgd		-Wno-format
411.27SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -mno-fp-regs
421.25ScgdAFLAGS=		-traditional -D_LOCORE
431.29ScgdLOADADDRESS?=	fffffc0000230000
441.29ScgdLINKFLAGS=	-N -Ttext ${LOADADDRESS} -e __start -G 4
451.24SmycroftSTRIPFLAGS=	-g -X -x
461.24Smycroft
471.24SmycroftHOSTED_CC=	${CC}
481.24SmycroftHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
491.24SmycroftHOSTED_CFLAGS=	${CFLAGS}
501.1Scgd
511.1Scgd### find out what to use for libkern
521.1Scgd.include "$S/lib/libkern/Makefile.inc"
531.1Scgd.ifndef PROF
541.1ScgdLIBKERN=	${KERNLIB}
551.1Scgd.else
561.1ScgdLIBKERN=	${KERNLIB_PROF}
571.1Scgd.endif
581.1Scgd
591.5Schristos### find out what to use for libcompat
601.5Schristos.include "$S/compat/common/Makefile.inc"
611.5Schristos.ifndef PROF
621.5SchristosLIBCOMPAT=	${COMPATLIB}
631.5Schristos.else
641.5SchristosLIBCOMPAT=	${COMPATLIB_PROF}
651.5Schristos.endif
661.5Schristos
671.21Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
681.21Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
691.1Scgd
701.10SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
711.25ScgdNORMAL_S=	${CPP} ${AFLAGS} ${CPPFLAGS} $< | sed -e 's,^\#.*,,' | ${AS} -o ${.TARGET}
721.1Scgd
731.24SmycroftHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
741.20Smycroft
751.1Scgd%OBJS
761.1Scgd
771.1Scgd%CFILES
781.1Scgd
791.10Smycroft%SFILES
801.10Smycroft
811.1Scgd# load lines for config "xxx" will be emitted as:
821.1Scgd# xxx: ${SYSTEM_DEP} swapxxx.o
831.1Scgd#	${SYSTEM_LD_HEAD}
841.1Scgd#	${SYSTEM_LD} swapxxx.o
851.1Scgd#	${SYSTEM_LD_TAIL}
861.10SmycroftSYSTEM_OBJ=	locore.o \
871.14Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
881.1ScgdSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
891.10SmycroftSYSTEM_LD_HEAD=	@rm -f $@
901.10SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
911.10Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
921.1ScgdSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
931.10Smycroft
941.10SmycroftDEBUG?=
951.8Scgd.if ${DEBUG} == "-g"
961.10SmycroftLINKFLAGS+=	-X
971.10SmycroftSYSTEM_LD_TAIL+=; \
981.10Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
991.24Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1001.8Scgd.else
1011.19SmycroftLINKFLAGS+=	-S
1021.8Scgd.endif
1031.1Scgd
1041.1Scgd%LOAD
1051.1Scgd
1061.10Smycroftassym.h: genassym
1071.10Smycroft	./genassym >assym.h
1081.10Smycroft
1091.10Smycroftgenassym: genassym.o
1101.10Smycroft	${CC} -o $@ genassym.o
1111.10Smycroft
1121.10Smycroftgenassym.o: ${ALPHA}/alpha/genassym.c
1131.21Smycroft	${HOSTED_C}
1141.10Smycroft
1151.10Smycroftparam.c: $S/conf/param.c
1161.10Smycroft	rm -f param.c
1171.10Smycroft	cp $S/conf/param.c .
1181.1Scgd
1191.10Smycroftparam.o: param.c Makefile
1201.21Smycroft	${NORMAL_C}
1211.1Scgd
1221.10Smycroftioconf.o: ioconf.c
1231.10Smycroft	${NORMAL_C}
1241.1Scgd
1251.10Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1261.10Smycroft	sh $S/conf/newvers.sh
1271.10Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1281.1Scgd
1291.1Scgd
1301.10Smycroftclean::
1311.14Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1321.10Smycroft	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
1331.1Scgd
1341.10Smycroftlint:
1351.21Smycroft	@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \
1361.10Smycroft	    ${ALPHA}/alpha/Locore.c ${CFILES} ${ALPHA}/alpha/swapgeneric.c \
1371.10Smycroft	    ioconf.c param.c | \
1381.10Smycroft	    grep -v 'static function .* unused'
1391.1Scgd
1401.10Smycrofttags:
1411.10Smycroft	@echo "see $S/kern/Makefile for tags"
1421.1Scgd
1431.1Scgdlinks:
1441.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1451.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1461.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1471.1Scgd	  sort -u | comm -23 - dontlink | \
1481.10Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1491.1Scgd	sh makelinks && rm -f dontlink
1501.1Scgd
1511.10SmycroftSRCS=	${ALPHA}/alpha/locore.s \
1521.14Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1531.15Smycroftdepend:: .depend
1541.14Scgd.depend: ${SRCS} assym.h param.c
1551.19Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ALPHA}/alpha/locore.s
1561.19Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1571.19Smycroft	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1581.24Smycroft	${MKDEP} -a ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} \
1591.24Smycroft	    ${ALPHA}/alpha/genassym.c
1601.10Smycroft
1611.1Scgd
1621.10Smycroft# depend on root or device configuration
1631.10Smycroftautoconf.o conf.o: Makefile
1641.10Smycroft 
1651.10Smycroft# depend on network or filesystem configuration 
1661.10Smycroftuipc_proto.o vfs_conf.o: Makefile 
1671.10Smycroft
1681.10Smycroft# depend on maxusers
1691.10Smycroftgenassym.o machdep.o: Makefile
1701.1Scgd
1711.10Smycroft# depend on CPU configuration 
1721.10Smycroftclock.o machdep.o apecs.o cia.o lca.o ioasic.o scc.o icasic.o: Makefile
1731.1Scgd
1741.1Scgd
1751.10Smycroftlocore.o: ${ALPHA}/alpha/locore.s assym.h
1761.10Smycroft	${NORMAL_S}
1771.1Scgd
1781.1Scgd%RULES
179