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