Makefile.i386 revision 1.33
1# Copyright 1990 W. Jolitz
2# 	from: @(#)Makefile.i386	7.1 5/10/91
3#	$Id: Makefile.i386,v 1.33 1993/10/13 06:43:17 cgd Exp $
4#
5# Makefile for NetBSD
6#
7# This makefile is constructed from a machine description:
8#	config machineid
9# Most changes should be made in the machine description
10#	/sys/i386/conf/``machineid''
11# after which you should do
12#	 config machineid
13# Generic makefile changes should be made in
14#	/sys/i386/conf/Makefile.i386
15# after which config should be rerun for all machines.
16#
17# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE
18#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
19#
20# -DTRACE	compile in kernel tracing hooks
21# -DQUOTA	compile in file system quotas
22#
23TOUCH=	touch -f -c
24LD=	/usr/bin/ld
25CC=	cc 
26CPP=	cpp
27STRIP=	strip
28DBSYM=	/usr/sbin/dbsym
29
30S=	../../../..
31I386=	../..
32
33INCLUDES= -I. -I$S/arch -I$S -I$S/sys
34COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386
35ASFLAGS=
36CFLAGS=	-O ${DEBUG} ${COPTS}
37LOAD_ADDRESS ?= FE100000
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
47NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
48NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
49NORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
50DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
51DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
52SYSTEM_OBJS=locore.o ${OBJS} param.o ioconf.o conf.o ${LIBKERN}
53SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
54SYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
55SYSTEM_LD= @${LD} -z -T ${LOAD_ADDRESS} -o $@ -X vers.o ${SYSTEM_OBJS}
56SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; ${DBSYM} -fT ${LOAD_ADDRESS} $@; ${STRIP} -x $@; size $@; chmod 755 $@
57
58# (XXX) ok, this is weird.  but we've got a working ed, and a broken ex, and
59# the script is identical for either... -- cgd
60#
61GPROF.EX=	/usr/src/lib/csu/i386/gprof.ex
62PROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
63		ed - $*.s < ${GPROF.EX} ; \
64		${AS} -o $@ $*.s ; \
65		rm -f $*.s
66
67%OBJS
68
69%CFILES
70
71%LOAD
72
73clean:
74	rm -f eddep *netbsd tags *.o locore.i [a-uw-z]*.s \
75		errs linterrs makelinks genassym
76
77lint: /tmp param.c
78	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
79	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
80	    grep -v 'struct/union .* never defined' | \
81	    grep -v 'possible pointer alignment problem'
82
83symbols.sort: ${I386}/i386/symbols.raw
84	grep -v '^#' ${I386}/i386/symbols.raw \
85	    | sed 's/^	//' | sort -u > symbols.sort
86
87locore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
88	machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s \
89	$S/sys/errno.h machine/specialreg.h ${I386}/isa/debug.h \
90	${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h
91	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
92		${AS} ${ASFLAGS} -o locore.o
93
94machdep.o: ${I386}/i386/machdep.c Makefile
95	${CC} -c ${CFLAGS} -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${PROF} $<
96
97# the following is necessary because autoconf.o depends on #if GENERIC
98autoconf.o: Makefile
99
100# depend on network configuration
101af.o uipc_proto.o locore.o: Makefile
102
103# depend on maxusers
104assym.s: Makefile
105
106# depends on KDB (cons.o also depends on GENERIC)
107trap.o cons.o: Makefile
108
109assym.s: $S/sys/param.h machine/pte.h $S/sys/buf.h \
110    $S/sys/vmmeter.h \
111    $S/sys/proc.h $S/sys/msgbuf.h machine/vmparam.h
112
113assym.s: genassym
114	./genassym >assym.s
115
116genassym: ${I386}/i386/genassym.c
117	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
118		 ${I386}/i386/genassym.c -o genassym
119
120depend: assym.s param.c
121	sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c
122	sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
123
124links:
125	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
126	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
127	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
128	  sort -u | comm -23 - dontlink | \
129	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
130	sh makelinks && rm -f dontlink
131
132tags:
133	@echo "see $S/kern/Makefile for tags"
134
135ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
136    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
137	${CC} -c ${CFLAGS} ioconf.c
138
139conf.o: ${I386}/i386/conf.c
140	${CC} -traditional -c ${CFLAGS} ${I386}/i386/conf.c
141
142param.c: $S/conf/param.c
143	-rm -f param.c
144	cp $S/conf/param.c .
145
146param.o: param.c Makefile
147	${CC} -c ${CFLAGS} ${PARAM} param.c
148
149vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
150	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
151	${CC} ${CFLAGS} -c vers.c
152
153%RULES
154
155# DO NOT DELETE THIS LINE -- make depend uses it
156
157