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