Makefile.sun3 revision 1.31
1#	$NetBSD: Makefile.sun3,v 1.31 1995/06/09 21:53:32 gwr Exp $
2
3#
4# Makefile for NetBSD
5#
6# This makefile is constructed from a machine description:
7#	config machineid
8# Most changes should be made in the machine description
9#	/sys/conf/``machineid''
10# after which you should do
11#	 config machineid
12# Machine generic makefile changes should be made in
13#	/sys/conf/Makefile.``machinetype''
14# after which config should be rerun for all machines of that type.
15#
16# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
17#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
18#
19# -DTRACE	compile in kernel tracing hooks
20# -DQUOTA	compile in file system quotas
21
22# DEBUG is set to -g by config if debugging is requested (config -g).
23DEBUG?=-O
24# PROF is set to -pg by config if profiling is requested (config -p).
25AS=	as
26CC=	cc ${DEBUG}
27CPP=	cpp
28LD=	ld
29TOUCH=	touch -f -c
30
31# source tree is located via $S relative to the compilation directory
32S=	../../../..
33SUN3=	../..
34
35INCLUDES= -I. -I../.. -I$S/arch -I$S/sys -I$S
36COPTS=	${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dsun3
37# We do NOT want accidental FP instructions in the kernel.
38CFLAGS= -msoft-float ${COPTS}
39
40# What to use for libkern:
41.include "$S/lib/libkern/Makefile.inc"
42.ifndef PROF
43LIBKERN=	${KERNLIB}
44.else
45LIBKERN=	${KERNLIB_PROF}
46.endif
47
48# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
49# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
50# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
51# is marked as config-dependent.
52
53NORMAL_C=	${CC} ${CFLAGS} ${PROF} -c $<
54NORMAL_C_C=	${CC} ${CFLAGS} ${PROF} ${PARAM} -c $<
55
56DRIVER_C=	${CC} ${CFLAGS} ${PROF} -c $<
57DRIVER_C_C=	${CC} ${CFLAGS} ${PROF} ${PARAM} -c $<
58
59PROFILE_C=	${CC} ${COPTS} -S $<; \
60		ex - $*.s < ${GPROF.EX}; \
61		${AS} -o $@ $*.s; \
62		rm -f $*.s
63
64NORMAL_S=	${CPP} ${COPTS} $< | ${AS} -o $@
65NORMAL_S_C=	${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
66
67%OBJS
68
69%CFILES
70
71# load lines for config "xxx" will be emitted as:
72# xxx: ${SYSTEM_DEP} swapxxx.o
73#	${SYSTEM_LD_HEAD}
74#	${SYSTEM_LD} swapxxx.o
75#	${SYSTEM_LD_TAIL}
76.if ${DEBUG} == "-g"
77LDX=-X
78.else
79LDX=-S
80.endif
81SYSTEM_OBJ=	locore.o vnode_if.o ${OBJS} param.o ioconf.o
82SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
83SYSTEM_LD_HEAD=	@echo loading $@; rm -f $@
84SYSTEM_LD=	-@echo ${LD} ${LDX} -n -N -e start -T 0E004000 -o $@ \
85		    '$${SYSTEM_OBJ}' vers.o ${LIBKERN}; \
86		${LD} ${LDX} -n -N -e start -T 0E004000 -o $@ \
87		    ${SYSTEM_OBJ} vers.o ${LIBKERN}
88SYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
89		[ X${DEBUG} = X-g ] && { \
90		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
91		echo strip -d $@; strip -d $@; } || true
92
93%LOAD
94
95newvers:
96	sh $S/conf/newvers.sh
97	${CC} $(CFLAGS) -c vers.c
98
99clean:
100	rm -f eddep netbsd* tags *.o locore.i [a-z]*.s \
101		Errs errs linterrs makelinks vnode_if.[ch]
102
103lint: /tmp param.c
104	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
105	    ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
106	    ioconf.c param.c| \
107	    grep -v 'struct/union .* never defined' | \
108	    grep -v 'possible pointer alignment problem'
109
110locore.o: assym.s ${SUN3}/sun3/locore.s ${SUN3}/include/asm.h \
111	  ${SUN3}/include/trap.h $S/arch/m68k/include/trap.h
112	${CPP} -DLOCORE ${COPTS} ${SUN3}/sun3/locore.s | ${AS} -o locore.o
113
114# the following is necessary because autoconf.o depends on #if GENERIC
115autoconf.o: Makefile
116
117# depends on device configuration
118conf.o : Makefile
119
120# depends on network or filesystem configuration
121uipc_proto.o vfs_conf.o : Makefile
122
123# depends on value of SYMTAB_SPACE
124db_aout.o : Makefile
125
126sun3_startup.o pmap.o kern_xxx.o: Makefile
127
128# depend on maxusers
129assym.s: Makefile
130
131assym.s: genassym
132	./genassym >assym.s
133
134genassym:
135	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dsun3 \
136	    -o genassym ${SUN3}/sun3/genassym.c
137
138depend: assym.s ioconf.c param.c vnode_if.c
139	mkdep ${COPTS} ${CFILES} ioconf.c param.c vnode_if.c
140	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${SUN3}/sun3/genassym.c
141
142links:
143	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
144	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
145	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
146	  sort -u | comm -23 - dontlink | \
147	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
148	sh makelinks && rm -f dontlink
149
150tags:
151	@echo "see $S/kern/Makefile for tags"
152
153ioconf.o: ioconf.c
154	${CC} ${CFLAGS} -c ioconf.c
155
156param.c: $S/conf/param.c
157	rm -f param.c
158	cp $S/conf/param.c .
159
160param.o: param.c Makefile
161	${CC} ${CFLAGS} ${PARAM} -c param.c
162
163vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
164	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
165	${CC} ${CFLAGS} -c vers.c
166
167vnode_if.c vnode_if.h : $S/kern/vnode_if.sh $S/kern/vnode_if.src
168	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
169
170%RULES
171