Makefile.i386 revision 1.40
1# Copyright 1990 W. Jolitz
2# 	from: @(#)Makefile.i386	7.1 5/10/91
3#	$Id: Makefile.i386,v 1.40 1994/01/28 08:43:10 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/arch/i386/conf/``machineid''
11# after which you should do
12#	 config machineid
13# Generic makefile changes should be made in
14#	/sys/arch/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
28
29S=	../../../..
30I386=	../..
31
32INCLUDES= -I. -I$S/arch -I$S -I$S/sys
33COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386
34ASFLAGS=
35CFLAGS=	-O ${DEBUG} ${COPTS}
36LOAD_ADDRESS= F8100000
37
38### find out what to use for libkern
39.include "$S/lib/libkern/Makefile.inc"
40.ifndef PROF
41LIBKERN=	${KERNLIB}
42.else
43LIBKERN=	${KERNLIB_PROF}
44.endif
45
46NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
47NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
48NORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
49DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
50DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
51SYSTEM_OBJS=locore.o ${OBJS} param.o ioconf.o conf.o ${LIBKERN}
52SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
53SYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
54SYSTEM_LD= @${LD} -z -e start -T ${LOAD_ADDRESS} -o $@ -X vers.o ${SYSTEM_OBJS}
55SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; ${STRIP} -x $@; size $@; chmod 755 $@
56
57GPROF.EX=	/usr/src/lib/csu/i386/gprof.ex
58PROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
59		ex - $*.s < ${GPROF.EX} ; \
60		${AS} -o $@ $*.s ; \
61		rm -f $*.s
62
63%OBJS
64
65%CFILES
66
67%LOAD
68
69clean:
70	rm -f eddep *netbsd tags *.o locore.i [a-uw-z]*.s \
71		errs linterrs makelinks genassym
72
73lint: /tmp param.c
74	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
75	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
76	    grep -v 'struct/union .* never defined' | \
77	    grep -v 'possible pointer alignment problem'
78
79symbols.sort: ${I386}/i386/symbols.raw
80	grep -v '^#' ${I386}/i386/symbols.raw \
81	    | sed 's/^	//' | sort -u > symbols.sort
82
83locore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
84	machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s \
85	$S/sys/errno.h machine/specialreg.h ${I386}/isa/debug.h \
86	${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h
87	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
88		${AS} ${ASFLAGS} -o locore.o
89
90machdep.o: ${I386}/i386/machdep.c Makefile
91	${CC} -c ${CFLAGS} -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${PROF} $<
92
93# the following is necessary because autoconf.o depends on #if GENERIC
94autoconf.o: Makefile
95
96# depend on network configuration
97af.o uipc_proto.o locore.o: Makefile
98
99# depend on maxusers
100assym.s: Makefile
101
102# depends on KDB (cons.o also depends on GENERIC)
103trap.o cons.o: Makefile
104
105assym.s: $S/sys/param.h machine/pte.h $S/sys/buf.h \
106    $S/sys/vmmeter.h \
107    $S/sys/proc.h $S/sys/msgbuf.h machine/vmparam.h
108
109assym.s: genassym
110	./genassym >assym.s
111
112genassym: ${I386}/i386/genassym.c
113	${CC} -static ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
114		 ${I386}/i386/genassym.c -o genassym
115
116depend: assym.s param.c
117	sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c
118	sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
119
120links:
121	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
122	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
123	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
124	  sort -u | comm -23 - dontlink | \
125	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
126	sh makelinks && rm -f dontlink
127
128tags:
129	@echo "see $S/kern/Makefile for tags"
130
131ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
132    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
133	${CC} -c ${CFLAGS} ioconf.c
134
135conf.o: ${I386}/i386/conf.c
136	${CC} -traditional -c ${CFLAGS} ${I386}/i386/conf.c
137
138param.c: $S/conf/param.c
139	-rm -f param.c
140	cp $S/conf/param.c .
141
142param.o: param.c Makefile
143	${CC} -c ${CFLAGS} ${PARAM} param.c
144
145vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
146	sh $S/conf/newvers.sh
147	${CC} ${CFLAGS} -c vers.c
148
149%RULES
150
151# DO NOT DELETE THIS LINE -- make depend uses it
152
153