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