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