Makefile.landisk revision 1.31
1# $OpenBSD: Makefile.landisk,v 1.31 2010/05/24 23:19:22 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 14SIZE?= size 15STRIP?= strip 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= -nostdinc -I. -I$S -I$S/arch 28CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ 29CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 30 -Wno-main -Wno-uninitialized -Wno-format \ 31 -Wstack-larger-than-2047 32 33CMACHFLAGS= -m4-nofpu 34CMACHFLAGS+= -fno-builtin-printf -fno-builtin-snprintf \ 35 -fno-builtin-vsnprintf -fno-builtin-log \ 36 -fno-builtin-log2 -fno-builtin-malloc 37.if ${IDENT:M-DNO_PROPOLICE} 38CMACHFLAGS+= -fno-stack-protector 39.endif 40 41COPTS?= -O2 42CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE} 43AFLAGS= -D_LOCORE -x assembler-with-cpp -traditional-cpp ${CMACHFLAGS} 44LINKFLAGS= -N -Ttext 0x8c002000 -e start --warn-common 45STRIPFLAGS= -g -x 46 47.if ${IDENT:M-DDDB_STRUCT} 48DB_STRUCTINFO= db_structinfo.h 49.else 50DB_STRUCTINFO= 51.endif 52 53HOSTCC?= ${CC} 54HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 55HOSTED_CFLAGS= ${CFLAGS} 56HOSTED_C= ${HOSTCC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 57 58NORMAL_C_NOP= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 59NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 60NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 61 62%OBJS 63 64%CFILES 65 66%SFILES 67 68# load lines for config "xxx" will be emitted as: 69# xxx: ${SYSTEM_DEP} swapxxx.o 70# ${SYSTEM_LD_HEAD} 71# ${SYSTEM_LD} swapxxx.o 72# ${SYSTEM_LD_TAIL} 73SYSTEM_OBJ= locore.o param.o ioconf.o ${OBJS} 74SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 75SYSTEM_LD_HEAD= @rm -f $@ 76SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 77 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 78SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 79 80DEBUG?= 81.if ${DEBUG} == "-g" 82LINKFLAGS+= -X 83SYSTEM_LD_TAIL+=; \ 84 echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \ 85 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 86 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 87.else 88LINKFLAGS+= -S -x 89.endif 90 91%LOAD 92 93assym.h: $S/kern/genassym.sh Makefile \ 94 ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf 95 cat ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf | \ 96 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PARAM} | \ 97 sort -u > assym.h.tmp && \ 98 mv -f assym.h.tmp assym.h 99 100param.c: $S/conf/param.c 101 rm -f param.c 102 cp $S/conf/param.c . 103 104param.o: param.c Makefile 105 ${NORMAL_C} 106 107mcount.o: $S/lib/libkern/mcount.c Makefile 108 ${NORMAL_C_NOP} 109 110ioconf.o: ioconf.c 111 ${NORMAL_C} 112 113vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 114 sh $S/conf/newvers.sh 115 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 116 117clean:: 118 rm -f eddep *bsd *bsd.gdb tags *.[io] [a-z]*.s \ 119 [Ee]rrs linterrs assym.h ${DB_STRUCTINFO} 120 121lint: 122 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 123 ${CFILES} ioconf.c param.c | \ 124 grep -v 'static function .* unused' 125 126tags: 127 @echo "see $S/kern/Makefile for tags" 128 129AFILES= ${_machdir}/${_mach}/locore.S 130SRCS= ${AFILES} param.c ioconf.c ${CFILES} ${SFILES} 131depend:: .depend 132.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} 133 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${AFILES} 134 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 135.if !empty(SFILES) 136 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 137.endif 138 cat ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf | \ 139 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} ${CPPFLAGS} 140 @sed -e 's/.*\.o: /assym.h: /' -e 's/\/tmp\/genassym_c.[^ ]*//' \ 141 < assym.dep >> .depend 142 @rm -f assym.dep 143 144db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk 145 ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c 146 objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ 147 rm -f db_structinfo.o 148 149locore.o: ${_machdir}/${_mach}/locore.S assym.h 150 ${NORMAL_S} 151 152# The install target can be redefined by putting a 153# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 154MACHINE_NAME!= uname -n 155install: install-kernel-${MACHINE_NAME} 156.if !target(install-kernel-${MACHINE_NAME}}) 157install-kernel-${MACHINE_NAME}: 158 rm -f /obsd 159 ln /bsd /obsd 160 cp bsd /nbsd 161 mv /nbsd /bsd 162.endif 163 164%RULES 165