Makefile.i386 revision 1.42
1# 	from: @(#)Makefile.hp300	8.2 (Berkeley) 1/23/94
2#	$Id: Makefile.i386,v 1.42 1994/05/23 10:18:52 mycroft Exp $
3#
4# Makefile for 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/arch/i386/conf/``machineid''
10# after which you should do
11#	 config machineid
12# Generic makefile changes should be made in
13#	/sys/arch/i386/conf/Makefile.i386
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
24# DEBUG is set to -g by config if debugging is requested (config -g).
25# PROF is set to -pg by config if profiling is requested (config -p).
26AS=	as ${DEBUG}
27CC=	cc ${DEBUG}
28CPP=	cpp
29LD=	ld
30TOUCH=	touch -f -c
31
32# source tree is located via $S relative to the compilation directory
33S=	../../../..
34I386=	../..
35
36INCLUDES= -I. -I$S/arch -I$S -I$S/sys
37COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386
38CFLAGS=	-O6 ${COPTS}
39LOAD_ADDRESS= F8100000
40
41### find out what to use for libkern
42.include "$S/lib/libkern/Makefile.inc"
43.ifndef PROF
44LIBKERN=	${KERNLIB}
45.else
46LIBKERN=	${KERNLIB_PROF}
47.endif
48
49# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
50# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
51# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
52# is marked as config-dependent.
53
54NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
55NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
56
57DRIVER_C=	${CC} -c ${CFLAGS} ${PROF} $<
58DRIVER_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
59
60PROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
61		sed -e s/_mcount/mcount/ -e s/subrmcount/subr_mcount/ <$*.s | \
62		${AS} -o $@; \
63		rm -f $*.s
64
65NORMAL_S=	${CPP} -DLOCORE ${COPTS} $< | ${AS} -o $@
66NORMAL_S_C=	${CPP} -DLOCORE ${COPTS} ${PARAM} $< | ${AS} -o $@
67
68%OBJS
69
70%CFILES
71
72# load lines for config "xxx" will be emitted as:
73# xxx: ${SYSTEM_DEP} swapxxx.o
74#	${SYSTEM_LD_HEAD}
75#	${SYSTEM_LD} swapxxx.o
76#	${SYSTEM_LD_TAIL}
77SYSTEM_OBJ=	locore.o ${OBJS} param.o ioconf.o ${LIBKERN}
78SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
79SYSTEM_LD_HEAD=	rm -f $@
80SYSTEM_LD=	-@if [ X${DEBUG} = X-g ]; \
81		then strip=-X; \
82		else strip=-x; \
83		fi; \
84		echo ${LD} $$strip -z -T ${LOAD_ADDRESS} -o $@ -e start '$${SYSTEM_OBJ}' vers.o; \
85		${LD} $$strip -z -T ${LOAD_ADDRESS} -o $@ -e start ${SYSTEM_OBJ} vers.o
86SYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
87		[ X${DEBUG} = X-g ] && { \
88		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
89		echo strip -d $@; strip -d $@; } || true
90
91%LOAD
92
93vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
94	sh $S/conf/newvers.sh
95	${CC} ${CFLAGS} -c vers.c
96
97clean:
98	rm -f eddep *netbsd netbsd.gdb tags *.o locore.i [a-z]*.s \
99		[Ee]rrs linterrs makelinks
100
101lint: /tmp param.c
102	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
103	    ${I386}/i386/Locore.c ${CFILES} ${I386}/i386/swapgeneric.c \
104	    ioconf.c param.c | \
105	    grep -v 'struct/union .* never defined' | \
106	    grep -v 'possible pointer alignment problem'
107
108locore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h
109locore.o: machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s
110locore.o: $S/sys/errno.h machine/specialreg.h ${I386}/isa/debug.h
111locore.o: ${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h
112	${CPP} -DLOCORE ${COPTS} ${I386}/i386/locore.s | ${AS} -o locore.o
113
114# the following is necessary because autoconf.o depends on #if GENERIC
115autoconf.o: Makefile
116
117# the following are necessary because the files depend on the types of
118# cpu's included in the system configuration
119locore.o machdep.o: Makefile
120
121# depend on network or filesystem configuration
122uipc_proto.o vfs_conf.o locore.o: Makefile
123
124# depend on maxusers
125assym.s: Makefile
126
127# depends on KDB (cons.o also depends on GENERIC)
128trap.o cons.o: Makefile
129
130assym.s: genassym
131	./genassym >assym.s
132
133genassym: ${I386}/i386/genassym.c
134	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Di386 -o genassym \
135	    ${I386}/i386/genassym.c
136
137depend: assym.s param.c
138	mkdep ${COPTS} ${CFILES} ioconf.c param.c
139	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
140
141links:
142	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
143	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
144	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
145	  sort -u | comm -23 - dontlink | \
146	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
147	sh makelinks && rm -f dontlink
148
149tags:
150	@echo "see $S/kern/Makefile for tags"
151
152ioconf.o: ioconf.c
153	${CC} -c ${CFLAGS} ioconf.c
154
155param.c: $S/conf/param.c
156	rm -f param.c
157	cp $S/conf/param.c .
158
159param.o: param.c Makefile
160	${CC} -c ${CFLAGS} ${PARAM} param.c
161
162vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
163	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
164vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
165	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
166
167%RULES
168