Makefile.sun3 revision 1.30
1#	$NetBSD: Makefile.sun3,v 1.30 1995/05/24 20:29:16 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# 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	  ${SUN3}/include/trap.h $S/arch/m68k/include/trap.h
119	${CPP} -DLOCORE ${COPTS} ${SUN3}/sun3/locore.s > plocore.s
120	echo "" >>plocore.s
121	${AS} -o locore.o plocore.s
122
123# the following is necessary because autoconf.o depends on #if GENERIC
124autoconf.o: Makefile
125
126# depends on device configuration
127conf.o : Makefile
128
129# depends on network or filesystem configuration
130uipc_proto.o vfs_conf.o : Makefile
131
132# depends on value of SYMTAB_SPACE
133db_aout.o : Makefile
134
135sun3_startup.o pmap.o kern_xxx.o: Makefile
136
137# depend on network configuration
138af.o uipc_proto.o locore.o: Makefile
139
140# depend on maxusers
141assym.s: Makefile
142
143assym.s: genassym
144	./genassym >assym.s
145
146genassym:
147	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dsun3 -o genassym \
148	    ${SUN3}/sun3/genassym.c
149
150depend: assym.s ioconf.c param.c vnode_if.c
151	mkdep ${COPTS} ${CFILES} ioconf.c param.c vnode_if.c
152	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${SUN3}/sun3/genassym.c 
153
154links:
155	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
156	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
157	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
158	  sort -u | comm -23 - dontlink | \
159	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
160	sh makelinks && rm -f dontlink
161
162tags:
163	@echo "see $S/kern/Makefile for tags"
164
165ioconf.o: ioconf.c
166	${CC} -c ${CFLAGS} ioconf.c
167
168param.c: $S/conf/param.c
169	rm -f param.c
170	cp $S/conf/param.c .
171
172param.o: param.c Makefile
173	${CC} -c ${CFLAGS} ${PARAM} param.c
174
175vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
176	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
177	${CC} ${CFLAGS} -c vers.c
178
179vnode_if.c vnode_if.h : $S/kern/vnode_if.sh $S/kern/vnode_if.src
180	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
181
182%RULES
183