Makefile.landisk revision 1.1
1# $OpenBSD: Makefile.landisk,v 1.1 2006/10/06 21:16:15 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/arch -I$S -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 44CMACHFLAGS= -m4-nofpu \ 45 -fno-builtin-printf -fno-builtin-log -fno-builtin-main 46.if ${IDENT:M-DNO_PROPOLICE} 47CMACHFLAGS+= -fno-stack-protector 48.else 49# to prevent the sky from falling on our heads 50CMACHFLAGS+= -fno-stack-protector 51.endif 52COPTS?= -O2 53CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE} 54AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-little 55LINKFLAGS= -N -Ttext 0x8c001000 -e start --warn-common 56STRIPFLAGS= -g -X -x 57 58HOSTCC?= ${CC} 59HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 60HOSTED_CFLAGS= ${CFLAGS} 61 62### find out what to use for libkern 63.include "$S/lib/libkern/Makefile.inc" 64.ifndef PROF 65LIBKERN= ${KERNLIB} 66.else 67LIBKERN= ${KERNLIB_PROF} 68.endif 69 70### find out what to use for libcompat 71.include "$S/compat/common/Makefile.inc" 72.ifndef PROF 73LIBCOMPAT= ${COMPATLIB} 74.else 75LIBCOMPAT= ${COMPATLIB_PROF} 76.endif 77 78# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP} 79# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix, 80# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file 81# is marked as config-dependent. 82 83USRLAND_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 84USRLAND_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< 85 86NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 87NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< 88 89DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 90DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< 91 92NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 93NORMAL_S_C= ${AS} ${COPTS} ${PARAM} $< -o $@ 94 95 96%OBJS 97 98%CFILES 99 100%SFILES 101 102# load lines for config "xxx" will be emitted as: 103# xxx: ${SYSTEM_DEP} swapxxx.o 104# ${SYSTEM_LD_HEAD} 105# ${SYSTEM_LD} swapxxx.o 106# ${SYSTEM_LD_TAIL} 107SYSTEM_OBJ= locore.o param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 108SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 109SYSTEM_LD_HEAD= rm -f $@ 110SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 111 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 112SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 113 114DEBUG?= 115.if ${DEBUG} == "-g" 116LINKFLAGS+= -X 117SYSTEM_LD_TAIL+=; \ 118 echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \ 119 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 120 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 121.else 122LINKFLAGS+= -S -x 123.endif 124 125%LOAD 126 127assym.h: $S/kern/genassym.sh \ 128 ${SH}/sh/genassym.cf Makefile 129 cat ${SH}/sh/genassym.cf | \ 130 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} \ 131 > assym.h.tmp && \ 132 mv -f assym.h.tmp assym.h 133 134param.c: $S/conf/param.c 135 rm -f param.c 136 cp $S/conf/param.c . 137 138param.o: param.c Makefile 139 ${NORMAL_C_C} 140 141ioconf.o: ioconf.c 142 ${NORMAL_C} 143 144newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 145 sh $S/conf/newvers.sh 146 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 147 148clean:: 149 rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ 150 [Ee]rrs linterrs makelinks genassym genassym.o assym.h 151 152lint: 153 @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB ${CFILES} \ 154 ioconf.c param.c | \ 155 grep -v 'static function .* unused' 156 157tags: 158 @echo "see $S/kern/Makefile for tags" 159 160links: 161 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 162 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 163 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 164 sort -u | comm -23 - dontlink | \ 165 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 166 sh makelinks && rm -f dontlink 167 168SRCS= ${LANDISK}/landisk/locore.S \ 169 param.c ioconf.c ${CFILES} ${SFILES} 170depend:: .depend 171.depend: ${SRCS} assym.h param.c 172 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${LANDISK}/landisk/locore.S 173 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 174.if ${SFILES} != "" 175 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 176.endif 177 cat ${SH}/sh/genassym.cf | \ 178 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} ${CPPFLAGS} 179 @sed -e 's/.*\.o:.* /assym.h: /' < assym.dep >> .depend 180 @rm -f assym.dep 181 182# depend on root or device configuration 183autoconf.o conf.o: Makefile 184 185# depend on network or filesystem configuration 186uipc_proto.o vfs_conf.o: Makefile 187 188# depend on maxusers 189assym.h machdep.o: Makefile 190 191# depend on CPU configuration 192locore.o machdep.o: Makefile 193 194 195locore.o: ${LANDISK}/landisk/locore.S assym.h 196 ${NORMAL_S} 197 198# The install target can be redefined by putting a 199# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 200MACHINE_NAME!= uname -n 201install: install-kernel-${MACHINE_NAME} 202.if !target(install-kernel-${MACHINE_NAME}}) 203install-kernel-${MACHINE_NAME}: 204 rm -f /obsd 205 ln /bsd /obsd 206 cp bsd /nbsd 207 mv /nbsd /bsd 208.endif 209 210%RULES 211