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