Makefile.alpha revision 1.22
1#	$NetBSD: Makefile.alpha,v 1.22 1996/08/20 22:23:01 cgd 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 -g -X -x
28TOUCH?=	touch -f -c
29
30# source tree is located via $S relative to the compilation directory
31S!=	cd ../../../..; pwd
32ALPHA=	$S/arch/alpha
33
34INCLUDES=	-I. -I$S/arch -I$S -nostdinc
35CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
36		-Dalpha
37CWARNFLAGS?=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
38CFLAGS=		${DEBUG} ${CWARNFLAGS} -O2 -mno-fp-regs
39AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
40LINKFLAGS=	-N -Ttext fffffc0000230000 -e __start -G 4
41
42### find out what to use for libkern
43.include "$S/lib/libkern/Makefile.inc"
44.ifndef PROF
45LIBKERN=	${KERNLIB}
46.else
47LIBKERN=	${KERNLIB_PROF}
48.endif
49
50### find out what to use for libcompat
51.include "$S/compat/common/Makefile.inc"
52.ifndef PROF
53LIBCOMPAT=	${COMPATLIB}
54.else
55LIBCOMPAT=	${COMPATLIB_PROF}
56.endif
57
58# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
59# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
60
61NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
62NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
63
64HOSTED_C=	${NORMAL_C:S/^-pg$//:S/^-p$//:S/^-nostdinc$//}
65
66%OBJS
67
68%CFILES
69
70%SFILES
71
72# load lines for config "xxx" will be emitted as:
73# xxx: ${SYSTEM_DEP} swapxxx.o
74#	${SYSTEM_LD_HEAD}
75#	${SYSTEM_LD} swapxxx.o
76#	${SYSTEM_LD_TAIL}
77SYSTEM_OBJ=	locore.o \
78		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
79SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
80SYSTEM_LD_HEAD=	@rm -f $@
81SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
82		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
83SYSTEM_LD_TAIL=	@size $@; chmod 755 $@
84
85DEBUG?=
86.if ${DEBUG} == "-g"
87LINKFLAGS+=	-X
88SYSTEM_LD_TAIL+=; \
89		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
90		echo ${STRIP} $@; ${STRIP} $@
91.else
92LINKFLAGS+=	-S
93.endif
94
95%LOAD
96
97assym.h: genassym
98	./genassym >assym.h
99
100genassym: genassym.o
101	${CC} -o $@ genassym.o
102
103genassym.o: ${ALPHA}/alpha/genassym.c
104	${HOSTED_C}
105
106param.c: $S/conf/param.c
107	rm -f param.c
108	cp $S/conf/param.c .
109
110param.o: param.c Makefile
111	${NORMAL_C}
112
113ioconf.o: ioconf.c
114	${NORMAL_C}
115
116newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
117	sh $S/conf/newvers.sh
118	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
119
120
121clean::
122	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
123	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
124
125lint:
126	@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \
127	    ${ALPHA}/alpha/Locore.c ${CFILES} ${ALPHA}/alpha/swapgeneric.c \
128	    ioconf.c param.c | \
129	    grep -v 'static function .* unused'
130
131tags:
132	@echo "see $S/kern/Makefile for tags"
133
134links:
135	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
136	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
137	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
138	  sort -u | comm -23 - dontlink | \
139	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
140	sh makelinks && rm -f dontlink
141
142SRCS=	${ALPHA}/alpha/locore.s \
143	param.c ioconf.c ${CFILES} ${SFILES}
144depend:: .depend
145.depend: ${SRCS} assym.h param.c
146	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ALPHA}/alpha/locore.s
147	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
148	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
149	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} ${ALPHA}/alpha/genassym.c
150
151
152# depend on root or device configuration
153autoconf.o conf.o: Makefile
154 
155# depend on network or filesystem configuration 
156uipc_proto.o vfs_conf.o: Makefile 
157
158# depend on maxusers
159genassym.o machdep.o: Makefile
160
161# depend on CPU configuration 
162clock.o machdep.o apecs.o cia.o lca.o ioasic.o scc.o icasic.o: Makefile
163
164
165locore.o: ${ALPHA}/alpha/locore.s assym.h
166	${NORMAL_S}
167
168%RULES
169