Makefile.vax revision 1.24
1#	$NetBSD: Makefile.vax,v 1.24 1996/08/10 06:10:18 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} -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
72HOSTED_C_C=	${NORMAL_C_C:S/^-pg$//:S/^-p$//:S/^-nostdinc$//}
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} $@; ${STRIP} $@
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_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
120clean::
121	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
122	    [Ee]rrs linterrs makelinks
123
124lint:
125	@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
126	    ${VAX}/vax/Locore.c ${CFILES} ${VAX}/vax/swapgeneric.c \
127	    ioconf.c param.c | \
128	    grep -v 'static function .* unused'
129
130tags:
131	@echo "see $S/kern/Makefile for tags"
132
133links:
134	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
135	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
136	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
137	  sort -u | comm -23 - dontlink | \
138	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
139	sh makelinks && rm -f dontlink
140
141SRCS=	${VAX}/vax/intvec.s ${VAX}/vax/subr.s \
142	param.c ioconf.c ${CFILES} ${SFILES}
143depend:: .depend
144.depend: ${SRCS} param.c
145	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${VAX}/vax/intvec.s ${VAX}/vax/subr.s
146	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
147	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
148
149
150# depend on root or device configuration
151autoconf.o conf.o: Makefile
152 
153# depend on network or filesystem configuration 
154uipc_proto.o vfs_conf.o: Makefile 
155
156# depend on maxusers
157machdep.o: Makefile
158
159# depend on CPU configuration 
160tmscp.o ts.o uba.o uda.o autoconf.o clock.o conf.o emulate.o intvec.o: Makefile
161machdep.o sbi.o subr.o uvaxII.o: Makefile
162
163
164intvec.o: ${VAX}/vax/intvec.s
165	${NORMAL_S}
166
167subr.o: ${VAX}/vax/subr.s
168	${NORMAL_S}
169
170%RULES
171