Makefile.alpha revision 1.2
1#	$NetBSD: Makefile.alpha,v 1.2 1995/03/23 19:46:18 jtc 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
28TOUCH=	touch -f -c
29
30# source tree is located via $S relative to the compilation directory
31S=	../../../..
32ALPHA=	../..
33
34INCLUDES= -I. -I$S/arch -I$S -I$S/sys
35COPTS=	${INCLUDES} ${IDENT} -DKERNEL -D_KERNEL
36.if ${CC} == "cc"
37CFLAGS=	-Wc,-nofloat -D__STDC__ -Dalpha ${DEBUG} ${COPTS}
38AFLAGS=	-D__ALPHA_AS__ ${COPTS}
39.else
40CFLAGS=	-mno-fp-regs ${DEBUG} ${COPTS}
41AFLAGS=	${COPTS}
42.endif
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# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
53# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
54# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
55# is marked as config-dependent.
56
57NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
58NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
59NORMAL_S=	rm -f $*.c; ln -s $< $*.c; \
60		${CC} ${AFLAGS} -I${ALPHA}/alpha -E $*.c > $*.i; \
61		${AS} -o $@ $*.i; rm -f $*.c $*.i
62NORMAL_S_C=	rm -f $*.c; ln -s $< $*.c; \
63		${CC} ${AFLAGS} ${PARAM} -I${ALPHA}/alpha -E $*.c > $*.i; \
64		${AS} -o $@ $*.i; rm -f $*.c $*.i
65
66%OBJS
67
68%CFILES
69
70# load lines for config "xxx" will be emitted as:
71# xxx: ${SYSTEM_DEP} swapxxx.o
72#	${SYSTEM_LD_HEAD}
73#	${SYSTEM_LD} swapxxx.o
74#	${SYSTEM_LD_TAIL}
75DEBUG?=
76.if ${DEBUG} == "-g"
77LDX=-X
78.else
79LDX=-x
80.endif
81.if ${CC} == "cc"
82LDFLAGS= ${LDX} -G 4 -N -w2 -e __start -T fffffc0000230000
83XXX= -lc
84.else
85LDFLAGS= ${LDX} -G 4 -N -e __start -Ttext fffffc0000230000
86XXX=
87.endif
88SYSTEM_OBJ=	locore.o vnode_if.o ${OBJS} param.o ioconf.o ${LIBKERN}
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#SYSTEM_LD_TAIL+=; echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
96#		echo strip -d $@; strip -d $@
97#.endif
98
99%LOAD
100
101newvers:
102	sh $S/conf/newvers.sh
103	${CC} ${CFLAGS} -c vers.c
104
105clean:
106	rm -f eddep *netbsd netbsd.gdb tags tags1 vnode_if.[ch] *.[io] \
107		[a-z]*.s Errs errs linterrs makelinks genassym
108
109
110locore.o: ${ALPHA}/alpha/locore.s ${ALPHA}/alpha/pal.s \
111	  ${ALPHA}/alpha/prom_disp.s assym.s
112	${NORMAL_S_C}
113
114# depend on maxusers
115assym.s: Makefile
116
117./assym.s: assym.s
118assym.s: genassym
119	./genassym >assym.s
120
121genassym: genassym.o
122	${CC} -o $@ genassym.o
123
124genassym.o: ${ALPHA}/alpha/genassym.c
125	${CC} -c ${CFLAGS} ${PARAM} $<
126
127SRCS= ${CFILES} ${ALPHA}/alpha/genassym.c ioconf.c param.c vnode_if.c
128depend: .depend
129.depend: ${SRCS} assym.s
130	mkdep ${COPTS} ${SRCS}
131	mkdep -a -p ${COPTS} ${ALPHA}/alpha/genassym.c
132
133links:
134	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
135	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
136	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
137	  sort -u | comm -23 - dontlink | \
138	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
139	sh makelinks && rm -f dontlink
140
141tags: depend
142	sh $S/conf/systags.sh
143	rm -f tags1
144	sed -e 's,	../,	,' tags > tags1
145
146ioconf.o: ioconf.c
147	${CC} -c ${CFLAGS} ioconf.c
148
149param.c: $S/conf/param.c
150	rm -f param.c
151	cp $S/conf/param.c .
152
153param.o: param.c Makefile
154	${CC} -c ${CFLAGS} ${PARAM} param.c
155
156vnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
157	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
158
159%RULES
160