Makefile.landisk revision 1.11
1# $OpenBSD: Makefile.landisk,v 1.11 2009/08/09 23:04:49 miod Exp $ 2# 3# Makefile for OpenBSD/landisk 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/arch/landisk/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/landisk/conf/Makefile.landisk 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.SUFFIXES: .S .c .o 22 23# DEBUG is set to -g if debugging. 24# PROF is set to -pg if profiling. 25 26.include <bsd.own.mk> 27 28MKDEP?= mkdep 29STRIP?= strip 30SIZE?= size 31 32# source tree is located via $S relative to the compilation directory 33.ifndef S 34S!= cd ../../../..; pwd 35.endif 36LANDISK= $S/arch/landisk 37SH= $S/arch/sh 38 39INCLUDES= -I. -I$S -I$S/arch -nostdinc 40CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Dlandisk 41CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 42 -Wno-uninitialized -Wno-format -Wno-main \ 43 -Wstack-larger-than-2047 -Wvariable-decl 44CMACHFLAGS= -m4-nofpu \ 45 -fno-builtin-printf -fno-builtin-log -fno-builtin-main 46.if ${IDENT:M-DNO_PROPOLICE} 47CMACHFLAGS+= -fno-stack-protector 48.endif 49COPTS?= -O2 50CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE} 51AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-little 52LINKFLAGS= -N -Ttext 0x8c002000 -e start --warn-common 53STRIPFLAGS= -g -X -x 54 55.if ${IDENT:M-DDDB_STRUCT} 56DB_STRUCTINFO= db_structinfo.h 57.else 58DB_STRUCTINFO= 59.endif 60 61HOSTCC?= ${CC} 62HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 63HOSTED_CFLAGS= ${CFLAGS} 64 65# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP} 66# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix, 67# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file 68# is marked as config-dependent. 69 70NORMAL_C_NOP= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 71NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 72NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< 73 74DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 75DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< 76 77NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 78NORMAL_S_C= ${AS} ${COPTS} ${PARAM} $< -o $@ 79 80 81%OBJS 82 83%CFILES 84 85%SFILES 86 87# load lines for config "xxx" will be emitted as: 88# xxx: ${SYSTEM_DEP} swapxxx.o 89# ${SYSTEM_LD_HEAD} 90# ${SYSTEM_LD} swapxxx.o 91# ${SYSTEM_LD_TAIL} 92SYSTEM_OBJ= locore.o param.o ioconf.o ${OBJS} 93SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 94SYSTEM_LD_HEAD= rm -f $@ 95SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 96 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 97SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 98 99DEBUG?= 100.if ${DEBUG} == "-g" 101LINKFLAGS+= -X 102SYSTEM_LD_TAIL+=; \ 103 echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \ 104 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 105 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 106.else 107LINKFLAGS+= -S -x 108.endif 109 110%LOAD 111 112assym.h: $S/kern/genassym.sh \ 113 ${SH}/sh/genassym.cf Makefile 114 cat ${SH}/sh/genassym.cf | \ 115 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} \ 116 > assym.h.tmp && \ 117 mv -f assym.h.tmp assym.h 118 119param.c: $S/conf/param.c 120 rm -f param.c 121 cp $S/conf/param.c . 122 123param.o: param.c Makefile 124 ${NORMAL_C_C} 125 126mcount.o: $S/lib/libkern/mcount.c Makefile 127 ${NORMAL_C_NOP} 128 129ioconf.o: ioconf.c 130 ${NORMAL_C} 131 132newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 133 sh $S/conf/newvers.sh 134 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 135 136clean:: 137 rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ 138 [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} 139 140lint: 141 @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB ${CFILES} \ 142 ioconf.c param.c | \ 143 grep -v 'static function .* unused' 144 145tags: 146 @echo "see $S/kern/Makefile for tags" 147 148links: 149 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 150 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 151 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 152 sort -u | comm -23 - dontlink | \ 153 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 154 sh makelinks && rm -f dontlink 155 156SRCS= ${LANDISK}/landisk/locore.S \ 157 param.c ioconf.c ${CFILES} ${SFILES} 158depend:: .depend 159.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} 160 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${LANDISK}/landisk/locore.S 161 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 162.if ${SFILES} != "" 163 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 164.endif 165 cat ${SH}/sh/genassym.cf | \ 166 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} ${CPPFLAGS} 167 @sed -e 's/.*\.o: /assym.h: /' -e 's/\/tmp\/genassym_c.[^ ]*//' \ 168 < assym.dep >> .depend 169 @rm -f assym.dep 170 171db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk 172 ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c 173 objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ 174 rm -f db_structinfo.o 175 176# depend on root or device configuration 177autoconf.o conf.o: Makefile 178 179# depend on network or filesystem configuration 180uipc_proto.o vfs_conf.o: Makefile 181 182# depend on maxusers 183assym.h machdep.o: Makefile 184 185# depend on CPU configuration 186locore.o machdep.o: Makefile 187 188locore.o: ${LANDISK}/landisk/locore.S assym.h 189 ${NORMAL_S} 190 191# The install target can be redefined by putting a 192# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 193MACHINE_NAME!= uname -n 194install: install-kernel-${MACHINE_NAME} 195.if !target(install-kernel-${MACHINE_NAME}}) 196install-kernel-${MACHINE_NAME}: 197 rm -f /obsd 198 ln /bsd /obsd 199 cp bsd /nbsd 200 mv /nbsd /bsd 201.endif 202 203%RULES 204