Makefile.sparc revision 1.4 1 # from: @(#)Makefile.sparc 8.1 (Berkeley) 7/19/93
2 # $Id: Makefile.sparc,v 1.4 1993/11/29 06:14:06 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
24 AS?= as
25
26 CC= gcc ${DEBUG}
27 CPP= cpp
28 LD= ld
29 TOUCH= touch -f -c
30
31 # source tree is located via $S relative to the compilation directory
32 S= ../../../..
33 SPARC= ../..
34 LIBKERN=../libkern.a
35
36 INCLUDES= -I. -I$S/arch -I$S -I$S/sys
37 COPTS= ${INCLUDES} ${IDENT} -DKERNEL -DSUN4C -Dsun4c
38 CFLAGS= ${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
47 NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
48 NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
49
50 # optimizer breaks sometimes; temporary workaround uses ${NOOPT_C}
51 NOOPT_C= ${CC} -c ${COPTS} ${PROF} ${PARAM} $<
52
53 NORMAL_S= rm -f $*.c; ln -s $< $*.c; \
54 ${CC} ${COPTS} -I${SPARC}/sparc -E $*.c > $*.i; \
55 ${AS} -o $@ $*.i; rm -f $*.c $*.i
56 NORMAL_S_C= rm -f $*.c; ln -s $< $*.c; \
57 ${CC} ${COPTS} ${PARAM} -I${SPARC}/sparc -E $*.c > $*.i; \
58 ${AS} -o $@ $*.i; rm -f $*.c $*.i
59
60 %OBJS
61
62 %CFILES
63
64 # load lines for config "xxx" will be emitted as:
65 # xxx: ${SYSTEM_DEP} swapxxx.o
66 # ${SYSTEM_LD_HEAD}
67 # ${SYSTEM_LD} swapxxx.o
68 # ${SYSTEM_LD_TAIL}
69 DEBUG?=
70 .if ${DEBUG} == "-g"
71 LDX=-X
72 .else
73 LDX=-x
74 .endif
75 SYSTEM_OBJ= locore.o ${OBJS} param.o ioconf.o
76 SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
77 SYSTEM_LD_HEAD= rm -f $@
78 SYSTEM_LD= -@echo ${LD} ${LDX} -p -N -e start -T f8004000 -o $@ \
79 '$${SYSTEM_OBJ}' vers.o ${LIBKERN}; \
80 ${LD} ${LDX} -p -N -e start -T f8004000 -o $@ \
81 ${SYSTEM_OBJ} vers.o ${LIBKERN} \
82 /usr/local/lib/gcc-lib/sparc/2.4.5/libgcc.a
83 SYSTEM_LD_TAIL= @size $@; chmod 755 $@
84 #.if ${DEBUG} == "-g"
85 #SYSTEM_LD_TAIL+=; echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
86 # echo strip -d $@; strip -d $@
87 #.endif
88
89 %LOAD
90
91 newvers:
92 sh $S/conf/newvers.sh
93 ${CC} ${CFLAGS} -c vers.c
94
95 clean:
96 rm -f eddep *netbsd netbsd.gdb tags tags1 *.[io] [a-z]*.s \
97 Errs errs linterrs makelinks
98
99 locore.o: ${SPARC}/sparc/locore.s assym.s
100 ${NORMAL_S}
101
102 # depend on maxusers
103 assym.s: Makefile
104
105 ./assym.s: assym.s
106 assym.s: genassym
107 ./genassym >assym.s
108
109 genassym: genassym.o
110 ${CC} -o $@ genassym.o
111
112 genassym.o: ${SPARC}/sparc/genassym.c
113 ${CC} -c ${CFLAGS} -I/tmp/usr/include -I/usr/include ${PARAM} $<
114
115 SRCS= ${CFILES} ${SPARC}/sparc/locore.s ${SPARC}/sparc/bsd_audiointr.s \
116 ${SPARC}/sparc/genassym.c ioconf.c param.c vnode_if.c
117 depend: .depend
118 .depend: ${SRCS} assym.s
119 mkdep ${COPTS} ${SRCS}
120
121 links:
122 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
123 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
124 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
125 sort -u | comm -23 - dontlink | \
126 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
127 sh makelinks && rm -f dontlink
128
129 tags: depend
130 sh $S/conf/systags.sh
131 rm -f tags1
132 sed -e 's, ../, ,' tags > tags1
133
134 ioconf.o: ioconf.c
135 ${CC} -c ${CFLAGS} ioconf.c
136
137 param.c: $S/conf/param.c
138 rm -f param.c
139 cp $S/conf/param.c .
140
141 param.o: param.c Makefile
142 ${CC} -c ${CFLAGS} ${PARAM} param.c
143
144 %RULES
145