Makefile.mac68k revision 1.19 1 # $NetBSD: Makefile.mac68k,v 1.19 1995/06/25 13:06:32 briggs Exp $
2
3 # Makefile for NetBSD for the mac
4 # Derived from makefile for hp300 from 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
23 # DEBUG is set to -g by config if debugging is requested (config -g).
24 # PROF is set to -pg by config if profiling is requested (config -p).
25 AS= /usr/bin/as ${DEBUG}
26 CC= /usr/bin/cc ${DEBUG}
27 LOCAL_CC=${CC}
28 CPP= /usr/bin/cpp
29 LD= /usr/bin/ld
30 TOUCH= touch -f -c
31 GPROF.EX=/usr/src/lib/libc/csu.mac68k/gmon.ex
32
33 # source tree is located via $S relative to the compilation directory
34 S= ../../../..
35 MAC68K= ../..
36
37 INCLUDES= -I. -I$S/arch -I$S -I$S/sys
38 COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -DREFBIT -Dmac68k
39 CFLAGS= -O ${COPTS}
40
41 ### Find out what to use for libkern.
42 .include "$S/lib/libkern/Makefile.inc"
43 .ifndef PROF
44 LIBKERN=${KERNLIB}
45 .else
46 LIBKERN=${KERNLIB_PROF}
47 .endif
48
49 ### for the Motorola 68040 Floating Point Software Product
50 .include "$S/arch/m68k/fpsp/Makefile.inc"
51
52 # compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
53 # where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
54 # capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
55 # is marked as config-dependent.
56
57 NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
58 NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
59
60 DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
61 DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
62
63 PROFILE_C= ${CC} -S -c ${COPTS} $<; \
64 ex - $*.s < ${GPROF.EX}; \
65 ${AS} -o $@ $*.s; \
66 rm -f $*.s
67
68 # This really bites for now, but we need to run assembly through sed
69 # until the real problem (cpp, I think) is fixed.
70 NORMAL_S= ${CPP} ${COPTS} $< | ${AS} -o $@
71 NORMAL_S_C= ${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
72
73 %OBJS
74
75 %CFILES
76
77 # load lines for config "xxx" will be emitted as:
78 # xxx: ${SYSTEM_DEP} swapxxx.o
79 # ${SYSTEM_LD_HEAD}
80 # ${SYSTEM_LD} swapxxx.o
81 # ${SYSTEM_LD_TAIL}
82 SYSTEM_OBJ= locore.o vnode_if.o ${OBJS} param.o ioconf.o conf.o \
83 ${FPSP} ${LIBKERN}
84 SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
85 SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
86 SYSTEM_LD= @strip=-x; [ X${DEBUG} = X-g ] && strip=-X || true; \
87 ${LD} $$strip -n -T 0 -e start -o $@ \
88 ${SYSTEM_OBJ} vers.o ${LIBKERN}
89 SYSTEM_LD_TAIL= @chmod 755 $@; size $@; \
90 [ X${DEBUG} = X-g ] && { \
91 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
92 echo strip -d $@; strip -d $@; } || true
93
94 %LOAD
95
96 newvers:
97 sh $S/conf/newvers.sh "${KERN_IDENT}" ${IDENT}
98 ${CC} ${CFLAGS} -c vers.c
99
100 clean::
101 rm -f eddep netbsd tags *.o locore.i [a-z]*.s \
102 Errs errs linterrs makelinks
103
104 lint: /tmp param.c
105 @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
106 ${MAC68K}/mac68k/Locore.c ${CFILES} \
107 ioconf.c param.c| \
108 grep -v 'struct/union .* never defined' | \
109 grep -v 'possible pointer alignment problem'
110
111 symbols.sort: ${MAC68K}/mac68k/symbols.raw
112 grep -v '^#' ${MAC68K}/mac68k/symbols.raw \
113 | sed 's/^ //' | sort -u > symbols.sort
114
115 locore.o: assym.s ${MAC68K}/mac68k/vectors.s ${MAC68K}/mac68k/macglobals.s
116 locore.o: ${MAC68K}/mac68k/locore.s
117 locore.o: ${MAC68K}/include/trap.h ${MAC68K}/include/psl.h
118 locore.o: ${MAC68K}/include/pte.h ${MAC68K}/include/cpu.h
119 ${CPP} -DLOCORE ${COPTS} ${MAC68K}/mac68k/locore.s | ${AS} -o locore.o
120
121 # the following is necessary because autoconf.o depends on #if GENERIC
122 autoconf.o: Makefile
123
124 # the following are necessary because the files depend on the types of
125 # hp cpu's included in the system configuration
126 clock.o machdep.o autoconf.o conf.o: Makefile
127
128 # depend on network configuration
129 af.o uipc_proto.o locore.o: Makefile
130
131 # depend on maxusers
132 assym.s: Makefile
133
134 assym.s: genassym
135 ./genassym >assym.s
136
137 genassym: ${MAC68K}/mac68k/genassym.c
138 ${LOCAL_CC} ${INCLUDES} ${IDENT} -D_KERNEL ${PARAM} -o genassym \
139 ${MAC68K}/mac68k/genassym.c
140
141 depend: assym.s param.c vnode_if.h
142 mkdep ${COPTS} ${CFILES} ioconf.c param.c
143 mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${MAC68K}/mac68k/genassym.c
144
145 links:
146 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
147 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
148 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
149 sort -u | comm -23 - dontlink | \
150 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
151 sh makelinks && rm -f dontlink
152
153 tags:
154 @echo "see $S/kern/Makefile for tags"
155
156 ioconf.o: ioconf.c
157 ${CC} -c ${CFLAGS} ioconf.c
158
159 conf.o: ${MAC68K}/mac68k/conf.c
160 ${NORMAL_C}
161
162 param.c: $S/conf/param.c
163 rm -f param.c
164 cp $S/conf/param.c .
165
166 param.o: param.c Makefile
167 ${CC} -c ${CFLAGS} ${PARAM} -DHZ=60 param.c
168
169 vnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
170 AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
171
172 %RULES
173