1# $NetBSD: bsd.sys.mk,v 1.111 2004/01/27 03:31:48 lukem Exp $ 2# 3# Build definitions used for NetBSD source tree builds. 4 5.if !defined(_BSD_SYS_MK_) 6_BSD_SYS_MK_=1 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. Also, add -Wno-traditional because 14# gcc includes #elif in the warnings, which is 'this code will not compile 15# in a traditional environment' warning, as opposed to 'this code behaves 16# differently in traditional and ansi environments' which is the warning 17# we wanted, and now we don't get anymore. 18CFLAGS+= -Wno-sign-compare -Wno-traditional 19# XXX Delete -Wuninitialized by default for now -- the compiler doesn't 20# XXX always get it right. 21CFLAGS+= -Wno-uninitialized 22.endif 23.if ${WARNS} > 1 24CFLAGS+= -Wreturn-type -Wswitch -Wshadow 25.endif 26.if ${WARNS} > 2 27CFLAGS+= -Wcast-qual -Wwrite-strings 28.endif 29.endif 30 31.if defined(WFORMAT) && defined(FORMAT_AUDIT) 32.if ${WFORMAT} > 1 33CFLAGS+= -Wnetbsd-format-audit -Wno-format-extra-args 34.endif 35.endif 36 37CPPFLAGS+= ${AUDIT:D-D__AUDIT__} 38CFLAGS+= ${CWARNFLAGS} ${NOGCCERROR:D:U-Werror} 39LINTFLAGS+= ${DESTDIR:D-d ${DESTDIR}/usr/include} 40 41.if defined(MKSOFTFLOAT) && (${MKSOFTFLOAT} != "no") 42COPTS+= -msoft-float 43FOPTS+= -msoft-float 44.endif 45 46.if defined(MKIEEEFP) && (${MKIEEEFP} != "no") 47.if ${MACHINE_ARCH} == "alpha" 48CFLAGS+= -mieee 49FFLAGS+= -mieee 50.endif 51.endif 52 53.if ${MACHINE} == "sparc64" && ${MACHINE_ARCH} == "sparc" 54CFLAGS+= -Wa,-Av8plus 55.endif 56 57CFLAGS+= ${CPUFLAGS} 58 59# Helpers for cross-compiling 60HOST_CC?= cc 61HOST_CFLAGS?= -O 62HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} -c 63HOST_LINK.c?= ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS} 64 65HOST_CXX?= c++ 66HOST_CXXFLAGS?= -O 67 68HOST_CPP?= cpp 69HOST_CPPFLAGS?= 70 71HOST_LD?= ld 72HOST_LDFLAGS?= 73 74HOST_AR?= ar 75HOST_RANLIB?= ranlib 76 77HOST_LN?= ln 78 79.if !empty(HOST_CYGWIN) 80HOST_SH?= /usr/bin/bash 81.else 82HOST_SH?= sh 83.endif 84 85ELF2ECOFF?= elf2ecoff 86MKDEP?= mkdep 87OBJCOPY?= objcopy 88STRIP?= strip 89 90AWK?= awk 91 92TOOL_ASN1_COMPILE?= asn1_compile 93TOOL_CAP_MKDB?= cap_mkdb 94TOOL_CAT?= cat 95TOOL_CKSUM?= cksum 96TOOL_COMPILE_ET?= compile_et 97TOOL_CONFIG?= config 98TOOL_CRUNCHGEN?= crunchgen 99TOOL_CTAGS?= ctags 100TOOL_DB?= db 101TOOL_EQN?= eqn 102TOOL_FGEN?= fgen 103TOOL_GENCAT?= gencat 104TOOL_GROFF?= groff 105TOOL_HEXDUMP?= hexdump 106TOOL_INDXBIB?= indxbib 107TOOL_INSTALLBOOT?= installboot 108TOOL_INSTALL_INFO?= install-info 109TOOL_M4?= m4 110TOOL_MAKEFS?= makefs 111TOOL_MAKEINFO?= makeinfo 112TOOL_MAKEWHATIS?= /usr/libexec/makewhatis 113TOOL_MDSETIMAGE?= mdsetimage 114TOOL_MENUC?= menuc 115TOOL_MKCSMAPPER?= mkcsmapper 116TOOL_MKESDB?= mkesdb 117TOOL_MKLOCALE?= mklocale 118TOOL_MKMAGIC?= file 119TOOL_MKTEMP?= mktemp 120TOOL_MSGC?= msgc 121TOOL_MTREE?= mtree 122TOOL_PAX?= pax 123TOOL_PIC?= pic 124TOOL_PREPMKBOOTIMAGE?= prep-mkbootimage 125TOOL_PWD_MKDB?= pwd_mkdb 126TOOL_REFER?= refer 127TOOL_ROFF_ASCII?= nroff 128TOOL_ROFF_DVI?= ${TOOL_GROFF} -Tdvi 129TOOL_ROFF_HTML?= ${TOOL_GROFF} -Tlatin1 -mdoc2html 130TOOL_ROFF_PS?= ${TOOL_GROFF} -Tps 131TOOL_ROFF_RAW?= ${TOOL_GROFF} -Z 132TOOL_RPCGEN?= rpcgen 133TOOL_SOELIM?= soelim 134TOOL_STAT?= stat 135TOOL_SUNLABEL?= sunlabel 136TOOL_TBL?= tbl 137TOOL_UUDECODE?= uudecode 138TOOL_VGRIND?= vgrind -f 139TOOL_ZIC?= zic 140 141.SUFFIXES: .o .ln .lo .c ${YHEADER:D.h} 142 143# C 144.c.o: 145 ${_MKTARGET_COMPILE} 146 ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 147.c.ln: 148 ${_MKTARGET_COMPILE} 149 ${LINT} ${LINTFLAGS} \ 150 ${CPPFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 151 ${CPPFLAGS.${.IMPSRC:T}:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 152 -i ${.IMPSRC} 153 154# C++ 155.cc.o .cpp.o .cxx.o .C.o: 156 ${_MKTARGET_COMPILE} 157 ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 158 159# Objective C 160# (Defined here rather than in <sys.mk> because `.m' is not just 161# used for Objective C source) 162.m.o: 163 ${_MKTARGET_COMPILE} 164 ${COMPILE.m} ${.IMPSRC} 165 166# Host-compiled C objects 167# The intermediate step is necessary for Sun CC, which objects to calling 168# object files anything but *.o 169.c.lo: 170 ${_MKTARGET_COMPILE} 171 ${HOST_COMPILE.c} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 172 mv ${.TARGET}.o ${.TARGET} 173 174# Assembly 175.s.o: 176 ${_MKTARGET_COMPILE} 177 ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 178 179.S.o: 180 ${_MKTARGET_COMPILE} 181 ${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 182 183# Lex 184LPREFIX?= yy 185LFLAGS+= -P${LPREFIX} 186 187.l.c: 188 ${_MKTARGET_LEX} 189 ${LEX.l} -o${.TARGET} ${.IMPSRC} 190 191# Yacc 192YFLAGS+= ${YPREFIX:D-p${YPREFIX}} ${YHEADER:D-d} 193 194.y.c: 195 ${_MKTARGET_YACC} 196 ${YACC.y} -o ${.TARGET} ${.IMPSRC} 197 198.ifdef YHEADER 199.y.h: ${.TARGET:.h=.c} 200.endif 201 202.endif # !defined(_BSD_SYS_MK_) 203