Makefile.alpha revision 1.32
1#	$NetBSD: Makefile.alpha,v 1.32 1997/02/04 05:08:27 perry Exp $
2
3# Makefile for NetBSD
4#
5# This makefile is constructed from a machine description:
6#	config machineid
7# Most changes should be made in the machine description
8#	/sys/arch/alpha/conf/``machineid''
9# after which you should do
10#	config machineid
11# Machine generic makefile changes should be made in
12#	/sys/arch/alpha/conf/Makefile.alpha
13# after which config should be rerun for all machines of that type.
14#
15# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
16#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
17#
18# -DTRACE	compile in kernel tracing hooks
19# -DQUOTA	compile in file system quotas
20
21# DEBUG is set to -g if debugging.
22# PROF is set to -pg if profiling.
23
24CC?=	cc
25LD?=	ld
26MKDEP?=	mkdep
27STRIP?=	strip
28COPTS?= 	-O2
29
30# source tree is located via $S relative to the compilation directory
31.ifndef S
32S!=	cd ../../../..; pwd
33.endif
34ALPHA=	$S/arch/alpha
35
36INCLUDES=	-I. -I$S/arch -I$S -nostdinc
37CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
38		-Dalpha
39CWARNFLAGS?=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
40		-Wno-format
41CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -mno-fp-regs
42AFLAGS=		-traditional -D_LOCORE
43LOADADDRESS?=	fffffc0000230000
44LINKFLAGS=	-N -Ttext ${LOADADDRESS} -e __start -G 4
45STRIPFLAGS=	-g -X -x
46
47HOSTED_CC=	${CC}
48HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
49HOSTED_CFLAGS=	${CFLAGS}
50
51### find out what to use for libkern
52.include "$S/lib/libkern/Makefile.inc"
53.ifndef PROF
54LIBKERN=	${KERNLIB}
55.else
56LIBKERN=	${KERNLIB_PROF}
57.endif
58
59### find out what to use for libcompat
60.include "$S/compat/common/Makefile.inc"
61.ifndef PROF
62LIBCOMPAT=	${COMPATLIB}
63.else
64LIBCOMPAT=	${COMPATLIB_PROF}
65.endif
66
67# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
68# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
69
70NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
71NORMAL_S=	${CPP} ${AFLAGS} ${CPPFLAGS} $< | sed -e 's,^\#.*,,' | ${AS} -o ${.TARGET}
72
73HOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
74
75%OBJS
76
77%CFILES
78
79%SFILES
80
81# load lines for config "xxx" will be emitted as:
82# xxx: ${SYSTEM_DEP} swapxxx.o
83#	${SYSTEM_LD_HEAD}
84#	${SYSTEM_LD} swapxxx.o
85#	${SYSTEM_LD_TAIL}
86SYSTEM_OBJ=	locore.o \
87		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
88SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
89SYSTEM_LD_HEAD=	@rm -f $@
90SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
91		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
92SYSTEM_LD_TAIL=	@size $@; chmod 755 $@
93
94DEBUG?=
95.if ${DEBUG} == "-g"
96LINKFLAGS+=	-X
97SYSTEM_LD_TAIL+=; \
98		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
99		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
100.else
101LINKFLAGS+=	-S
102.endif
103
104%LOAD
105
106assym.h: genassym
107	./genassym >assym.h
108
109genassym: genassym.o
110	${CC} -o $@ genassym.o
111
112genassym.o: ${ALPHA}/alpha/genassym.c
113	${HOSTED_C}
114
115param.c: $S/conf/param.c
116	rm -f param.c
117	cp $S/conf/param.c .
118
119param.o: param.c Makefile
120	${NORMAL_C}
121
122ioconf.o: ioconf.c
123	${NORMAL_C}
124
125newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
126	sh $S/conf/newvers.sh
127	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
128
129
130clean: cleankernel
131cleankernel:
132	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
133	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
134
135lint:
136	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
137	    ${ALPHA}/alpha/Locore.c ${CFILES} \
138	    ioconf.c param.c | \
139	    grep -v 'static function .* unused'
140
141tags:
142	@echo "see $S/kern/Makefile for tags"
143
144links:
145	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
146	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
147	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
148	  sort -u | comm -23 - dontlink | \
149	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
150	sh makelinks && rm -f dontlink
151
152SRCS=	${ALPHA}/alpha/locore.s \
153	param.c ioconf.c ${CFILES} ${SFILES}
154depend: .depend
155.depend: ${SRCS} assym.h param.c
156	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ALPHA}/alpha/locore.s
157	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
158	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
159	${MKDEP} -a ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} \
160	    ${ALPHA}/alpha/genassym.c
161
162
163# depend on root or device configuration
164autoconf.o conf.o: Makefile
165 
166# depend on network or filesystem configuration 
167uipc_proto.o vfs_conf.o: Makefile 
168
169# depend on maxusers
170genassym.o machdep.o: Makefile
171
172# depend on CPU configuration 
173clock.o machdep.o apecs.o cia.o lca.o ioasic.o scc.o icasic.o: Makefile
174
175
176locore.o: ${ALPHA}/alpha/locore.s assym.h
177	${NORMAL_S}
178
179%RULES
180