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