xref: /original-bsd/sys/pmax/conf/Makefile.pmax (revision bacd16ee)
1#	@(#)Makefile.pmax	8.1 (Berkeley) 06/16/93
2#
3# Makefile for 4.4 BSD
4#
5# This makefile is constructed from a machine description:
6#	config machineid
7# Most changes should be made in the machine description
8#	/sys/conf/``machineid''
9# after which you should do
10#	 config machineid
11# Machine generic makefile changes should be made in
12#	/sys/conf/Makefile.``machinetype''
13# after which config should be rerun for all machines of that type.
14#
15# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
16#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
17#
18# -DTRACE	compile in kernel tracing hooks
19# -DQUOTA	compile in file system quotas
20
21
22# DEBUG is set to -g by config if debugging is requested (config -g).
23# PROF is set to -pg by config if profiling is requested (config -p).
24AS=	as ${DEBUG}
25CC=	gcc ${DEBUG}
26CPP=	cpp
27LD=	ld
28TOUCH=	touch -f -c
29
30# source tree is located via $S relative to the compilation directory
31S=	/sys
32PMAX=	$S/pmax
33
34INCLUDES= -I. -I$S
35COPTS=	${INCLUDES} ${IDENT} -DKERNEL
36CFLAGS=	-O ${COPTS}
37
38# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
39# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
40# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
41# is marked as config-dependent.
42
43NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
44NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
45
46DRIVER_C=	${CC} -c ${CFLAGS} ${PROF} $<
47DRIVER_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
48
49PROFILE_C=	${CC} -p -c ${COPTS} $<
50
51NORMAL_S=	${CPP} ${COPTS} $< | ${AS} -o $@
52NORMAL_S_C=	${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
53
54%OBJS
55
56%CFILES
57
58# load lines for config "xxx" will be emitted as:
59# xxx: ${SYSTEM_DEP} swapxxx.o
60#	${SYSTEM_LD_HEAD}
61#	${SYSTEM_LD} swapxxx.o
62#	${SYSTEM_LD_TAIL}
63SYSTEM_OBJ=	locore.o ${OBJS} param.o ioconf.o vnode_if.o
64#SYSTEM_DEP=	Makefile symbols.sort ${SYSTEM_OBJ} libkern.a
65SYSTEM_DEP=	Makefile ${SYSTEM_OBJ} libkern.a
66SYSTEM_LD_HEAD=	rm -f $@
67SYSTEM_LD=	-@if [ X${DEBUG} = X-g ]; \
68		then strip=-X; \
69		else strip=-x; \
70		fi; \
71		echo ${LD} $$strip -N -o $@ -e start -Ttext 80030000 \
72			'$${SYSTEM_OBJ}' vers.o libkern.a; \
73		${LD} $$strip -N -o $@ -e start -Ttext 80030000 \
74			${SYSTEM_OBJ} vers.o libkern.a
75#SYSTEM_LD_TAIL= @echo rearranging symbols;\
76#		symorder symbols.sort $@;\
77#SYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
78#		[ X${DEBUG} = X-g ] && { \
79#		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
80#		echo strip -d $@; strip -d $@; } || true
81SYSTEM_LD_TAIL=	chmod 755 $@
82
83%LOAD
84
85libkern.a:
86	-@if [ X${PROF} = X ]; \
87	then ln -s $S/libkern/obj/libkern.a libkern.a; \
88	else ln -s $S/libkern/obj/libkern_p.a libkern.a; \
89	fi; \
90	echo ln -s $S/libkern/obj/libkern.a libkern.a
91
92newvers:
93	sh $S/conf/newvers.sh
94	${CC} $(CFLAGS) -c vers.c
95
96clean:
97	rm -f eddep *vmunix vmunix.gdb tags *.o locore.i [a-z]*.s \
98		Errs errs linterrs makelinks
99
100lint: /tmp param.c
101	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
102	    ${PMAX}/pmax/Locore.c ${CFILES} ${PMAX}/pmax/swapgeneric.c \
103	    ioconf.c param.c
104
105symbols.sort: ${PMAX}/pmax/symbols.raw
106	grep -v '^#' ${PMAX}/pmax/symbols.raw \
107	    | sed 's/^	//' | sort -u > symbols.sort
108
109locore.o: ${PMAX}/pmax/locore.s ${PMAX}/include/machAsmDefs.h \
110	${PMAX}/include/machConst.h ${PMAX}/include/reg.h assym.h
111	${CPP} ${COPTS} ${PARAM} -DLOCORE ${PMAX}/pmax/locore.s | \
112	${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
119clock.o machdep.o autoconf.o conf.o: Makefile
120
121# depend on network configuration
122af.o uipc_proto.o vfs_conf.o: Makefile
123
124assym.h: genassym
125	./genassym >assym.h
126
127genassym: ${PMAX}/pmax/genassym.c
128	${CC} ${INCLUDES} ${IDENT} ${PARAM} -o genassym ${PMAX}/pmax/genassym.c
129
130depend: assym.h param.c vnode_if.h
131	mkdep ${COPTS} ${CFILES} ioconf.c param.c
132	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${PMAX}/pmax/genassym.c
133
134links:
135	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
136	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
137	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
138	  sort -u | comm -23 - dontlink | \
139	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
140	sh makelinks && rm -f dontlink
141
142tags:
143	@echo "see $S/kern/Makefile for tags"
144
145ioconf.o: ioconf.c
146	${CC} -c ${CFLAGS} ioconf.c
147
148param.c: $S/conf/param.c
149	rm -f param.c
150	cp $S/conf/param.c .
151
152param.o: param.c Makefile
153	${CC} -c ${CFLAGS} ${PARAM} param.c
154
155vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
156	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
157vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
158	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
159
160%RULES
161