Makefile.alpha revision 1.7
1#	$NetBSD: Makefile.alpha,v 1.7 1995/09/19 23:28:06 thorpej 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/conf/``machineid''
9# after which you should do
10#	 config machineid
11# Machine generic makefile changes should be made in
12#	/sys/conf/Makefile.``machinetype''
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
24AS?=	as
25AWK?=	awk
26CC?=	cc
27CPP?=	cpp
28LD?=	ld
29TOUCH?=	touch -f -c
30
31# source tree is located via $S relative to the compilation directory
32S=	../../../..
33ALPHA=	../..
34
35INCLUDES= -I. -I$S/arch -I$S -I$S/sys
36COPTS=	${INCLUDES} ${IDENT} -D_KERNEL
37CFLAGS=	-Werror -fno-builtin -mno-fp-regs ${DEBUG} ${COPTS} -Dalpha
38AFLAGS=	${COPTS}
39
40### find out what to use for libkern
41.include "$S/lib/libkern/Makefile.inc"
42.ifndef PROF
43LIBKERN=	${KERNLIB}
44.else
45LIBKERN=	${KERNLIB_PROF}
46.endif
47
48### find out what to use for libcompat
49.include "$S/compat/common/Makefile.inc"
50.ifndef PROF
51LIBCOMPAT=	${COMPATLIB}
52.else
53LIBCOMPAT=	${COMPATLIB_PROF}
54.endif
55
56# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
57# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
58# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
59# is marked as config-dependent.
60
61NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
62NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
63NORMAL_S=	rm -f $*.c; ln -s $< $*.c; \
64		${CC} ${AFLAGS} -I${ALPHA}/alpha -E $*.c > $*.i; \
65		${AS} -o $@ $*.i; rm -f $*.c $*.i
66NORMAL_S_C=	rm -f $*.c; ln -s $< $*.c; \
67		${CC} ${AFLAGS} ${PARAM} -I${ALPHA}/alpha -E $*.c > $*.i; \
68		${AS} -o $@ $*.i; rm -f $*.c $*.i
69
70%OBJS
71
72%CFILES
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}
79DEBUG?=
80.if ${DEBUG} == "-g"
81LDX=-X
82.else
83LDX=-x
84.endif
85LDFLAGS= ${LDX} -G 4 -N -e __start -Ttext fffffc0000230000
86SYSTEM_OBJ=	locore.o vnode_if.o ${OBJS} param.o ioconf.o ${LIBKERN} \
87		${LIBCOMPAT}
88SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
89SYSTEM_LD_HEAD=	@echo loading $@; rm -f $@
90SYSTEM_LD=	-@echo ${LD} ${LDFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o ${XXX}; \
91		${LD} ${LDFLAGS} -o $@ ${SYSTEM_OBJ} vers.o ${XXX}
92SYSTEM_LD_TAIL=	@size $@; chmod 755 $@
93#.if ${DEBUG} == "-g"
94#SYSTEM_LD_TAIL+=; echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
95#		echo strip -d $@; strip -d $@
96#.endif
97
98%LOAD
99
100newvers:
101	sh $S/conf/newvers.sh
102	${CC} ${CFLAGS} -c vers.c
103
104clean::
105	rm -f eddep *netbsd netbsd.gdb tags tags1 vnode_if.[ch] *.[io] \
106		[a-z]*.s Errs errs linterrs makelinks genassym
107
108
109locore.o: ${ALPHA}/alpha/locore.s ${ALPHA}/alpha/pal.s \
110	  ${ALPHA}/alpha/prom_disp.s assym.s
111	${NORMAL_S_C}
112
113# depend on maxusers
114assym.s: Makefile
115
116./assym.s: assym.s
117assym.s: genassym
118	./genassym >assym.s
119
120genassym: genassym.o
121	${CC} -o $@ genassym.o
122
123genassym.o: ${ALPHA}/alpha/genassym.c
124	${CC} -c ${CFLAGS} ${PARAM} $<
125
126SRCS= ${CFILES} ${ALPHA}/alpha/genassym.c ioconf.c param.c vnode_if.c
127depend: .depend
128.depend: ${SRCS} assym.s
129	mkdep ${COPTS} ${SRCS}
130	mkdep -a -p ${COPTS} ${ALPHA}/alpha/genassym.c
131
132links:
133	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
134	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
135	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
136	  sort -u | comm -23 - dontlink | \
137	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
138	sh makelinks && rm -f dontlink
139
140tags: depend
141	sh $S/conf/systags.sh
142	rm -f tags1
143	sed -e 's,	../,	,' tags > tags1
144
145ioconf.o: ioconf.c
146	${CC} -c ${CFLAGS} ioconf.c
147
148param.c: $S/conf/param.c
149	rm -f param.c
150	cp $S/conf/param.c .
151
152param.o: param.c Makefile
153	${CC} -c ${CFLAGS} ${PARAM} param.c
154
155vnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
156	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
157
158%RULES
159