Makefile.sun3 revision 1.29
1#	$NetBSD: Makefile.sun3,v 1.29 1995/05/16 22:25:15 jtc 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# For cross development, uncomment XINC, and
23# copy a few things from NetBSD:/usr/include
24# into compile/xinc : nlist.h setjmp.h stab.h
25XINC = -nostdinc -I../xinc
26AWK = nawk
27
28# DEBUG is set to -g by config if debugging is requested (config -g).
29DEBUG?=-O
30# PROF is set to -pg by config if profiling is requested (config -p).
31AS=	gas 
32CC=	gcc -msoft-float ${DEBUG}
33CPP=	gcpp
34LD=	ld
35TOUCH=	touch -f -c
36GPROF.EX=/usr/src/usr.lib/libc/csu/sun3/gmon.ex
37
38# source tree is located via $S relative to the compilation directory
39S=	../../../..
40SUN3=	../..
41LIBKERN=../libkern.a
42
43INCLUDES= ${XINC} -I. -I../.. -I$S -I$S/sys -I$S/arch
44COPTS=	${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dsun3
45CFLAGS=	${COPTS}
46
47# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
48# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
49# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
50# is marked as config-dependent.
51
52NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
53NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
54
55DRIVER_C=	${CC} -c ${CFLAGS} ${PROF} $<
56DRIVER_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
57
58PROFILE_C=	${CC} -S -c ${COPTS} $<; \
59		ex - $*.s < ${GPROF.EX}; \
60		${AS} -o $@ $*.s; \
61		rm -f $*.s
62
63NORMAL_S=	${CPP} ${COPTS} $< | ${AS} -o $@
64NORMAL_S_C=	${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
65
66%OBJS
67
68%CFILES
69
70# load lines for config "xxx" will be emitted as:
71# xxx: ${SYSTEM_DEP} swapxxx.o
72#	${SYSTEM_LD_HEAD}
73#	${SYSTEM_LD} swapxxx.o
74#	${SYSTEM_LD_TAIL}
75DEBUG?=
76.if ${DEBUG} == "-g"
77LDX=-X
78.else
79LDX=-S
80.endif
81SYSTEM_OBJ=	locore.o vnode_if.o ${OBJS} param.o ioconf.o
82#SYSTEM_DEP=	Makefile symbols.sort ${SYSTEM_OBJ}
83SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
84SYSTEM_LD_HEAD=	@echo loading $@; rm -f $@
85SYSTEM_LD=	-@echo ${LD} ${LDX} -n -N -e start -T 0E004000 -o $@ \
86		    '$${SYSTEM_OBJ}' vers.o ${LIBKERN}; \
87		${LD} ${LDX} -n -N -e start -T 0E004000 -o $@ \
88		    ${SYSTEM_OBJ} vers.o ${LIBKERN}
89#SYSTEM_LD_TAIL= @echo rearranging symbols;\
90#		symorder symbols.sort $@;\
91SYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
92		[ X${DEBUG} = X-g ] && { \
93		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
94		echo strip $@; strip $@; } || true
95
96%LOAD
97
98newvers:
99	sh $S/conf/newvers.sh
100	${CC} $(CFLAGS) -c vers.c
101
102clean:
103	rm -f eddep netbsd* tags *.o locore.i [a-z]*.s \
104		Errs errs linterrs makelinks vnode_if.[ch]
105
106lint: /tmp param.c
107	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
108	    ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
109	    ioconf.c param.c| \
110	    grep -v 'struct/union .* never defined' | \
111	    grep -v 'possible pointer alignment problem'
112
113symbols.sort: ${SUN3}/sun3/symbols.raw
114	grep -v '^#' ${SUN3}/sun3/symbols.raw \
115	    | sed 's/^	//' | sort -u > symbols.sort
116
117locore.o: assym.s ${SUN3}/sun3/locore.s ${SUN3}/include/asm.h \
118	${S}/sys/syscall.h ${SUN3}/sun3/lib.s ${SUN3}/sun3/m68k.s \
119	${SUN3}/sun3/signal.s ${SUN3}/sun3/process.s \
120	${SUN3}/sun3/softint.s ${SUN3}/sun3/interrupt.s \
121	${SUN3}/sun3/trap.s
122	${CPP} -DLOCORE ${COPTS} ${SUN3}/sun3/locore.s > plocore.s
123	echo "" >>plocore.s
124	${AS} -o locore.o plocore.s
125
126# the following is necessary because autoconf.o depends on #if GENERIC
127autoconf.o: Makefile
128
129# depends on device configuration
130conf.o : Makefile
131
132# depends on network or filesystem configuration
133uipc_proto.o vfs_conf.o : Makefile
134
135# depends on value of SYMTAB_SPACE
136db_aout.o : Makefile
137
138sun3_startup.o pmap.o kern_xxx.o: Makefile
139
140# depend on network configuration
141af.o uipc_proto.o locore.o: Makefile
142
143# depend on maxusers
144assym.s: Makefile
145
146assym.s: genassym
147	./genassym >assym.s
148
149genassym:
150	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dsun3 -o genassym \
151	    ${SUN3}/sun3/genassym.c
152
153depend: assym.s ioconf.c param.c vnode_if.c
154	mkdep ${COPTS} ${CFILES} ioconf.c param.c vnode_if.c
155	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${SUN3}/sun3/genassym.c 
156
157links:
158	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
159	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
160	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
161	  sort -u | comm -23 - dontlink | \
162	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
163	sh makelinks && rm -f dontlink
164
165tags:
166	@echo "see $S/kern/Makefile for tags"
167
168ioconf.o: ioconf.c
169	${CC} -c ${CFLAGS} ioconf.c
170
171param.c: $S/conf/param.c
172	rm -f param.c
173	cp $S/conf/param.c .
174
175param.o: param.c Makefile
176	${CC} -c ${CFLAGS} ${PARAM} param.c
177
178vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
179	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
180	${CC} ${CFLAGS} -c vers.c
181
182vnode_if.c vnode_if.h : $S/kern/vnode_if.sh $S/kern/vnode_if.src
183	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
184
185%RULES
186