Makefile.vax revision 1.37
1#	$NetBSD: Makefile.vax,v 1.37 1997/11/12 22:26:42 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/arch/vax/conf/``machineid''
9# after which you should do
10#	config machineid
11# Machine generic makefile changes should be made in
12#	/sys/arch/vax/conf/Makefile.vax
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
26LORDER?=lorder
27MKDEP?=	mkdep
28NM?=	nm
29SIZE?=	size
30STRIP?=	strip
31TSORT?=	tsort -q
32COPTS?= -O2
33
34# source tree is located via $S relative to the compilation directory
35.ifndef S
36S!=	cd ../../../..; pwd
37.endif
38VAX=	$S/arch/vax
39
40INCLUDES=	-I. -I$S/arch -I$S -nostdinc
41CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
42		-D_VAX_INLINE_
43CWARNFLAGS=	-Werror
44CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS}
45AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
46LINKFLAGS=	-Z -Ttext 80000000 -e _start
47STRIPFLAGS=	-d
48
49HOSTED_CC=	${CC}
50HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
51HOSTED_CFLAGS=	${CFLAGS}
52
53### find out what to use for libkern
54.include "$S/lib/libkern/Makefile.inc"
55.ifndef PROF
56LIBKERN=	${KERNLIB}
57.else
58LIBKERN=        ${KERNLIB_PROF}
59.endif
60
61### find out what to use for libcompat
62.include "$S/compat/common/Makefile.inc"
63.ifndef PROF
64LIBCOMPAT=      ${COMPATLIB}
65.else
66LIBCOMPAT=      ${COMPATLIB_PROF}
67.endif
68
69# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
70# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
71
72NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
73NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
74
75HOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
76
77%OBJS
78
79%CFILES
80
81%SFILES
82
83# load lines for config "xxx" will be emitted as:
84# xxx: ${SYSTEM_DEP} swapxxx.o
85#	${SYSTEM_LD_HEAD}
86#	${SYSTEM_LD} swapxxx.o
87#	${SYSTEM_LD_TAIL}
88SYSTEM_OBJ=	intvec.o subr.o \
89		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
90SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
91SYSTEM_LD_HEAD=	@rm -f $@
92SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
93		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
94SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
95
96DEBUG?=
97.if ${DEBUG} == "-g"
98LINKFLAGS+=	-X
99SYSTEM_LD_TAIL+=; \
100		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
101		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
102.else
103LINKFLAGS+=	-S
104.endif
105
106%LOAD
107
108assym.h: $S/kern/genassym.sh ${VAX}/vax/genassym.cf
109	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
110	    < ${VAX}/vax/genassym.cf > assym.h.tmp && \
111	    mv -f assym.h.tmp assym.h
112
113param.c: $S/conf/param.c
114	rm -f param.c
115	cp $S/conf/param.c .
116
117param.o: param.c Makefile
118	${NORMAL_C}
119
120ioconf.o: ioconf.c
121	${NORMAL_C}
122
123newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
124	sh $S/conf/newvers.sh
125	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
126
127__CLEANKERNEL: .USE
128	@echo "${.TARGET}ing the kernel objects"
129	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
130	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
131
132__CLEANDEPEND: .USE
133	rm -f .depend
134
135clean: __CLEANKERNEL
136
137cleandir: __CLEANKERNEL __CLEANDEPEND
138
139lint:
140	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
141	    ${VAX}/vax/Locore.c ${CFILES} \
142	    ioconf.c param.c | \
143	    grep -v 'static function .* unused'
144
145tags:
146	@echo "see $S/kern/Makefile for tags"
147
148links:
149	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
150	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
151	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
152	  sort -u | comm -23 - dontlink | \
153	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
154	sh makelinks && rm -f dontlink
155
156SRCS=	${VAX}/vax/intvec.s ${VAX}/vax/subr.s \
157	param.c ioconf.c ${CFILES} ${SFILES}
158depend: .depend
159.depend: ${SRCS} assym.h param.c
160	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${VAX}/vax/intvec.s ${VAX}/vax/subr.s
161	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
162	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
163
164
165# depend on root or device configuration
166autoconf.o conf.o: Makefile
167 
168# depend on network or filesystem configuration 
169uipc_proto.o vfs_conf.o: Makefile 
170
171# depend on maxusers
172machdep.o: Makefile
173
174# depend on CPU configuration 
175tmscp.o ts.o uba.o uda.o autoconf.o clock.o conf.o emulate.o intvec.o: Makefile
176machdep.o sbi.o subr.o uvaxII.o: Makefile
177
178
179intvec.o: ${VAX}/vax/intvec.s assym.h
180	${NORMAL_S}
181
182subr.o: ${VAX}/vax/subr.s assym.h
183	${NORMAL_S}
184
185%RULES
186