mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-22 20:45:37 +08:00
Add support for long command lines and fix some shell rules on Windows.
This commit is contained in:
parent
5851034aea
commit
32ceb14ee2
@ -8,9 +8,17 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import rtems_waf.rtems as rtems
|
||||
|
||||
windows = os.name == "nt"
|
||||
|
||||
if windows:
|
||||
host_shell = "sh -c "
|
||||
else:
|
||||
host_shell = ""
|
||||
|
||||
def init(ctx):
|
||||
pass
|
||||
|
||||
@ -113,7 +121,7 @@ def build(bld):
|
||||
# KVM Symbols
|
||||
bld(target = "rtemsbsd/rtems/rtems-kernel-kvm-symbols.c",
|
||||
source = "rtemsbsd/rtems/generate_kvm_symbols",
|
||||
rule = "./${SRC} > ${TGT}",
|
||||
rule = host_shell + "./${SRC} > ${TGT}",
|
||||
update_outputs = True)
|
||||
bld.objects(target = "kvmsymbols",
|
||||
features = "c",
|
||||
@ -127,11 +135,11 @@ def build(bld):
|
||||
if bld.env.AUTO_REGEN:
|
||||
bld(target = "freebsd/include/rpc/rpcb_prot.h",
|
||||
source = "freebsd/include/rpc/rpcb_prot.x",
|
||||
rule = "${RPCGEN} -h -o ${TGT} ${SRC}")
|
||||
rule = host_shell + "${RPCGEN} -h -o ${TGT} ${SRC}")
|
||||
|
||||
# Route keywords
|
||||
if bld.env.AUTO_REGEN:
|
||||
rkw_rule = "cat ${SRC} | awk 'BEGIN { r = 0 } { if (NF == 1) printf \"#define\\tK_%%s\\t%%d\\n\\t{\\\"%%s\\\", K_%%s},\\n\", toupper($1), ++r, $1, toupper($1)}' > ${TGT}"
|
||||
rkw_rule = host_shell + "cat ${SRC} | awk 'BEGIN { r = 0 } { if (NF == 1) printf \"#define\\tK_%%s\\t%%d\\n\\t{\\\"%%s\\\", K_%%s},\\n\", toupper($1), ++r, $1, toupper($1)}' > ${TGT}"
|
||||
bld(target = "freebsd/sbin/route/keywords.h",
|
||||
source = "freebsd/sbin/route/keywords",
|
||||
rule = rkw_rule)
|
||||
@ -140,7 +148,7 @@ def build(bld):
|
||||
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}")
|
||||
rule = host_shell + "${LEX} -P pcap -t ${SRC} | sed -e '/YY_BUF_SIZE/s/16384/1024/' > ${TGT}")
|
||||
bld.objects(target = "lex_pcap",
|
||||
features = "c",
|
||||
cflags = cflags,
|
||||
@ -152,7 +160,7 @@ def build(bld):
|
||||
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}")
|
||||
rule = host_shell + "${LEX} -P _nsyy -t ${SRC} | sed -e '/YY_BUF_SIZE/s/16384/1024/' > ${TGT}")
|
||||
bld.objects(target = "lex__nsyy",
|
||||
features = "c",
|
||||
cflags = cflags,
|
||||
@ -164,7 +172,7 @@ def build(bld):
|
||||
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}")
|
||||
rule = host_shell + "${LEX} -P __libipsecyy -t ${SRC} | sed -e '/YY_BUF_SIZE/s/16384/1024/' > ${TGT}")
|
||||
bld.objects(target = "lex___libipsecyy",
|
||||
features = "c",
|
||||
cflags = cflags,
|
||||
@ -177,7 +185,7 @@ def build(bld):
|
||||
if bld.env.AUTO_REGEN:
|
||||
bld(target = "freebsd/contrib/libpcap/grammar.c",
|
||||
source = "freebsd/contrib/libpcap/grammar.y",
|
||||
rule = "${YACC} -b pcap -d -p pcap ${SRC} && sed -e '/YY_BUF_SIZE/s/16384/1024/' < pcap.tab.c > ${TGT} && rm -f pcap.tab.c && mv pcap.tab.h freebsd/contrib/libpcap/tokdefs.h")
|
||||
rule = host_shell + "${YACC} -b pcap -d -p pcap ${SRC} && sed -e '/YY_BUF_SIZE/s/16384/1024/' < pcap.tab.c > ${TGT} && rm -f pcap.tab.c && mv pcap.tab.h freebsd/contrib/libpcap/tokdefs.h")
|
||||
bld.objects(target = "yacc_pcap",
|
||||
features = "c",
|
||||
cflags = cflags,
|
||||
@ -188,7 +196,7 @@ def build(bld):
|
||||
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")
|
||||
rule = host_shell + "${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")
|
||||
bld.objects(target = "yacc__nsyy",
|
||||
features = "c",
|
||||
cflags = cflags,
|
||||
@ -199,7 +207,7 @@ def build(bld):
|
||||
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")
|
||||
rule = host_shell + "${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,
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 93e554578cdcb2b6c5439b3371dcd558b3218829
|
||||
Subproject commit 1aef19067e9d12f9bd991c93d8adb4d71bea40b2
|
@ -254,9 +254,18 @@ class ModuleManager(builder.ModuleManager):
|
||||
self.add('')
|
||||
self.add('from __future__ import print_function')
|
||||
self.add('')
|
||||
self.add('import os')
|
||||
self.add('import os.path')
|
||||
# Import check done in the top level wscript file.
|
||||
self.add('import rtems_waf.rtems as rtems')
|
||||
self.add('')
|
||||
self.add('windows = os.name == "nt"')
|
||||
self.add('')
|
||||
self.add('if windows:')
|
||||
self.add(' host_shell = "sh -c "')
|
||||
self.add('else:')
|
||||
self.add(' host_shell = ""')
|
||||
self.add('')
|
||||
self.add('def init(ctx):')
|
||||
self.add(' pass')
|
||||
self.add('')
|
||||
@ -360,7 +369,7 @@ class ModuleManager(builder.ModuleManager):
|
||||
self.add(' # KVM Symbols')
|
||||
self.add(' bld(target = "%s",' % (kvmsymbols['files']['all'][0]))
|
||||
self.add(' source = "rtemsbsd/rtems/generate_kvm_symbols",')
|
||||
self.add(' rule = "./${SRC} > ${TGT}",')
|
||||
self.add(' rule = host_shell + "./${SRC} > ${TGT}",')
|
||||
self.add(' update_outputs = True)')
|
||||
self.add(' bld.objects(target = "kvmsymbols",')
|
||||
self.add(' features = "c",')
|
||||
@ -379,7 +388,7 @@ class ModuleManager(builder.ModuleManager):
|
||||
self.add(' if bld.env.AUTO_REGEN:')
|
||||
self.add(' bld(target = "%s.h",' % (rpcname))
|
||||
self.add(' source = "%s.x",' % (rpcname))
|
||||
self.add(' rule = "${RPCGEN} -h -o ${TGT} ${SRC}")')
|
||||
self.add(' rule = host_shell + "${RPCGEN} -h -o ${TGT} ${SRC}")')
|
||||
self.add('')
|
||||
|
||||
if 'RouteKeywords' in data:
|
||||
@ -387,7 +396,7 @@ class ModuleManager(builder.ModuleManager):
|
||||
rkwname = routekw['files']['all'][0]
|
||||
self.add(' # Route keywords')
|
||||
self.add(' if bld.env.AUTO_REGEN:')
|
||||
self.add(' rkw_rule = "cat ${SRC} | ' + \
|
||||
self.add(' rkw_rule = host_shell + "cat ${SRC} | ' + \
|
||||
'awk \'BEGIN { r = 0 } { if (NF == 1) ' + \
|
||||
'printf \\"#define\\\\tK_%%s\\\\t%%d\\\\n\\\\t{\\\\\\"%%s\\\\\\", K_%%s},\\\\n\\", ' + \
|
||||
'toupper($1), ++r, $1, toupper($1)}\' > ${TGT}"')
|
||||
@ -412,7 +421,7 @@ class ModuleManager(builder.ModuleManager):
|
||||
self.add(' if bld.env.AUTO_REGEN:')
|
||||
self.add(' bld(target = "%s.c",' % (lex['file'][:-2]))
|
||||
self.add(' source = "%s",' % (lex['file']))
|
||||
self.add(' rule = "${LEX} -P %s -t ${SRC} | ' % (lex['sym']) + \
|
||||
self.add(' rule = host_shell + "${LEX} -P %s -t ${SRC} | ' % (lex['sym']) + \
|
||||
'sed -e \'/YY_BUF_SIZE/s/16384/1024/\' > ${TGT}")')
|
||||
self.add(' bld.objects(target = "lex_%s",' % (lex['sym']))
|
||||
self.add(' features = "c",')
|
||||
@ -445,7 +454,8 @@ class ModuleManager(builder.ModuleManager):
|
||||
self.add(' if bld.env.AUTO_REGEN:')
|
||||
self.add(' bld(target = "%s.c",' % (yaccFile[:-2]))
|
||||
self.add(' source = "%s",' % (yaccFile))
|
||||
self.add(' rule = "${YACC} -b %s -d -p %s ${SRC} && ' % (yaccSym, yaccSym) + \
|
||||
self.add(' rule = host_shell + "${YACC} -b %s -d -p %s ${SRC} && ' % \
|
||||
(yaccSym, yaccSym) + \
|
||||
'sed -e \'/YY_BUF_SIZE/s/16384/1024/\' < %s.tab.c > ${TGT} && ' % (yaccSym) + \
|
||||
'rm -f %s.tab.c && mv %s.tab.h %s")' % (yaccSym, yaccSym, yaccHeader))
|
||||
self.add(' bld.objects(target = "yacc_%s",' % (yaccSym))
|
||||
|
Loading…
x
Reference in New Issue
Block a user