1# @(#)Makefile.i386 7.2 (Berkeley) 11/13/91 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. 23# PROF is set to -pg by config if profiling is requested. 24AS= as ${DEBUG} 25CC= cc ${DEBUG} 26CPP= cpp 27LD= ld 28TOUCH= touch -f -c 29GPROF.EX=/usr/src/usr.lib/libc/csu/i386/gmon.ex 30 31# source tree is located via $S relative to the compilation directory 32S= ../.. 33I386= $S/i386 34 35INCLUDES= -I. -I$S -I$S/sys 36COPTS+= ${INCLUDES} ${IDENT} -DKERNEL 37CFLAGS= -O ${COPTS} 38 39# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP} 40# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix, 41# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file 42# is marked as config-dependent. 43 44NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $< 45NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 46 47DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $< 48DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 49 50PROFILE_C= ${CC} -S -c ${COPTS} $<; \ 51 ex - $*.s < ${GPROF.EX}; \ 52 ${AS} -o $@ $*.s; \ 53 rm -f $*.s 54 55NORMAL_S= ${CPP} ${COPTS} $< | ${AS} -o $@ 56NORMAL_S_C= ${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@ 57 58%OBJS 59 60%CFILES 61 62# load lines for config "xxx" will be emitted as: 63# xxx: ${SYSTEM_DEP} swapxxx.o 64# ${SYSTEM_LD_HEAD} 65# ${SYSTEM_LD} swapxxx.o 66# ${SYSTEM_LD_TAIL} 67SYSTEM_OBJ= locore.o ${OBJS} param.o ioconf.o 68#SYSTEM_DEP= Makefile symbols.sort ${SYSTEM_OBJ} 69SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 70SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ 71SYSTEM_LD= @strip=-x; [ X${DEBUG} = X-g ] && strip=-X; \ 72 ${LD} $$strip -n -T FE000000 -o $@ ${SYSTEM_OBJ} vers.o 73#SYSTEM_LD_TAIL= @echo rearranging symbols;\ 74# symorder symbols.sort $@;\ 75SYSTEM_LD_TAIL= @size $@; chmod 755 $@; \ 76 [ X${DEBUG} = X-g ] && { \ 77 echo cp $@ $@.gdb; cp $@ $@.gdb; \ 78 echo strip -d $@; strip -d $@; } 79 80%LOAD 81 82newvers: 83 sh $S/conf/newvers.sh 84 ${CC} $(CFLAGS) -c vers.c 85 86clean: 87 rm -f eddep *vmunix tags *.o locore.i [a-z]*.s \ 88 Errs errs linterrs makelinks 89 90lint: /tmp param.c 91 @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \ 92 ${I386}/i386/Locore.c ${CFILES} ${I386}/i386/swapgeneric.c \ 93 ioconf.c param.c| \ 94 grep -v 'struct/union .* never defined' | \ 95 grep -v 'possible pointer alignment problem' 96 97symbols.sort: ${I386}/i386/symbols.raw 98 grep -v '^#' ${I386}/i386/symbols.raw \ 99 | sed 's/^ //' | sort -u > symbols.sort 100 101locore.o: assym.s vector.s ${I386}/i386/locore.s 102locore.o: ${I386}/include/trap.h ${I386}/include/psl.h ${I386}/i386/pte.h 103locore.o: ${I386}/include/cpu.h 104 ${CPP} -DLOCORE ${COPTS} ${I386}/i386/locore.s | ${AS} -o locore.o 105 106# the following is necessary because autoconf.o depends on #if GENERIC 107autoconf.o: Makefile 108 109# the following are necessary because the files depend on the types of 110# hp cpu's included in the system configuration 111clock.o machdep.o autoconf.o conf.o: Makefile 112 113# depend on network configuration 114af.o uipc_proto.o locore.o: Makefile 115 116# depend on maxusers 117assym.s: Makefile 118 119assym.s: genassym 120 ./genassym >assym.s 121 122genassym: 123 ${CC} ${INCLUDES} ${IDENT} ${PARAM} -Di386 -o genassym \ 124 ${I386}/i386/genassym.c 125 126depend: assym.s param.c 127 mkdep ${COPTS} ${CFILES} ioconf.c param.c 128 mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c 129 130links: 131 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 132 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 133 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 134 sort -u | comm -23 - dontlink | \ 135 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 136 sh makelinks && rm -f dontlink 137 138tags: 139 @echo "see $S/kern/Makefile for tags" 140 141ioconf.o: ioconf.c 142 ${CC} -c ${CFLAGS} ioconf.c 143 144param.c: $S/conf/param.c 145 rm -f param.c 146 cp $S/conf/param.c . 147 148param.o: param.c Makefile 149 ${CC} -c ${CFLAGS} ${PARAM} param.c 150 151%RULES 152