Makefile.alpha revision 1.3
1#	$NetBSD: Makefile.alpha,v 1.3 1995/04/22 12:44:08 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/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} -DKERNEL -D_KERNEL
37CFLAGS=	-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# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
49# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
50# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
51# is marked as config-dependent.
52
53NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
54NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
55NORMAL_S=	rm -f $*.c; ln -s $< $*.c; \
56		${CC} ${AFLAGS} -I${ALPHA}/alpha -E $*.c > $*.i; \
57		${AS} -o $@ $*.i; rm -f $*.c $*.i
58NORMAL_S_C=	rm -f $*.c; ln -s $< $*.c; \
59		${CC} ${AFLAGS} ${PARAM} -I${ALPHA}/alpha -E $*.c > $*.i; \
60		${AS} -o $@ $*.i; rm -f $*.c $*.i
61
62%OBJS
63
64%CFILES
65
66# load lines for config "xxx" will be emitted as:
67# xxx: ${SYSTEM_DEP} swapxxx.o
68#	${SYSTEM_LD_HEAD}
69#	${SYSTEM_LD} swapxxx.o
70#	${SYSTEM_LD_TAIL}
71DEBUG?=
72.if ${DEBUG} == "-g"
73LDX=-X
74.else
75LDX=-x
76.endif
77LDFLAGS= ${LDX} -G 4 -N -e __start -Ttext fffffc0000230000
78SYSTEM_OBJ=	locore.o vnode_if.o ${OBJS} param.o ioconf.o ${LIBKERN}
79SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
80SYSTEM_LD_HEAD=	@echo loading $@; rm -f $@
81SYSTEM_LD=	-@echo ${LD} ${LDFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o ${XXX}; \
82		${LD} ${LDFLAGS} -o $@ ${SYSTEM_OBJ} vers.o ${XXX}
83SYSTEM_LD_TAIL=	@size $@; chmod 755 $@
84#.if ${DEBUG} == "-g"
85#SYSTEM_LD_TAIL+=; echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
86#		echo strip -d $@; strip -d $@
87#.endif
88
89%LOAD
90
91newvers:
92	sh $S/conf/newvers.sh
93	${CC} ${CFLAGS} -c vers.c
94
95clean:
96	rm -f eddep *netbsd netbsd.gdb tags tags1 vnode_if.[ch] *.[io] \
97		[a-z]*.s Errs errs linterrs makelinks genassym
98
99
100locore.o: ${ALPHA}/alpha/locore.s ${ALPHA}/alpha/pal.s \
101	  ${ALPHA}/alpha/prom_disp.s assym.s
102	${NORMAL_S_C}
103
104# depend on maxusers
105assym.s: Makefile
106
107./assym.s: assym.s
108assym.s: genassym
109	./genassym >assym.s
110
111genassym: genassym.o
112	${CC} -o $@ genassym.o
113
114genassym.o: ${ALPHA}/alpha/genassym.c
115	${CC} -c ${CFLAGS} ${PARAM} $<
116
117SRCS= ${CFILES} ${ALPHA}/alpha/genassym.c ioconf.c param.c vnode_if.c
118depend: .depend
119.depend: ${SRCS} assym.s
120	mkdep ${COPTS} ${SRCS}
121	mkdep -a -p ${COPTS} ${ALPHA}/alpha/genassym.c
122
123links:
124	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
125	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
126	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
127	  sort -u | comm -23 - dontlink | \
128	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
129	sh makelinks && rm -f dontlink
130
131tags: depend
132	sh $S/conf/systags.sh
133	rm -f tags1
134	sed -e 's,	../,	,' tags > tags1
135
136ioconf.o: ioconf.c
137	${CC} -c ${CFLAGS} ioconf.c
138
139param.c: $S/conf/param.c
140	rm -f param.c
141	cp $S/conf/param.c .
142
143param.o: param.c Makefile
144	${CC} -c ${CFLAGS} ${PARAM} param.c
145
146vnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
147	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
148
149%RULES
150