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