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