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