Makefile.sparc revision 1.5
1# from:	@(#)Makefile.sparc	8.1 (Berkeley) 7/19/93
2# $Id: Makefile.sparc,v 1.5 1994/02/04 16:19:23 deraadt Exp $
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# DEBUG is set to -g if debugging.
22# PROF is set to -pg if profiling.
23
24AS?=	as
25
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=	../../../..
33SPARC=	../..
34
35INCLUDES= -I. -I$S/arch -I$S -I$S/sys
36COPTS=	${INCLUDES} ${IDENT} -DKERNEL -DSUN4C -Dsun4c
37CFLAGS=	${COPTS}
38
39### find out what to use for libkern
40.include "$S/lib/libkern/Makefile.inc"
41.ifndef PROF
42LIBKERN=	${KERNLIB}
43.else
44LIBKERN=	${KERNLIB_PROF}
45.endif
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
52# sparc kernel uses volatile, rather than heavy "device-driver"s.
53
54NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
55NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
56
57# optimizer breaks sometimes; temporary workaround uses ${NOOPT_C}
58NOOPT_C=	${CC} -c ${COPTS} ${PROF} ${PARAM} $<
59
60NORMAL_S=	rm -f $*.c; ln -s $< $*.c; \
61		${CC} ${COPTS} -I${SPARC}/sparc -E $*.c > $*.i; \
62		${AS} -o $@ $*.i; rm -f $*.c $*.i
63NORMAL_S_C=	rm -f $*.c; ln -s $< $*.c; \
64		${CC} ${COPTS} ${PARAM} -I${SPARC}/sparc -E $*.c > $*.i; \
65		${AS} -o $@ $*.i; rm -f $*.c $*.i
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}
76DEBUG?=
77.if ${DEBUG} == "-g"
78LDX=-X
79.else
80LDX=-x
81.endif
82SYSTEM_OBJ=	locore.o ${OBJS} param.o ioconf.o ${LIBKERN}
83SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
84SYSTEM_LD_HEAD=	@echo loading $@; rm -f $@
85SYSTEM_LD=	@${LD} ${LDX} -p -N -e start -T f8004000 -o $@ \
86		    ${SYSTEM_OBJ} vers.o
87SYSTEM_LD_TAIL=	@echo rearranging symbols; size $@; chmod 755 $@
88#.if ${DEBUG} == "-g"
89#SYSTEM_LD_TAIL+=; echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
90#		echo strip -d $@; strip -d $@
91#.endif
92
93%LOAD
94
95newvers:
96	sh $S/conf/newvers.sh
97	${CC} ${CFLAGS} -c vers.c
98
99clean:
100	rm -f eddep *netbsd netbsd.gdb tags tags1 *.[io] [a-z]*.s \
101		Errs errs linterrs makelinks
102
103locore.o: ${SPARC}/sparc/locore.s assym.s
104	${NORMAL_S}
105
106# depend on maxusers
107assym.s: Makefile
108
109./assym.s: assym.s
110assym.s: genassym
111	./genassym >assym.s
112
113genassym: genassym.o
114	${CC} -o $@ genassym.o
115
116genassym.o: ${SPARC}/sparc/genassym.c
117	${CC} -c ${CFLAGS} -I/tmp/usr/include -I/usr/include ${PARAM} $<
118
119SRCS= ${CFILES} ${SPARC}/sparc/locore.s ${SPARC}/sparc/bsd_audiointr.s \
120	${SPARC}/sparc/genassym.c ioconf.c param.c
121depend: .depend
122.depend: ${SRCS} assym.s
123	mkdep ${COPTS} ${SRCS}
124
125links:
126	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
127	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
128	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
129	  sort -u | comm -23 - dontlink | \
130	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
131	sh makelinks && rm -f dontlink
132
133tags: depend
134	sh $S/conf/systags.sh
135	rm -f tags1
136	sed -e 's,	../,	,' tags > tags1
137
138ioconf.o: ioconf.c
139	${CC} -c ${CFLAGS} ioconf.c
140
141param.c: $S/conf/param.c
142	rm -f param.c
143	cp $S/conf/param.c .
144
145param.o: param.c Makefile
146	${CC} -c ${CFLAGS} ${PARAM} param.c
147
148%RULES
149
150# DO NOT DELETE THIS LINE -- make depend uses it
151
152