Makefile.vax revision 1.23
1#	$NetBSD: Makefile.vax,v 1.23 1996/08/10 05:29:55 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# -DUUDMA	compile in unibus tu58 pseudo-dma code
21
22# DEBUG is set to -g if debugging.
23# PROF is set to -pg if profiling.
24
25CC?=	cc
26LD?=	ld
27MKDEP?=	mkdep
28STRIP?=	strip -d
29TOUCH?=	touch -f -c
30
31# source tree is located via $S relative to the compilation directory
32S!=	cd ../../../..; pwd
33VAX=	$S/arch/vax
34
35INCLUDES=	-I. -I$S/arch -I$S
36CPPFLAGS=	${INCLUDES} ${IDENT} -D_KERNEL -D_VAX_INLINE_
37CWARNFLAGS=	-Werror
38CFLAGS=		${DEBUG} ${CWARNFLAGS} -O2 
39AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
40LINKFLAGS=	-Z -Ttext 80000000 -e _start
41
42### find out what to use for libkern
43.include "$S/lib/libkern/Makefile.inc"
44.ifndef PROF
45LIBKERN=	${KERNLIB}
46.else
47LIBKERN=        ${KERNLIB_PROF}
48.endif
49
50### find out what to use for libcompat
51.include "$S/compat/common/Makefile.inc"
52.ifndef PROF
53LIBCOMPAT=      ${COMPATLIB}
54.else
55LIBCOMPAT=      ${COMPATLIB_PROF}
56.endif
57
58# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
59# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
60# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
61# is marked as config-dependent.
62
63NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
64NORMAL_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
65
66DRIVER_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
67DRIVER_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
68
69NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
70NORMAL_S_C=	${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -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} $@; ${STRIP} $@
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_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} ${PARAM} -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