diff options
author | Chris Johns <chrisj@rtems.org> | 2016-04-23 17:37:27 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2016-04-23 17:37:27 +1000 |
commit | e1e10cddee4be72c2a66218c2bc0393e578a7fdc (patch) | |
tree | be28236f336ed07b491020c3ebf3cd0ed08e9373 /libbsd_waf.py | |
parent | waf: Move the generated content to libbsd_waf.py. (diff) | |
download | rtems-libbsd-e1e10cddee4be72c2a66218c2bc0393e578a7fdc.tar.bz2 |
waf: Add the ability to set FreeBSD options on the configure command line.
Add --freebsd-options to add specific FreeBSD compile time options to
the build. This is a developer tool.
Diffstat (limited to 'libbsd_waf.py')
-rw-r--r-- | libbsd_waf.py | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/libbsd_waf.py b/libbsd_waf.py index 33784ead..689a72c3 100644 --- a/libbsd_waf.py +++ b/libbsd_waf.py @@ -39,6 +39,11 @@ def build(bld): cflags = ['-std=gnu11'] + common_flags cxxflags = ['-std=gnu++11'] + common_flags + # Defines + defines = [] + for o in bld.env.FREEBSD_OPTIONS.split(","): + defines += ["%s=1" % (o.strip().upper())] + # Include paths includes = [] for i in ['-Irtemsbsd/@CPU@/include', '-Ifreebsd/sys/@CPU@/include']: @@ -136,18 +141,6 @@ def build(bld): # Lex if bld.env.AUTO_REGEN: - bld(target = "freebsd/lib/libc/net/nslexer.c", - source = "freebsd/lib/libc/net/nslexer.l", - rule = "${LEX} -P _nsyy -t ${SRC} | sed -e '/YY_BUF_SIZE/s/16384/1024/' > ${TGT}") - bld.objects(target = "lex__nsyy", - features = "c", - cflags = cflags, - includes = [] + includes, - defines = [], - source = "freebsd/lib/libc/net/nslexer.c") - libbsd_use += ["lex__nsyy"] - - if bld.env.AUTO_REGEN: bld(target = "freebsd/contrib/libpcap/scanner.c", source = "freebsd/contrib/libpcap/scanner.l", rule = "${LEX} -P pcap -t ${SRC} | sed -e '/YY_BUF_SIZE/s/16384/1024/' > ${TGT}") @@ -155,11 +148,23 @@ def build(bld): features = "c", cflags = cflags, includes = [] + includes, - defines = ['__FreeBSD__=1', 'BSD=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_LIMITS_H=1', 'HAVE_INTTYPES=1', 'HAVE_STDINT=1', 'HAVE_STRERROR=1', 'HAVE_STRLCPY=1', 'HAVE_SNPRINTF=1', 'HAVE_VSNPRINTF=1', 'HAVE_SOCKADDR_SA_LEN=1', 'HAVE_NET_IF_MEDIA_H=1', 'HAVE_SYS_IOCCOM_H=1', 'NEED_YYPARSE_WRAPPER=1', 'yylval=pcap_lval'], + defines = defines + ['__FreeBSD__=1', 'BSD=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_LIMITS_H=1', 'HAVE_INTTYPES=1', 'HAVE_STDINT=1', 'HAVE_STRERROR=1', 'HAVE_STRLCPY=1', 'HAVE_SNPRINTF=1', 'HAVE_VSNPRINTF=1', 'HAVE_SOCKADDR_SA_LEN=1', 'HAVE_NET_IF_MEDIA_H=1', 'HAVE_SYS_IOCCOM_H=1', 'NEED_YYPARSE_WRAPPER=1', 'yylval=pcap_lval'], source = "freebsd/contrib/libpcap/scanner.c") libbsd_use += ["lex_pcap"] if bld.env.AUTO_REGEN: + bld(target = "freebsd/lib/libc/net/nslexer.c", + source = "freebsd/lib/libc/net/nslexer.l", + rule = "${LEX} -P _nsyy -t ${SRC} | sed -e '/YY_BUF_SIZE/s/16384/1024/' > ${TGT}") + bld.objects(target = "lex__nsyy", + features = "c", + cflags = cflags, + includes = [] + includes, + defines = defines + [], + source = "freebsd/lib/libc/net/nslexer.c") + libbsd_use += ["lex__nsyy"] + + if bld.env.AUTO_REGEN: bld(target = "freebsd/lib/libipsec/policy_token.c", source = "freebsd/lib/libipsec/policy_token.l", rule = "${LEX} -P __libipsecyy -t ${SRC} | sed -e '/YY_BUF_SIZE/s/16384/1024/' > ${TGT}") @@ -167,7 +172,7 @@ def build(bld): features = "c", cflags = cflags, includes = [] + includes, - defines = [], + defines = defines + [], source = "freebsd/lib/libipsec/policy_token.c") libbsd_use += ["lex___libipsecyy"] @@ -180,21 +185,10 @@ def build(bld): features = "c", cflags = cflags, includes = [] + includes, - defines = ['__FreeBSD__=1', 'BSD=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_LIMITS_H=1', 'HAVE_INTTYPES=1', 'HAVE_STDINT=1', 'HAVE_STRERROR=1', 'HAVE_STRLCPY=1', 'HAVE_SNPRINTF=1', 'HAVE_VSNPRINTF=1', 'HAVE_SOCKADDR_SA_LEN=1', 'HAVE_NET_IF_MEDIA_H=1', 'HAVE_SYS_IOCCOM_H=1', 'NEED_YYPARSE_WRAPPER=1', 'yylval=pcap_lval'], + defines = defines + ['__FreeBSD__=1', 'BSD=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_LIMITS_H=1', 'HAVE_INTTYPES=1', 'HAVE_STDINT=1', 'HAVE_STRERROR=1', 'HAVE_STRLCPY=1', 'HAVE_SNPRINTF=1', 'HAVE_VSNPRINTF=1', 'HAVE_SOCKADDR_SA_LEN=1', 'HAVE_NET_IF_MEDIA_H=1', 'HAVE_SYS_IOCCOM_H=1', 'NEED_YYPARSE_WRAPPER=1', 'yylval=pcap_lval'], source = "freebsd/contrib/libpcap/grammar.c") libbsd_use += ["yacc_pcap"] if bld.env.AUTO_REGEN: - bld(target = "freebsd/lib/libipsec/policy_parse.c", - source = "freebsd/lib/libipsec/policy_parse.y", - rule = "${YACC} -b __libipsecyy -d -p __libipsecyy ${SRC} && sed -e '/YY_BUF_SIZE/s/16384/1024/' < __libipsecyy.tab.c > ${TGT} && rm -f __libipsecyy.tab.c && mv __libipsecyy.tab.h freebsd/lib/libipsec/y.tab.h") - bld.objects(target = "yacc___libipsecyy", - features = "c", - cflags = cflags, - includes = [] + includes, - defines = [], - source = "freebsd/lib/libipsec/policy_parse.c") - libbsd_use += ["yacc___libipsecyy"] - if bld.env.AUTO_REGEN: bld(target = "freebsd/lib/libc/net/nsparser.c", source = "freebsd/lib/libc/net/nsparser.y", rule = "${YACC} -b _nsyy -d -p _nsyy ${SRC} && sed -e '/YY_BUF_SIZE/s/16384/1024/' < _nsyy.tab.c > ${TGT} && rm -f _nsyy.tab.c && mv _nsyy.tab.h freebsd/lib/libc/net/nsparser.h") @@ -202,9 +196,20 @@ def build(bld): features = "c", cflags = cflags, includes = [] + includes, - defines = [], + defines = defines + [], source = "freebsd/lib/libc/net/nsparser.c") libbsd_use += ["yacc__nsyy"] + if bld.env.AUTO_REGEN: + bld(target = "freebsd/lib/libipsec/policy_parse.c", + source = "freebsd/lib/libipsec/policy_parse.y", + rule = "${YACC} -b __libipsecyy -d -p __libipsecyy ${SRC} && sed -e '/YY_BUF_SIZE/s/16384/1024/' < __libipsecyy.tab.c > ${TGT} && rm -f __libipsecyy.tab.c && mv __libipsecyy.tab.h freebsd/lib/libipsec/y.tab.h") + bld.objects(target = "yacc___libipsecyy", + features = "c", + cflags = cflags, + includes = [] + includes, + defines = defines + [], + source = "freebsd/lib/libipsec/policy_parse.c") + libbsd_use += ["yacc___libipsecyy"] # Objects built with different CFLAGS objs01_source = ['freebsd/bin/hostname/hostname.c', @@ -349,7 +354,7 @@ def build(bld): features = "c", cflags = cflags, includes = [] + includes, - defines = ['INET6'], + defines = defines + ['INET6'], source = objs01_source) libbsd_use += ["objs01"] @@ -358,7 +363,7 @@ def build(bld): features = "c", cflags = cflags, includes = [] + includes, - defines = ['NO_SSL', 'NO_POPEN', 'NO_CGI', 'USE_WEBSOCKET'], + defines = defines + ['NO_SSL', 'NO_POPEN', 'NO_CGI', 'USE_WEBSOCKET'], source = objs02_source) libbsd_use += ["objs02"] @@ -390,7 +395,7 @@ def build(bld): features = "c", cflags = cflags, includes = [] + includes, - defines = ['__DBINTERFACE_PRIVATE', 'INET6'], + defines = defines + ['__DBINTERFACE_PRIVATE', 'INET6'], source = objs03_source) libbsd_use += ["objs03"] @@ -420,7 +425,7 @@ def build(bld): features = "c", cflags = cflags, includes = [] + includes, - defines = ['__FreeBSD__', 'THERE_IS_NO_FORK', 'MASTER_ONLY', 'INET', 'INET6'], + defines = defines + ['__FreeBSD__', 'THERE_IS_NO_FORK', 'MASTER_ONLY', 'INET', 'INET6'], source = objs04_source) libbsd_use += ["objs04"] @@ -441,7 +446,7 @@ def build(bld): features = "c", cflags = cflags, includes = [] + includes, - defines = ['__FreeBSD__=1', 'BSD=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_LIMITS_H=1', 'HAVE_INTTYPES=1', 'HAVE_STDINT=1', 'HAVE_STRERROR=1', 'HAVE_STRLCPY=1', 'HAVE_SNPRINTF=1', 'HAVE_VSNPRINTF=1', 'HAVE_SOCKADDR_SA_LEN=1', 'HAVE_NET_IF_MEDIA_H=1', 'HAVE_SYS_IOCCOM_H=1'], + defines = defines + ['__FreeBSD__=1', 'BSD=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_LIMITS_H=1', 'HAVE_INTTYPES=1', 'HAVE_STDINT=1', 'HAVE_STRERROR=1', 'HAVE_STRLCPY=1', 'HAVE_SNPRINTF=1', 'HAVE_VSNPRINTF=1', 'HAVE_SOCKADDR_SA_LEN=1', 'HAVE_NET_IF_MEDIA_H=1', 'HAVE_SYS_IOCCOM_H=1'], source = objs05_source) libbsd_use += ["objs05"] @@ -592,7 +597,7 @@ def build(bld): features = "c", cflags = cflags, includes = ['freebsd/contrib/tcpdump', 'freebsd/usr.sbin/tcpdump/tcpdump'] + includes, - defines = ['__FreeBSD__=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_CONFIG_H=1', 'HAVE_NET_PFVAR_H=1'], + defines = defines + ['__FreeBSD__=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_CONFIG_H=1', 'HAVE_NET_PFVAR_H=1'], source = objs06_source) libbsd_use += ["objs06"] @@ -1066,6 +1071,7 @@ def build(bld): cflags = cflags, cxxflags = cxxflags, includes = includes, + defines = defines, source = source, use = libbsd_use) |