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