Makefile.landisk revision 1.22
1# $OpenBSD: Makefile.landisk,v 1.22 2010/04/27 06:46:26 deraadt Exp $ 2 3# For instructions on building kernels consult the config(8) and options(4) 4# manual pages. 5# 6# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE 7# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING 8# DEBUG is set to -g by config if debugging is requested (config -g). 9# PROF is set to -pg by config if profiling is requested (config -p). 10 11.include <bsd.own.mk> 12 13MKDEP?= mkdep 14STRIP?= strip 15SIZE?= size 16 17# source tree is located via $S relative to the compilation directory 18.ifndef S 19S!= cd ../../../..; pwd 20.endif 21 22_mach?= landisk 23_arch?= sh 24_machdir?= $S/arch/${_mach} 25_archdir?= $S/arch/${_arch} 26 27INCLUDES= -I. -I$S -I$S/arch -nostdinc 28CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Dlandisk 29CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 30 -Wno-uninitialized -Wno-format -Wno-main \ 31 -Wstack-larger-than-2047 -Wvariable-decl 32CMACHFLAGS= -m4-nofpu \ 33 -fno-builtin-printf -fno-builtin-log -fno-builtin-main 34.if ${IDENT:M-DNO_PROPOLICE} 35CMACHFLAGS+= -fno-stack-protector 36.endif 37COPTS?= -O2 38CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE} 39AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-little 40LINKFLAGS= -N -Ttext 0x8c002000 -e start --warn-common 41STRIPFLAGS= -g -X -x 42 43.if ${IDENT:M-DDDB_STRUCT} 44DB_STRUCTINFO= db_structinfo.h 45.else 46DB_STRUCTINFO= 47.endif 48 49HOSTCC?= ${CC} 50HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 51HOSTED_CFLAGS= ${CFLAGS} 52 53# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP} 54# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix, 55# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file 56# is marked as config-dependent. 57 58NORMAL_C_NOP= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 59NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 60NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< 61 62DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 63DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< 64 65NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 66NORMAL_S_C= ${AS} ${COPTS} ${PARAM} $< -o $@ 67 68 69%OBJS 70 71%CFILES 72 73%SFILES 74 75# load lines for config "xxx" will be emitted as: 76# xxx: ${SYSTEM_DEP} swapxxx.o 77# ${SYSTEM_LD_HEAD} 78# ${SYSTEM_LD} swapxxx.o 79# ${SYSTEM_LD_TAIL} 80SYSTEM_OBJ= locore.o param.o ioconf.o ${OBJS} 81SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 82SYSTEM_LD_HEAD= rm -f $@ 83SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 84 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 85SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 86 87DEBUG?= 88.if ${DEBUG} == "-g" 89LINKFLAGS+= -X 90SYSTEM_LD_TAIL+=; \ 91 echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \ 92 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 93 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 94.else 95LINKFLAGS+= -S -x 96.endif 97 98%LOAD 99 100assym.h: $S/kern/genassym.sh Makefile \ 101 ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf 102 cat ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf | \ 103 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PARAM} | \ 104 sort -u > assym.h.tmp && \ 105 mv -f assym.h.tmp assym.h 106 107param.c: $S/conf/param.c 108 rm -f param.c 109 cp $S/conf/param.c . 110 111param.o: param.c Makefile 112 ${NORMAL_C_C} 113 114mcount.o: $S/lib/libkern/mcount.c Makefile 115 ${NORMAL_C_NOP} 116 117ioconf.o: ioconf.c 118 ${NORMAL_C} 119 120vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 121 sh $S/conf/newvers.sh 122 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 123 124clean:: 125 rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ 126 [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} 127 128lint: 129 @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB ${CFILES} \ 130 ioconf.c param.c | \ 131 grep -v 'static function .* unused' 132 133tags: 134 @echo "see $S/kern/Makefile for tags" 135 136links: 137 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 138 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 139 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 140 sort -u | comm -23 - dontlink | \ 141 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 142 sh makelinks && rm -f dontlink 143 144SRCS= ${_machdir}/${_mach}/locore.S \ 145 param.c ioconf.c ${CFILES} ${SFILES} 146depend:: .depend 147.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} 148 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${_machdir}/${_mach}/locore.S 149 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 150.if ${SFILES} != "" 151 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 152.endif 153 cat ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf | \ 154 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} ${CPPFLAGS} 155 @sed -e 's/.*\.o: /assym.h: /' -e 's/\/tmp\/genassym_c.[^ ]*//' \ 156 < assym.dep >> .depend 157 @rm -f assym.dep 158 159db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk 160 ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c 161 objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ 162 rm -f db_structinfo.o 163 164locore.o: ${_machdir}/${_mach}/locore.S assym.h 165 ${NORMAL_S} 166 167# The install target can be redefined by putting a 168# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 169MACHINE_NAME!= uname -n 170install: install-kernel-${MACHINE_NAME} 171.if !target(install-kernel-${MACHINE_NAME}}) 172install-kernel-${MACHINE_NAME}: 173 rm -f /obsd 174 ln /bsd /obsd 175 cp bsd /nbsd 176 mv /nbsd /bsd 177.endif 178 179%RULES 180