1# $NetBSD: bsd.sys.mk,v 1.87 2003/05/30 18:43:24 thorpej Exp $ 2# 3# Build definitions used for NetBSD source tree builds. 4 5.if !target(__bsd_sys_mk__) 6__bsd_sys_mk__: 7 8.if defined(WARNS) 9.if ${WARNS} > 0 10CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith 11#CFLAGS+= -Wmissing-declarations -Wredundant-decls -Wnested-externs 12# Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3, 13# but our sources aren't up for it yet. 14CFLAGS+= -Wno-sign-compare 15# XXX Delete -Wuninitialized by default for now -- the compiler doesn't 16# XXX always get it right. 17CFLAGS+= -Wno-uninitialized 18.endif 19.if ${WARNS} > 1 20CFLAGS+= -Wreturn-type -Wswitch -Wshadow 21.endif 22.if ${WARNS} > 2 23CFLAGS+= -Wcast-qual -Wwrite-strings 24.endif 25.endif 26 27.if defined(WFORMAT) && defined(FORMAT_AUDIT) 28.if ${WFORMAT} > 1 29CFLAGS+= -Wnetbsd-format-audit -Wno-format-extra-args 30.endif 31.endif 32 33CPPFLAGS+= ${AUDIT:D-D__AUDIT__} 34CFLAGS+= ${CWARNFLAGS} ${NOGCCERROR:D:U-Werror} 35LINTFLAGS+= ${DESTDIR:D-d ${DESTDIR}/usr/include} 36 37.if defined(MKSOFTFLOAT) && (${MKSOFTFLOAT} != "no") 38COPTS+= -msoft-float 39FOPTS+= -msoft-float 40.endif 41 42.if defined(MKIEEEFP) && (${MKIEEEFP} != "no") 43.if ${MACHINE_ARCH} == "alpha" 44CFLAGS+= -mieee 45FFLAGS+= -mieee 46.endif 47.endif 48 49.if ${MACHINE} == "sparc64" && ${MACHINE_ARCH} == "sparc" 50CFLAGS+= -Wa,-Av8plus 51.endif 52 53CFLAGS+= ${CPUFLAGS} 54 55# Helpers for cross-compiling 56HOST_CC?= cc 57HOST_CFLAGS?= -O 58HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} -c 59HOST_LINK.c?= ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS} 60 61HOST_CXX?= c++ 62HOST_CXXFLAGS?= -O 63 64HOST_CPP?= cpp 65HOST_CPPFLAGS?= 66 67HOST_LD?= ld 68HOST_LDFLAGS?= 69 70HOST_AR?= ar 71HOST_RANLIB?= ranlib 72 73.if !empty(HOST_CYGWIN) 74HOST_SH?= /usr/bin/bash 75.else 76HOST_SH?= sh 77.endif 78 79CAP_MKDB?= cap_mkdb 80CAT?= cat 81CKSUM?= cksum 82CONFIG?= config 83CRUNCHGEN?= crunchgen 84TOOL_DB?= db 85ELF2ECOFF?= elf2ecoff 86FGEN?= fgen 87GROFF?= groff 88INSTALLBOOT?= installboot 89MAKEFS?= makefs 90MDSETIMAGE?= mdsetimage 91MKDEP?= mkdep 92MKLOCALE?= mklocale 93MTREE?= mtree 94OBJCOPY?= objcopy 95PAX?= pax 96PWD_MKDB?= pwd_mkdb 97RPCGEN?= rpcgen 98STRIP?= strip 99SUNLABEL?= sunlabel 100 101.SUFFIXES: .m .o .ln .lo 102 103# Objective C 104# (Defined here rather than in <sys.mk> because `.m' is not just 105# used for Objective C source) 106.m: 107 ${LINK.m} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 108.m.o: 109 ${COMPILE.m} ${.IMPSRC} 110 111# Host-compiled C objects 112# The intermediate step is necessary for Sun CC, which objects to calling 113# object files anything but *.o 114.c.lo: 115 ${HOST_COMPILE.c} -o ${.TARGET}.o ${.IMPSRC} 116 mv ${.TARGET}.o ${.TARGET} 117 118# Lex 119LPREFIX?= yy 120LFLAGS+= -P${LPREFIX} 121 122.l.o: # remove to force use of .l.c->.c.o transforms 123.l: 124 ${LEX.l} -o${.TARGET:R}.${LPREFIX}.c ${.IMPSRC} 125 ${LINK.c} -o ${.TARGET} ${.TARGET:R}.${LPREFIX}.c ${LDLIBS} -ll 126 rm -f ${.TARGET:R}.${LPREFIX}.c 127.l.c: 128 ${LEX.l} -o${.TARGET} ${.IMPSRC} 129 130# Yacc 131YFLAGS+= ${YPREFIX:D-p${YPREFIX}} ${YHEADER:D-d} 132 133.y.o: # remove to force use of .y.c->.c.o transforms 134.y: 135 ${YACC.y} -b ${.TARGET:R} ${.IMPSRC} 136 ${LINK.c} -o ${.TARGET} ${.TARGET:R}.tab.c ${LDLIBS} 137 rm -f ${.TARGET:R}.tab.[ch] 138.y.c: 139 ${YACC.y} -o ${.TARGET} ${.IMPSRC} 140 141.ifdef YHEADER 142.y.h: ${.TARGET:.h=.c} 143.endif 144 145.endif # __bsd_sys_mk__ 146