Partially sent to freebsd-hackers (2011-07-02) --- a/sys/dev/aic7xxx/aicasm/Makefile +++ b/sys/dev/aic7xxx/aicasm/Makefile @@ -3,6 +3,10 @@ # # $FreeBSD$ +.if !defined(OPSYS) +OPSYS!= uname -s +.endif + PROG= aicasm CSRCS= aicasm.c aicasm_symbol.c @@ -14,8 +18,9 @@ SRCS= ${GENHDRS} ${CSRCS} ${YSRCS} ${LSRCS} CLEANFILES+= ${GENHDRS} ${YSRCS:R:C/(.*)/\1.output/g} DPADD= ${LIBL} -LDADD= -ll +LDADD= -ll -ldb -lbsd WARNS?= 5 +NO_WERROR?= 1 # Correct path for kernel builds # Don't rely on the kernel's .depend file @@ -24,8 +29,15 @@ DEPENDFILE= .depend_aicasm .endif +LIBBSD_CFLAGS!= pkg-config --cflags libbsd-overlay +CFLAGS+= ${LIBBSD_CFLAGS} + +# This would discard implicit include flags in upstream GCC +.if ${OPSYS} == "FreeBSD" NOSTDINC= -nostdinc CFLAGS+= ${NOSTDINC} -I/usr/include -I. +.endif + .ifdef MAKESRCPATH CFLAGS+= -I${MAKESRCPATH} .endif --- a/sys/dev/aic7xxx/aicasm/aicasm_gram.y +++ b/sys/dev/aic7xxx/aicasm/aicasm_gram.y @@ -1529,7 +1529,7 @@ } static void -add_macro_arg(const char *argtext, int argnum __unused) +add_macro_arg(const char *argtext, int argnum) { struct macro_arg *marg; int retval; --- a/sys/dev/aic7xxx/aicasm/aicasm_symbol.c +++ b/sys/dev/aic7xxx/aicasm/aicasm_symbol.c @@ -44,7 +44,7 @@ #include #include -#ifdef BSD +#if defined(BSD) && !defined(__GNU__) #include #else #include