xref: /original-bsd/sys/sparc/conf/Makefile.sparc (revision 42f60e33)
1#	@(#)Makefile.sparc	7.1 (Berkeley) 04/20/93
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# DEBUG is set to -g if debugging.
22# PROF is set to -pg if profiling.
23
24AS?=	as
25
26CC=	cc -W ${DEBUG}
27CPP=	cpp
28LD=	ld
29TOUCH=	touch -f -c
30
31# source tree is located via $S relative to the compilation directory
32S=	../..
33SPARC=	$S/sparc
34LIBKERN=$S/libkern/obj/libkern.a
35
36INCLUDES=-I. -I$S -I$S/sys
37COPTS=	${INCLUDES} ${IDENT} -DKERNEL -DSUN4C -Dsun4c
38CFLAGS=	-O4 ${COPTS}
39
40# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
41# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
42# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
43# is marked as config-dependent.
44
45# sparc kernel uses volatile, rather than heavy "device-driver"s.
46
47NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
48NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
49
50NORMAL_S=	rm -f $*.c; ln -s $< $*.c; \
51		${CC} ${COPTS} -I${SPARC}/sparc -E $*.c > $*.i; \
52		${AS} -o $@ $*.i; rm -f $*.c $*.i
53NORMAL_S_C=	rm -f $*.c; ln -s $< $*.c; \
54		${CC} ${COPTS} ${PARAM} -I${SPARC}/sparc -E $*.c > $*.i; \
55		${AS} -o $@ $*.i; rm -f $*.c $*.i
56
57%OBJS
58
59%CFILES
60
61# load lines for config "xxx" will be emitted as:
62# xxx: ${SYSTEM_DEP} swapxxx.o
63#	${SYSTEM_LD_HEAD}
64#	${SYSTEM_LD} swapxxx.o
65#	${SYSTEM_LD_TAIL}
66DEBUG?=
67.if ${DEBUG} == "-g"
68LDX=-X
69.else
70LDX=-x
71.endif
72SYSTEM_OBJ=	locore.o ${OBJS} param.o ioconf.o vnode_if.o
73SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
74SYSTEM_LD_HEAD=	rm -f $@
75SYSTEM_LD=	-@echo ${LD} ${LDX} -p -N -e start -T f8004000 -o $@ \
76		    '$${SYSTEM_OBJ}' vers.o ${LIBKERN}; \
77		${LD} ${LDX} -p -N -e start -T f8004000 -o $@ \
78		    ${SYSTEM_OBJ} vers.o ${LIBKERN}
79SYSTEM_LD_TAIL=	@size $@; chmod 755 $@
80#.if ${DEBUG} == "-g"
81#SYSTEM_LD_TAIL+=; echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
82#		echo strip -d $@; strip -d $@
83#.endif
84
85%LOAD
86
87newvers:
88	sh $S/conf/newvers.sh
89	${CC} ${CFLAGS} -c vers.c
90
91clean:
92	rm -f eddep *vmunix vmunix.gdb tags tags1 *.[io] [a-z]*.s \
93		Errs errs linterrs makelinks
94
95locore.o: ${SPARC}/sparc/locore.s assym.s
96	${NORMAL_S}
97
98# depend on maxusers
99assym.s: Makefile
100
101./assym.s: assym.s
102assym.s: genassym
103	./genassym >assym.s
104
105genassym: genassym.o
106	${CC} -o $@ genassym.o
107
108genassym.o: ${SPARC}/sparc/genassym.c
109	${CC} -c ${CFLAGS} ${PARAM} $<
110
111SRCS=	${CFILES} ${SPARC}/sparc/locore.s ${SPARC}/sparc/bsd_audiointr.s \
112	${SPARC}/sparc/genassym.c ioconf.c param.c vnode_if.c
113depend: .depend
114.depend: ${SRCS} assym.s
115	mkdep ${COPTS} ${SRCS}
116
117links:
118	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
119	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
120	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
121	  sort -u | comm -23 - dontlink | \
122	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
123	sh makelinks && rm -f dontlink
124
125tags: depend
126	sh $S/conf/systags.sh
127	rm -f tags1
128	sed -e 's,	../,	,' tags > tags1
129
130ioconf.o: ioconf.c
131	${CC} -c ${CFLAGS} ioconf.c
132
133param.c: $S/conf/param.c
134	rm -f param.c
135	cp $S/conf/param.c .
136
137param.o: param.c Makefile
138	${CC} -c ${CFLAGS} ${PARAM} param.c
139
140vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
141	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
142vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
143	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
144
145%RULES
146