Makefile.sun3 revision 1.36
1#	$NetBSD: Makefile.sun3,v 1.36 1996/02/01 22:33:05 mycroft 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/arch/sun3/conf/``machineid''
10# after which you should do
11#	 config machineid
12# Machine generic makefile changes should be made in
13#	/sys/arch/sun3/conf/Makefile.sun3
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
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= -Werror -msoft-float ${DEBUG} ${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### find out what to use for libcompat
49.include "$S/compat/common/Makefile.inc"
50.ifndef PROF
51LIBCOMPAT=	${COMPATLIB}
52.else
53LIBCOMPAT=	${COMPATLIB_PROF}
54.endif
55
56# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
57# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
58# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
59# is marked as config-dependent.
60
61NORMAL_C=	${CC} ${CFLAGS} ${PROF} -c $<
62NORMAL_C_C=	${CC} ${CFLAGS} ${PROF} ${PARAM} -c $<
63
64DRIVER_C=	${CC} ${CFLAGS} ${PROF} -c $<
65DRIVER_C_C=	${CC} ${CFLAGS} ${PROF} ${PARAM} -c $<
66
67PROFILE_C=	${CC} ${COPTS} -S $<; \
68		ex - $*.s < ${GPROF.EX}; \
69		${AS} -o $@ $*.s; \
70		rm -f $*.s
71
72NORMAL_S=	${CPP} ${COPTS} $< | ${AS} -o $@
73NORMAL_S_C=	${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
74
75%OBJS
76
77%CFILES
78
79# load lines for config "xxx" will be emitted as:
80# xxx: ${SYSTEM_DEP} swapxxx.o
81#	${SYSTEM_LD_HEAD}
82#	${SYSTEM_LD} swapxxx.o
83#	${SYSTEM_LD_TAIL}
84.if ${DEBUG} == "-g"
85LDX=-X
86.else
87LDX=-S
88.endif
89SYSTEM_OBJ=	locore.o vnode_if.o ${OBJS} param.o ioconf.o
90SYSTEM_DEP=	Makefile ${SYSTEM_OBJ} ${LIBKERN} ${LIBCOMPAT}
91SYSTEM_LD_HEAD=	@echo loading $@; rm -f $@
92SYSTEM_LD=	-@echo ${LD} ${LDX} -n -N -e start -T 0E004000 -o $@ \
93		    '$${SYSTEM_OBJ}' vers.o ${LIBKERN} ${LIBCOMPAT}; \
94		${LD} ${LDX} -n -N -e start -T 0E004000 -o $@ \
95		    ${SYSTEM_OBJ} vers.o ${LIBKERN} ${LIBCOMPAT}
96SYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
97		[ X${DEBUG} = X-g ] && { \
98		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
99		echo strip -d $@; strip -d $@; } || true
100
101%LOAD
102
103newvers:
104	sh $S/conf/newvers.sh
105	${CC} $(CFLAGS) -c vers.c
106
107clean::
108	rm -f eddep netbsd* tags *.o locore.i [a-z]*.s \
109		Errs errs linterrs makelinks vnode_if.[ch] genassym
110
111lint: /tmp param.c
112	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
113	    ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
114	    ioconf.c param.c | \
115	    grep -v 'struct/union .* never defined' | \
116	    grep -v 'possible pointer alignment problem'
117
118locore.o: assym.s ${SUN3}/sun3/locore.s ${SUN3}/include/asm.h \
119	  ${SUN3}/include/trap.h $S/arch/m68k/include/trap.h
120	${CPP} -D_LOCORE ${COPTS} ${SUN3}/sun3/locore.s | ${AS} -o locore.o
121
122# depends on root or device configuration
123autoconf.o conf.o : Makefile
124
125# depends on the supported CPU types
126locore.o sun3_startup.o pmap.o trap.o : Makefile
127
128# depends on network or filesystem configuration
129uipc_proto.o vfs_conf.o kern_xxx.o : Makefile
130
131# depend on maxusers
132assym.s: Makefile
133
134assym.s: genassym
135	./genassym >assym.s
136
137genassym:
138	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dsun3 \
139	    -o genassym ${SUN3}/sun3/genassym.c
140
141depend: assym.s ioconf.c param.c vnode_if.c
142	mkdep ${COPTS} ${CFILES} ioconf.c param.c vnode_if.c
143	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${SUN3}/sun3/genassym.c
144
145links:
146	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
147	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
148	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
149	  sort -u | comm -23 - dontlink | \
150	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
151	sh makelinks && rm -f dontlink
152
153tags:
154	@echo "see $S/kern/Makefile for tags"
155
156ioconf.o: ioconf.c
157	${CC} ${CFLAGS} -c ioconf.c
158
159param.c: $S/conf/param.c
160	rm -f param.c
161	cp $S/conf/param.c .
162
163param.o: param.c Makefile
164	${CC} ${CFLAGS} ${PARAM} -c param.c
165
166vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
167	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
168	${CC} ${CFLAGS} -c vers.c
169
170vnode_if.c vnode_if.h : $S/kern/vnode_if.sh $S/kern/vnode_if.src
171	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
172
173%RULES
174