misc/61322: bsd.dep.mk disallows shell generated flags in CFLAGS

Valentin A. Alekseev valeks at novel-il.ru
Tue Jan 13 10:41:10 PST 2004


>Number:         61322
>Category:       misc
>Synopsis:       bsd.dep.mk disallows shell generated flags in CFLAGS
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 13 10:40:12 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Valentin A. Alekseev
>Release:        FreeBSD 5.2-CURRENT
>Organization:
n/a
>Environment:
FreeBSD alpha.valabs.spb.ru 5.2-CURRENT FreeBSD 5.2-CURRENT #16: Mon Jan 12 00:44:36 MSK 2004     valeks at alpha.valabs.spb.ru:/usr/obj/usr/src-5-CURRENT/sys/ALPHA  i386

>Description:
bsd.dep.mk disallows usage of shell generated CFLAGS while calling to
mkdep. So there is no portable way to, for e.g., specify place of
libxml2 includes (xml2-config --cflags).
>How-To-Repeat:
Makefile:
..
PROG= xgrep
CFLAGS+= `xml2-config --cflags`
..
Output of make depend:
$ make depend
rm -f .depend
mkdep -f .depend -a       xgrep.c
xgrep.c:6:27: libxml/parser.h: No such file or directory
xgrep.c:7:26: libxml/xpath.h: No such file or directory
mkdep: compile failed

>Fix:
Here is a patch that blindly allows ones to use any shell generated
vars in CFLAGS. Maybe it would be better to replace M`* with M`*-config and M*` with M--cflags`.

--- src/share/mk/bsd.dep.mk.orig        Tue Jan 13 20:34:30 2004         
+++ src/share/mk/bsd.dep.mk     Tue Jan 13 20:58:57 2004                                                                         
@@ -116,18 +116,18 @@                                                            rm -f ${DEPENDFILE}                                              
 .if ${SRCS:M*.[cS]} != ""                                                       ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \                       -           ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BID]*} \                   +           ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BID]*} ${CFLAGS:M`*} ${CFLAGS:M*`}\                                                
            ${.ALLSRC:M*.[cS]}                                            .endif                                                                   .if ${SRCS:M*.cc} != "" || ${SRCS:M*.C} != "" || ${SRCS:M*.cpp} != "" || \                                                      
     ${SRCS:M*.cxx} != ""                                                        ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \                       -           ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BID]*} \               +           ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BID]*} ${CFLAGS:M`*} ${CFLAGS:M*`} \                                           
            ${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cpp} ${.ALLSRC:M*.cxx}                                                 
 .endif                                                                   .if ${SRCS:M*.m} != ""                                                          ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \                       -           ${OBJCFLAGS:M-nostdinc*} ${OBJCFLAGS:M-[BID]*} \             +           ${OBJCFLAGS:M-nostdinc*} ${OBJCFLAGS:M-[BID]*} ${CFLAGS:M`*} ${CFLAGS:M*`} \                                         
            ${OBJCFLAGS:M-Wno-import*} \                                             ${.ALLSRC:M*.m}                                               .endif
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list