Browse Source

new build: get rid of Go with few rc scripts.

master
Giacomo Tesio 1 year ago
parent
commit
0adf1b0431
  1. 18
      arch/amd64/include/cflags.json
  2. 37
      arch/rc/cmd/build
  3. 10
      arch/rc/cmd/template
  4. 131
      arch/rc/lib/build/utils.rc
  5. 13
      build.json
  6. 2
      hacking
  7. 9
      jehanne.rc.build
  8. 11
      qa/build.json
  9. 3
      qa/cmd/rc/010-include.rc.template
  10. 18
      qa/cmd/rc/010-template.rc.template
  11. 10
      qa/cmd/rc/010-template.runner
  12. 11
      qa/gnu/gcc/build.json
  13. 6
      qa/gnu/gcc/gcc.rc.build
  14. 51
      qa/kern/build.json
  15. 8
      qa/kern/kern.rc.build
  16. 46
      qa/lib/c/build.json
  17. 9
      qa/lib/c/c.rc.build
  18. 138
      qa/lib/newlib/build.json
  19. 42
      qa/lib/newlib/newlib.rc.build
  20. 54
      qa/lib/newlib/testsuite/build.json
  21. 59
      qa/lib/newlib/testsuite/testsuite.rc.build
  22. 11
      qa/lib/thread/build.json
  23. 6
      qa/lib/thread/thread.rc.build
  24. 6
      qa/qa.rc.build
  25. 53
      sys/src/cmd/FromYacc.rc.build
  26. 33
      sys/src/cmd/acme/acme.rc.build
  27. 8
      sys/src/cmd/acme/aux/aux.rc.build
  28. 15
      sys/src/cmd/acme/aux/build.json
  29. 16
      sys/src/cmd/acme/aux/win/build.json
  30. 16
      sys/src/cmd/acme/aux/win/win.rc.build
  31. 36
      sys/src/cmd/acme/build.json
  32. 16
      sys/src/cmd/auth/authsrv.json
  33. 50
      sys/src/cmd/auth/build.json
  34. 16
      sys/src/cmd/auth/dsa2pub.json
  35. 16
      sys/src/cmd/auth/dsa2ssh.json
  36. 27
      sys/src/cmd/auth/factotum/build.json
  37. 27
      sys/src/cmd/auth/factotum/factotum.rc.build
  38. 16
      sys/src/cmd/auth/guard.srv.json
  39. 29
      sys/src/cmd/auth/lib/libauthcmd.json
  40. 16
      sys/src/cmd/auth/rsa2csr.json
  41. 16
      sys/src/cmd/auth/rsa2pub.json
  42. 16
      sys/src/cmd/auth/rsa2ssh.json
  43. 16
      sys/src/cmd/auth/rsa2x509.json
  44. 16
      sys/src/cmd/auth/rsafill.json
  45. 13
      sys/src/cmd/auth/secstore/aescbc.json
  46. 21
      sys/src/cmd/auth/secstore/build.json
  47. 81
      sys/src/cmd/auth/secstore/secstore.rc.build
  48. 18
      sys/src/cmd/auth/secstore/secstored.json
  49. 16
      sys/src/cmd/auth/secstore/secuser.json
  50. 28
      sys/src/cmd/awk/awk.rc.build
  51. 31
      sys/src/cmd/awk/build.json
  52. 171
      sys/src/cmd/awk/maketab.c
  53. 189
      sys/src/cmd/awk/maketab.go
  54. 64
      sys/src/cmd/awk/maketab.rc.environment
  55. 40
      sys/src/cmd/awk/maketab.rc.template
  56. 45
      sys/src/cmd/cmd.json
  57. 31
      sys/src/cmd/cmd.rc.build
  58. 118
      sys/src/cmd/cmds.json
  59. 18
      sys/src/cmd/disk/build.json
  60. 11
      sys/src/cmd/disk/disk.rc.build
  61. 21
      sys/src/cmd/disk/prep/fdisk.json
  62. 17
      sys/src/cmd/disk/prep/fdisk.rc.build
  63. 21
      sys/src/cmd/disk/prep/prep.json
  64. 17
      sys/src/cmd/disk/prep/prep.rc.build
  65. 12
      sys/src/cmd/disk/rofs/build.json
  66. 6
      sys/src/cmd/disk/rofs/rofs.rc.build
  67. 23
      sys/src/cmd/dossrv/build.json
  68. 21
      sys/src/cmd/dossrv/dossrv.rc.build
  69. 14
      sys/src/cmd/exportfs/build.json
  70. 14
      sys/src/cmd/exportfs/exportfs.rc.build
  71. 22
      sys/src/cmd/grep/build.json
  72. 18
      sys/src/cmd/grep/grep.rc.build
  73. 21
      sys/src/cmd/hjfs/build.json
  74. 21
      sys/src/cmd/hjfs/hjfs.rc.build
  75. 19
      sys/src/cmd/hmi/build.json
  76. 16
      sys/src/cmd/hmi/console/COMConsole.rc.build
  77. 16
      sys/src/cmd/hmi/console/PipeConsole.rc.build
  78. 17
      sys/src/cmd/hmi/console/ScreenConsole.rc.build
  79. 24
      sys/src/cmd/hmi/console/comconsole.json
  80. 5
      sys/src/cmd/hmi/console/console.rc.build
  81. 24
      sys/src/cmd/hmi/console/pipeconsole.json
  82. 25
      sys/src/cmd/hmi/console/screenconsole.json
  83. 10
      sys/src/cmd/hmi/hmi.rc.build
  84. 11
      sys/src/cmd/hmi/realemu/loadcom.json
  85. 21
      sys/src/cmd/hmi/realemu/realemu.json
  86. 29
      sys/src/cmd/hmi/realemu/realemu.rc.build
  87. 54
      sys/src/cmd/hmi/vga/build.json
  88. 52
      sys/src/cmd/hmi/vga/vga.rc.build
  89. 23
      sys/src/cmd/hoc/build.json
  90. 19
      sys/src/cmd/hoc/hoc.rc.build
  91. 29
      sys/src/cmd/ip/build.json
  92. 15
      sys/src/cmd/ip/dhcpd/dhcpd.json
  93. 28
      sys/src/cmd/ip/dhcpd/dhcpd.rc.build
  94. 14
      sys/src/cmd/ip/dhcpd/dhcpleases.json
  95. 9
      sys/src/cmd/ip/ip.rc.build
  96. 14
      sys/src/cmd/ip/ipconfig/build.json
  97. 14
      sys/src/cmd/ip/ipconfig/ipconfig.rc.build
  98. 14
      sys/src/cmd/ip/ipconfig/kipconfig.json
  99. 20
      sys/src/cmd/kcmds.json
  100. 31
      sys/src/cmd/kernel.json

18
arch/amd64/include/cflags.json

@ -1,18 +0,0 @@
{
"buildflags": {
"Cflags": [
"-9",
"-g",
"-gdwarf-2",
"-ggdb",
"-mcmodel=small",
"-O0",
"-Wall",
"-Werror",
"-Wno-main",
"-Wno-missing-braces",
"-Wno-parentheses",
"-Wno-unknown-pragmas"
]
}
}

37
arch/rc/cmd/build

@ -0,0 +1,37 @@
#!/cmd/rc
# This script run the rc build scripts passed as arguments
# after moving in their directory.
#
# If passed a directory, it will look for a build script named
# `{basename $PWD}.rc.build and run it instead.
#
# If invoked with no arguments it will assume $PWD as argument
#
# NOTE: this script is run both fron Jehanne and from UNIX during
# cross compilation (through the sh wrapper in hacking/bin/build)
# thus it should not explicitly check $status as exit codes
# work differently in UNIX and Jehanne.
args=$*
if (~ $#args 0)
args=$PWD
for (script in $args){
if (test -d $script){
if (~ $script $JEHANNE){
target=jehanne
}
if not {
target=`{basename $script}
}
rundir=$script
script=$target.rc.build
}
if not {
rundir=`{dirname $script}
script=`{basename $script}
}
echo $rundir/$script
@{cd $rundir; . $JEHANNE/arch/rc/lib/build/utils.rc; cat $script|rc -v -e >[2=1]|sed 's/^/ /'}
}

10
arch/rc/cmd/template

@ -0,0 +1,10 @@
#!/cmd/rc
# sed -n \
# -e '/#{{/{x; /^$/{x;b}; s/''/''''/g; s/\$[$a-zA-Z0-9()#"]\+[\^]\?/''&''/g; s/^\n/echo ''/ ; s/$/''/; p; x; h; b}' \
# -e H \
# -e '/#}}/{s/#}}//; x; s/#{{//; s/#}}//; p; g}' \
# -e '${x; /^$/{b}; /#}}/!{s/''/''''/g; s/\$[$a-zA-Z0-9()#"]\+[\^]\?/''&''/g; s/^\n/echo ''/ ; s/$/''/; p}}' \
# | rc
sed '/^$/{s//echo/; b}; /^#! /{s/#! //g; b}; /^#! /!{s/''/''''/g; s/\$\(#\|"\)\?[$a-zA-Z0-9_]\+\(([$a-zA-Z0-9#_]\+)\)\?[\^]\?/''&''/g; s/^/echo ''/ ; s/$/''/; b}'

131
arch/rc/lib/build/utils.rc

@ -0,0 +1,131 @@
# Utility functions designed to simplify build scripts.
#
# They react to environment variables
BUILD_INITIALIZED=true
CFLAGS=( \
-9 \
-g \
-gdwarf-2 \
-ggdb \
'-mcmodel=small' \
-O0 \
-Wall \
-Werror \
-Wno-main \
-Wno-missing-braces \
-Wno-parentheses \
-Wno-unknown-pragmas \
)
KLIB_CFLAGS=( \
-DKERNEL \
-c \
'-mcmodel=kernel' \
-O0 \
-fplan9-extensions \
-ffreestanding \
-fstack-protector-all \
-fno-builtin \
-Wall \
-Wno-missing-braces \
-Wno-parentheses \
-Wno-unknown-pragmas \
-Wuninitialized \
-g \
)
STACKCHECK_CFLAGS=( \
-fstack-check \
-fstack-protector-all \
)
CMD_OFLAGS=( \
-static \
-lavl \
-lcomplete \
-lcontrol \
-ldisk \
-lflate \
-lframe \
-lmemdraw \
-lmemlayer \
-lmemdraw \
-ldraw \
-lplumb \
-lregexp \
-lString \
-l9p \
-lauth \
-lauthsrv \
-lndb \
-lip \
-lsec \
-lauth \
-lmp \
-lthread \
-lbio \
-l9p2000 \
-ljehanne \
)
CC=gcc
CC=$JEHANNE_TOOLCHAIN/cross/posix/bin/$TOOLPREFIX$CC
AR=ar
AR=$JEHANNE_TOOLCHAIN/cross/posix/bin/$TOOLPREFIX$AR
RANLIB=ranlib
RANLIB=$JEHANNE_TOOLCHAIN/cross/posix/bin/$TOOLPREFIX$RANLIB
STRIP=strip
STRIP=$JEHANNE_TOOLCHAIN/cross/posix/bin/$TOOLPREFIX$STRIP
LD=ld
LD=$JEHANNE_TOOLCHAIN/cross/posix/bin/$TOOLPREFIX$LD
OBJCOPY=objcopy
OBJCOPY=$JEHANNE_TOOLCHAIN/cross/posix/bin/$TOOLPREFIX$OBJCOPY
OBJDUMP=objdump
OBJDUMP=$JEHANNE_TOOLCHAIN/cross/posix/bin/$TOOLPREFIX$OBJDUMP
READELF=readelf
READELF=$JEHANNE_TOOLCHAIN/cross/posix/bin/$TOOLPREFIX$READELF
fn debuggable {
# echo $*
eval $*
}
fn prependLibraryName {
LIBRARY_NAME=$1
if ( ! ~ 0 $#LIBRARY_NAME ) {
for (i in *.o) {
# rename object files to ease library merge
debuggable mv $i $LIBRARY_NAME-$i
}
}
}
fn compileCommands {
EXT=$1
DESTINATION=$2
shift 2
LIST=$*
if ( ~ 0 $#LIST ) {
LIST=*.$EXT
}
mkdir -p $DESTINATION
for (f in $LIST) {
BINARY=`{basename $f|sed 's/\.'$EXT'//'}
debuggable $CC $f -o $BINARY -O2 '-std=gnu11' $STACKCHECK_CFLAGS $CFLAGS $CMD_OFLAGS
debuggable mv $BINARY $DESTINATION
}
}
fn safemove {
mkdir -p $*($#*)
mv $*
}

13
build.json

@ -1,13 +0,0 @@
{
"all": {
"Projects": [
"/sys/src/lib/klibs.json",
"/sys/src/lib/libs.json",
"/sys/src/cmd/cmds.json",
"/sys/src/kern/amd64/workhorse.json",
"/sys/src/kern/amd64/",
"/hacking/cross/pkgs/",
"qa/"
]
}
}

2
hacking

@ -1 +1 @@
Subproject commit 6b473cd28f7b778557c8758bdb612fadb54c11bc
Subproject commit e6908814ef79cae9a30fcc1504328d6da6e33ee8

9
jehanne.rc.build

@ -0,0 +1,9 @@
#!/cmd/rc
build sys/src/lib/klibs.rc.build
build sys/src/lib/libs.rc.build
build sys/src/cmd/cmd.rc.build
build sys/src/kern/amd64/workhorse.rc.build
build sys/src/kern/amd64/
@{cd hacking/cross/pkgs/ && ./build.sh >[2=1]|sed 's/^/ /'}
build qa/

11
qa/build.json

@ -1,11 +0,0 @@
{
"RegressionTests": {
"Projects": [
"kern/",
"lib/c/",
"lib/thread/",
"lib/newlib",
"gnu/gcc/"
]
}
}

3
qa/cmd/rc/010-include.rc.template

@ -0,0 +1,3 @@
$i:
$A($i)

18
qa/cmd/rc/010-template.rc.template

@ -0,0 +1,18 @@
#! A=(a b c)
#! PTR=A
#! ASIZE=$#A
#! LDS='$'
Variable '$LDS^PTR' contains: $"PTR
Variable '$LDS^$LDS^PTR' contains: $"$PTR
#! for(v in $A) {
- $v
#! }
size of A: $#A
#! for(i in `{seq $ASIZE}) {
#! cat 010-include.rc.template|template|rc
#! }

10
qa/cmd/rc/010-template.runner

@ -0,0 +1,10 @@
#!/cmd/rc
runner=$0
test = `{echo $runner|sed 's/.runner//'}
A=(first second third)
PTR=A
OUTPUT=/tmp/template.$pid.output
cat $test.rc.template|template > $OUTPUT
cat $OUTPUT

11
qa/gnu/gcc/build.json

@ -1,11 +0,0 @@
{
"RegressionTests": {
"Include": [
"/sys/src/cmd/cmd.json"
],
"Install": "/arch/$ARCH/qa/gnu/gcc",
"SourceFilesCmd": [
"rune.c"
]
}
}

6
qa/gnu/gcc/gcc.rc.build

@ -0,0 +1,6 @@
#!/cmd/rc
if ( ~ 0 $#BUILD_INITIALIZED ) . $JEHANNE/arch/rc/lib/build/utils.rc
rm -f *.tag.*
compileCommands c $JEHANNE/arch/$ARCH/qa/gnu/gcc
rm -f *.o

51
qa/kern/build.json

@ -1,51 +0,0 @@
{
"RegressionTests": {
"Include": [
"/sys/src/cmd/cmd.json"
],
"Install": "/arch/$ARCH/qa/kern",
"Post": [
"cp *.rc $JEHANNE/arch/$ARCH/qa/kern/",
"cp *.runner $JEHANNE/arch/$ARCH/qa/kern/"
],
"SourceFilesCmd": [
"alarm.c",
"args.c",
"awake.c",
"awake_note0.c",
"awake_note1.c",
"brk.c",
"broken.c",
"dup.c",
"execl.c",
"float.c",
"fork.c",
"fork_chain.c",
"frexp.c",
"getmainpid.c",
"getpid.c",
"getppid.c",
"iphash.c",
"malloc1GiB.c",
"memoryisolation.c",
"memoryshare.c",
"mixedfloat.c",
"nested_note.c",
"noexecmem.c",
"notify.c",
"nsclone.c",
"nsec.c",
"pipering.c",
"postnote.c",
"psx.c",
"segattach.c",
"sched0.c",
"stop_start.c",
"syscall.c",
"sysstatread.c",
"tsemacquire.c",
"wait_note.c",
"waserror.c"
]
}
}

8
qa/kern/kern.rc.build

@ -0,0 +1,8 @@
#!/cmd/rc
if ( ~ 0 $#BUILD_INITIALIZED ) . $JEHANNE/arch/rc/lib/build/utils.rc
rm -f *.tag.*
compileCommands c $JEHANNE/arch/$ARCH/qa/kern
cp *.rc $JEHANNE/arch/$ARCH/qa/kern/
cp *.runner $JEHANNE/arch/$ARCH/qa/kern/
rm -f *.o

46
qa/lib/c/build.json

@ -1,46 +0,0 @@
{
"RegressionTests": {
"Include": [
"/sys/src/cmd/cmd.json"
],
"Cflags": [
"-O2",
"-std=gnu11"
],
"Install": "/arch/$ARCH/qa/lib/c",
"Post": [
"cp *.rc $JEHANNE/arch/$ARCH/qa/lib/c/"
],
"SourceFilesCmd": [
"access.c",
"asmscall.c",
"cleanname.c",
"conswrite.c",
"hcube.c",
"lockt.c",
"longjmp.c",
"privates.c",
"privates2.c",
"qlockt0.c",
"qlockt1.c",
"qlockt2.c",
"rlockt0.c",
"rlockt1.c",
"rlockt2.c",
"rsleept0.c",
"rsleept1.c",
"rsleept2.c",
"rwakeup0.c",
"rwakeup1.c",
"sleep.c",
"sleep2.c",
"sqrt.c",
"sysfatal.c",
"va_copy.c",
"vseprint.c",
"wlockt0.c",
"wlockt1.c",
"wlockt2.c"
]
}
}

9
qa/lib/c/c.rc.build

@ -0,0 +1,9 @@
#!/cmd/rc
if ( ~ 0 $#BUILD_INITIALIZED ) . $JEHANNE/arch/rc/lib/build/utils.rc
rm -f *.tag.*
compileCommands c $JEHANNE/arch/$ARCH/qa/lib/c
cp *.rc $JEHANNE/arch/$ARCH/qa/lib/c/
rm -f *.o

138
qa/lib/newlib/build.json

@ -1,138 +0,0 @@
{
"SimplePOSIXTests": {
"Cflags": [
"-g",
"-gdwarf-2",
"-ggdb",
"-mcmodel=small",
"-O0",
"-Wall",
"-Wno-main",
"-Wno-missing-braces",
"-Wno-parentheses",
"-Wno-unknown-pragmas",
"-fstack-check",
"-fstack-protector-all",
"-O2",
"-std=gnu11"
],
"Install": "/arch/$ARCH/qa/lib/newlib",
"Post": [
"rm -f *.o",
"cp *.runner $JEHANNE/arch/$ARCH/qa/lib/newlib/",
"git clean -xdf ."
],
"Pre": [
"rm -f *.tag.*"
],
"SourceFiles": [
"libposix_customization.c"
],
"SourceFilesCmd": [
"000-hello.c",
"001-hello.c",
"002-atexit.c",
"010-fork.c",
"020-waitpid.c",
"030-pause.c",
"031-setjmp.c",
"040-gettimeofday.c",
"041-env.c",
"050-setsid.c",
"100-files.c",
"101-files.c",
"102-files.c",
"103-files.c",
"104-files-nonblocking.c",
"120-fcntl.c",
"121-fcntl.c",
"200-signals.c",
"201-signals.c",
"202-signals.c",
"203-signals.c",
"204-signals.c",
"205-signals.c",
"206-signals.c",
"207-sigsuspend.c",
"208-sigpending.c",
"209-sigwaitinfo.c",
"210-sigtimedwait.c",
"211-sigtimedwait.c",
"212-sigwait.c",
"213-sigqueue.c",
"214-sigsetjmp.c",
"215-sigprocmask.c"
]
},
"SIGCHLDTests": {
"Cflags": [
"-g",
"-gdwarf-2",
"-ggdb",
"-mcmodel=small",
"-O0",
"-Wall",
"-Wno-main",
"-Wno-missing-braces",
"-Wno-parentheses",
"-Wno-unknown-pragmas",
"-fstack-check",
"-fstack-protector-all",
"-O2",
"-DWITH_SIGCHLD",
"-std=gnu11"
],
"Install": "/arch/$ARCH/qa/lib/newlib/sigchld",
"Post": [
"rm -f *.o",
"cp *.runner $JEHANNE/arch/$ARCH/qa/lib/newlib/sigchld/",
"git clean -xdf ."
],
"Pre": [
"rm -f *.tag.*"
],
"SourceFiles": [
"libposix_sigchld.c"
],
"SourceFilesCmd": [
"000-hello.c",
"001-hello.c",
"002-atexit.c",
"010-fork.c",
"020-waitpid.c",
"030-pause.c",
"031-setjmp.c",
"040-gettimeofday.c",
"041-env.c",
"050-setsid.c",
"100-files.c",
"101-files.c",
"102-files.c",
"103-files.c",
"104-files-nonblocking.c",
"120-fcntl.c",
"121-fcntl.c",
"200-signals.c",
"201-signals.c",
"202-signals.c",
"203-signals.c",
"204-signals.c",
"205-signals.c",
"206-signals.c",
"207-sigsuspend.c",
"208-sigpending.c",
"209-sigwaitinfo.c",
"210-sigtimedwait.c",
"211-sigtimedwait.c",
"212-sigwait.c",
"213-sigqueue.c",
"214-sigsetjmp.c",
"215-sigprocmask.c"
]
},
"NewlibTestsuite": {
"Projects": [
"testsuite/"
]
}
}

42
qa/lib/newlib/newlib.rc.build

@ -0,0 +1,42 @@
#!/cmd/rc
if ( ~ 0 $#BUILD_INITIALIZED ) . $JEHANNE/arch/rc/lib/build/utils.rc
rm -f *.tag.*
TEST=`{ls *.c|grep -v libposix_}
CFLAGS=( \
-g \
-gdwarf-2 \
-ggdb \
-mcmodel=small \
-Wall \
-Wno-main \
-Wno-missing-braces \
-Wno-parentheses \
-Wno-unknown-pragmas \
-O2 \
-std=gnu11 \
)
# test without SIGCHILD emulation
mkdir -p $JEHANNE/arch/$ARCH/qa/lib/newlib/
for (f in $TEST) {
BINARY=`{basename $f|sed 's/\.c//'}
debuggable $CC $f libposix_customization.c -o $BINARY $STACKCHECK_CFLAGS $CFLAGS
debuggable mv $BINARY $JEHANNE/arch/$ARCH/qa/lib/newlib/
}
# test with SIGCHILD emulation
mkdir -p $JEHANNE/arch/$ARCH/qa/lib/newlib/sigchld/
for (f in $TEST) {
BINARY=`{basename $f|sed 's/\.c//'}
debuggable $CC $f libposix_sigchld.c -o $BINARY -DWITH_SIGCHLD $STACKCHECK_CFLAGS $CFLAGS
debuggable mv $BINARY $JEHANNE/arch/$ARCH/qa/lib/newlib/sigchld/
}
rm -f *.o
build testsuite/

54
qa/lib/newlib/testsuite/build.json

@ -1,54 +0,0 @@
{
"NewlibTestsuite": {
"Cflags": [
"-g",
"-gdwarf-2",
"-ggdb",
"-mcmodel=small",
"-O0",
"-Wall",
"-Wno-main",
"-Wno-missing-braces",
"-Wno-parentheses",
"-Wno-unknown-pragmas",
"-iquote", "/hacking/cross/pkgs/newlib/src/newlib/testsuite/include/",
"-fstack-check",
"-Wno-unused-variable",
"-Wno-format",
"-fstack-protector-all",
"-O2",
"-std=gnu11"
],
"Oflags": [
"-static"
],
"Post": [
"mkdir -p $JEHANNE/arch/$ARCH/qa/lib/newlib/testsuite",
"find -type f -perm /a+x -exec cp {} $JEHANNE/arch/$ARCH/qa/lib/newlib/testsuite/ \\;",
"cp *.runner $JEHANNE/arch/$ARCH/qa/lib/newlib/testsuite/",
"git clean -xdf ."
],
"Pre": [
"cat $JEHANNE/hacking/cross/pkgs/newlib/src/newlib/testsuite/newlib.wctype/twctype.c|sed 's/0x0967/0x0905/g' > twctype.c",
"rm -f *.tag.*"
],
"SourceFiles": [
"../libposix_customization.c"
],
"SourceFilesCmd": [
"/hacking/cross/pkgs/newlib/src/newlib/testsuite/newlib.string/tstring.c",
"/hacking/cross/pkgs/newlib/src/newlib/testsuite/newlib.string/memmove1.c",
"/hacking/cross/pkgs/newlib/src/newlib/testsuite/newlib.string/memcpy-1.c",
"/hacking/cross/pkgs/newlib/src/newlib/testsuite/newlib.string/strcmp-1.c",
"/hacking/cross/pkgs/newlib/src/newlib/testsuite/newlib.stdlib/size_max.c",
"/hacking/cross/pkgs/newlib/src/newlib/testsuite/newlib.stdlib/atexit.c",
"twctype.c",
"/hacking/cross/pkgs/newlib/src/newlib/testsuite/newlib.wctype/tiswctype.c",
"/hacking/cross/pkgs/newlib/src/newlib/testsuite/newlib.wctype/twctrans.c",
"/hacking/cross/pkgs/newlib/src/newlib/testsuite/newlib.search/hsearchtest.c",
"/hacking/cross/pkgs/newlib/src/newlib/testsuite/newlib.locale/UTF-8.c",
"/hacking/cross/pkgs/newlib/src/newlib/testsuite/newlib.stdio/nulprintf.c",
"/hacking/cross/pkgs/newlib/src/newlib/testsuite/newlib.stdio/swprintf.c"
]
}
}

59
qa/lib/newlib/testsuite/testsuite.rc.build

@ -0,0 +1,59 @@
#!/cmd/rc
if ( ~ 0 $#BUILD_INITIALIZED ) . $JEHANNE/arch/rc/lib/build/utils.rc
NEWLIB_TESTSUITE=$JEHANNE/hacking/cross/pkgs/newlib/src/newlib/testsuite/
TARGET_DIR=$JEHANNE/arch/$ARCH/qa/lib/newlib/testsuite
CFLAGS=( \
-g \
-gdwarf-2 \
-ggdb \
'-mcmodel=small' \
-Wall \
-Wno-main \
-Wno-missing-braces \
-Wno-parentheses \
-Wno-unknown-pragmas \
-iquote $NEWLIB_TESTSUITE/include \
-fstack-check \
-Wno-unused-variable \
-Wno-format \
-fstack-protector-all \
-O2 \
'-std=gnu11' \
-static \
)
cat $NEWLIB_TESTSUITE/newlib.wctype/twctype.c|sed 's/0x0967/0x0905/g' > twctype.c
mkdir -p $TARGET_DIR
rm -f *.tag.*
$CC $NEWLIB_TESTSUITE/newlib.string/tstring.c -o tstring ../libposix_customization.c $CFLAGS
mv tstring $TARGET_DIR
$CC $NEWLIB_TESTSUITE/newlib.string/memmove1.c -o memmove1 ../libposix_customization.c $CFLAGS
mv memmove1 $TARGET_DIR
$CC $NEWLIB_TESTSUITE/newlib.string/memcpy-1.c -o memcpy-1 ../libposix_customization.c $CFLAGS
mv memcpy-1 $TARGET_DIR
$CC $NEWLIB_TESTSUITE/newlib.string/strcmp-1.c -o strcmp-1 ../libposix_customization.c $CFLAGS
mv strcmp-1 $TARGET_DIR
$CC $NEWLIB_TESTSUITE/newlib.stdlib/size_max.c -o size_max ../libposix_customization.c $CFLAGS
mv size_max $TARGET_DIR
$CC $NEWLIB_TESTSUITE/newlib.stdlib/atexit.c -o atexit ../libposix_customization.c $CFLAGS
mv atexit $TARGET_DIR
$CC twctype.c -o twctype ../libposix_customization.c $CFLAGS
mv twctype $TARGET_DIR
$CC $NEWLIB_TESTSUITE/newlib.wctype/tiswctype.c -o tiswctype ../libposix_customization.c $CFLAGS
mv tiswctype $TARGET_DIR
$CC $NEWLIB_TESTSUITE/newlib.wctype/twctrans.c -o twctrans ../libposix_customization.c $CFLAGS
mv twctrans $TARGET_DIR
$CC $NEWLIB_TESTSUITE/newlib.search/hsearchtest.c -o hsearchtest ../libposix_customization.c $CFLAGS
mv hsearchtest $TARGET_DIR
$CC $NEWLIB_TESTSUITE/newlib.locale/UTF-8.c -o UTF-8 ../libposix_customization.c $CFLAGS
mv UTF-8 $TARGET_DIR
$CC $NEWLIB_TESTSUITE/newlib.stdio/nulprintf.c -o nulprintf ../libposix_customization.c $CFLAGS
mv nulprintf $TARGET_DIR
$CC $NEWLIB_TESTSUITE/newlib.stdio/swprintf.c -o swprintf ../libposix_customization.c $CFLAGS
mv swprintf $TARGET_DIR
cp *.runner $JEHANNE/arch/$ARCH/qa/lib/newlib/testsuite/
git clean -xdf .

11
qa/lib/thread/build.json

@ -1,11 +0,0 @@
{
"RegressionTests": {
"Include": [
"/sys/src/cmd/cmd.json"
],
"Install": "/arch/$ARCH/qa/lib/thread",
"SourceFilesCmd": [
"thread.c"
]
}
}

6
qa/lib/thread/thread.rc.build

@ -0,0 +1,6 @@
#!/cmd/rc
if ( ~ 0 $#BUILD_INITIALIZED ) . $JEHANNE/arch/rc/lib/build/utils.rc
rm -f *.tag.*
compileCommands c $JEHANNE/arch/$ARCH/qa/lib/thread
rm -f *.o

6
qa/qa.rc.build

@ -0,0 +1,6 @@
#!/cmd/rc
build kern/
build lib/c/
build lib/thread/
build lib/newlib
build gnu/gcc/

53
sys/src/cmd/FromYacc.rc.build

@ -0,0 +1,53 @@
#!/cmd/rc
if ( ~ 0 $#BUILD_INITIALIZED ) . $JEHANNE/arch/rc/lib/build/utils.rc
yacc -d mpc.y && mv y.tab.c mpc.c && mv y.tab.h mpc.h
rm -f *.tag.*
$CC \
$JEHANNE/sys/src/lib/jehanne/lib9.c \
mpc.c \
'-DYYSIZE_T=size_t' \
-fstack-check \
-fstack-protector-all \
-9 \
-g \
-gdwarf-2 \
-ggdb \
'-mcmodel=small' \
-O0 \
-Wall \
-Werror \
-Wno-main \
-Wno-missing-braces \
-Wno-parentheses \
-Wno-unknown-pragmas \
-static \
-lavl \
-lcomplete \
-lcontrol \
-ldisk \
-lflate \
-lframe \
-lmemdraw \
-lmemlayer \
-lmemdraw \
-ldraw \
-lplumb \
-lregexp \
-lString \
-l9p \
-lauth \
-lauthsrv \
-lndb \
-lip \
-lsec \
-lauth \
-lmp \
-lthread \
-lbio \
-l9p2000 \
-ljehanne \
-o mpc
safemove mpc $JEHANNE/arch/$ARCH/cmd
rm mpc.c mpc.h
rm -f *.o

33
sys/src/cmd/acme/acme.rc.build

@ -0,0 +1,33 @@
#!/cmd/rc
if ( ~ 0 $#BUILD_INITIALIZED ) . $JEHANNE/arch/rc/lib/build/utils.rc
rm -f *.tag.*
$CC \
acme.c \
addr.c \
buff.c \
cols.c \
disk.c \
ecmd.c \
edit.c \
elog.c \
exec.c \
file.c \
fsys.c \
look.c \
regx.c \
rows.c \
scrl.c \
text.c \
time.c \
util.c \
wind.c \
xfid.c \
$STACKCHECK_CFLAGS \
$CFLAGS \
$CMD_OFLAGS \
-o acme
safemove acme $JEHANNE/arch/$ARCH/cmd
rm -f *.o
build aux/

8
sys/src/cmd/acme/aux/aux.rc.build

@ -0,0 +1,8 @@
#!/cmd/rc
if ( ~ 0 $#BUILD_INITIALIZED ) . $JEHANNE/arch/rc/lib/build/utils.rc
rm -f *.tag.*
compileCommands c $JEHANNE/arch/$ARCH/aux/acme
rm -f *.o
build win/

15
sys/src/cmd/acme/aux/build.json

@ -1,15 +0,0 @@
{
"Cmd": {
"Include": [
"/sys/src/cmd/cmd.json"
],
"Projects": [
"win/"
],
"Install": "/arch/$ARCH/aux/acme",
"SourceFilesCmd": [
"mkwnew.c",
"awd.c"
]
}
}

16
sys/src/cmd/acme/aux/win/build.json

@ -1,16 +0,0 @@
{
"win": {
"Include": [
"/sys/src/cmd/cmd.json"
],
"Install": "/arch/$ARCH/aux/acme/",
"Program": "win",
"SourceFiles": [
"fs.c",
"main.c",
"pipe.c",
"util.c",
"win.c"
]
}
}

16
sys/src/cmd/acme/aux/win/win.rc.build

@ -0,0 +1,16 @@
#!/cmd/rc
if ( ~ 0 $#BUILD_INITIALIZED ) . $JEHANNE/arch/rc/lib/build/utils.rc
rm -f *.tag.*
$CC \
fs.c \
main.c \
pipe.c \
util.c \
win.c \
$STACKCHECK_CFLAGS \
$CFLAGS \
$CMD_OFLAGS \
-o win
safemove win $JEHANNE/arch/$ARCH/aux/acme
rm -f *.o

36
sys/src/cmd/acme/build.json

@ -1,36 +0,0 @@
{
"acme": {
"Include": [
"/sys/src/cmd/cmd.json"
],
"Install": "/arch/$ARCH/cmd/",
"Program": "acme",
"SourceFiles": [
"acme.c",
"addr.c",
"buff.c",
"cols.c",
"disk.c",
"ecmd.c",
"edit.c",
"elog.c",
"exec.c",
"file.c",
"fsys.c",
"look.c",
"regx.c",
"rows.c",
"scrl.c",
"text.c",
"time.c",
"util.c",
"wind.c",
"xfid.c"
]
},
"aux": {
"Projects": [
"aux/"
]
}
}

16
sys/src/cmd/auth/authsrv.json

@ -1,16 +0,0 @@
{
"authsrv": {
"Include": [
"../cmd.json"
],
"Install": "/arch/$ARCH/cmd/auth/",
"Oflags": [
"lib/libauthcmd.a"
],
"Program": "authsrv",
"SourceFiles": [
"authsrv.c",
"secureidcheck.c"
]
}
}

50
sys/src/cmd/auth/build.json

@ -1,50 +0,0 @@
{
"Auth": {
"Include": [
"../cmd.json"
],
"Install": "/arch/$ARCH/cmd/auth/",
"Oflags": [
"lib/libauthcmd.a"
],
"Projects": [
"lib/libauthcmd.json",
"factotum/",
"secstore/",
"authsrv.json",
"dsa2pub.json",
"dsa2ssh.json",
"guard.srv.json",
"rsa2csr.json",
"rsa2pub.json",
"rsa2ssh.json",
"rsa2x509.json",
"rsafill.json"
],
"SourceFilesCmd": [
"as.c",
"asn12dsa.c",
"asn12rsa.c",
"changeuser.c",
"convkeys.c",
"cron.c",
"debug.c",
"dsagen.c",
"httpauth.c",
"keyfs.c",
"login.c",
"newns.c",
"none.c",
"passwd.c",
"pemdecode.c",
"pemencode.c",
"printnetkey.c",
"readnvram.c",
"rsagen.c",
"uniq.c",
"userpasswd.c",
"warning.c",
"wrkey.c"
]
}
}

16
sys/src/cmd/auth/dsa2pub.json

@ -1,16 +0,0 @@
{
"dsa2pub": {
"Include": [
"../cmd.json"
],
"Install": "/arch/$ARCH/bin/auth/",
"Oflags": [
"lib/libauthcmd.a"
],
"Program": "dsa2pub",
"SourceFiles": [
"dsa2pub.c",
"rsa2any.c"
]
}
}

16
sys/src/cmd/auth/dsa2ssh.json

@ -1,16 +0,0 @@
{
"dsa2ssh": {
"Include": [
"../cmd.json"
],
"Install": "/arch/$ARCH/bin/auth/",
"Oflags": [
"lib/libauthcmd.a"
],
"Program": "dsa2ssh",
"SourceFiles": [
"dsa2ssh.c",
"rsa2any.c"
]
}
}

27
sys/src/cmd/auth/factotum/build.json

@ -1,27 +0,0 @@
{
"factotum": {
"Include": [
"../../cmd.json"
],
"Install": "/arch/$ARCH/cmd/auth/",
"Program": "factotum",
"SourceFiles": [
"apop.c",
"chap.c",
"confirm.c",
"ecdsa.c",
"fs.c",
"httpdigest.c",
"log.c",
"p9any.c",
"p9cr.c",
"p9sk1.c",
"pass.c",
"rpc.c",
"rsa.c",
"util.c",
"wep.c",
"wpapsk.c"
]
}
}

27
sys/src/cmd/auth/factotum/factotum.rc.build

@ -0,0 +1,27 @@
#!/cmd/rc
if ( ~ 0 $#BUILD_INITIALIZED ) . $JEHANNE/arch/rc/lib/build/utils.rc
rm -f *.tag.*
$CC \
apop.c \
chap.c \
confirm.c \
ecdsa.c \
fs.c \
httpdigest.c \
log.c \
p9any.c \
p9cr.c \
p9sk1.c \
pass.c \
rpc.c \
rsa.c \
util.c \
wep.c \
wpapsk.c \
$STACKCHECK_CFLAGS \
$CFLAGS \
$CMD_OFLAGS \
-o factotum
safemove factotum $JEHANNE/arch/$ARCH/cmd/auth
rm -f *.o

16
sys/src/cmd/auth/guard.srv.json

@ -1,16 +0,0 @@
{
"guard.srv": {
"Include": [
"../cmd.json"
],
"Install": "/arch/$ARCH/bin/auth/",
"Oflags": [
"lib/libauthcmd.a"
],
"Program": "guard.srv",
"SourceFiles": [
"guard.srv.c",
"secureidcheck.c"
]
}
}

29
sys/src/cmd/auth/lib/libauthcmd.json

@ -1,29 +0,0 @@
{
"libauthcmd": {
"Cflags": [
"-I../"
],
"Include": [
"../../../lib/lib.json"
],
"Library": "libauthcmd.a",
"Install": "./",
"SourceFiles": [
"keyfmt.c",
"netcheck.c",
"okpasswd.c",
"readwrite.c",
"readarg.c",
"readln.c",
"getauthkey.c",
"log.c",
"error.c",
"fs.c",
"rdbio.c",
"querybio.c",
"wrbio.c",
"private.c",
"getexpiration.c"
]
}
}

16
sys/src/cmd/auth/rsa2csr.json

@ -1,16 +0,0 @@
{
"rsa2csr": {
"Include": [
"../cmd.json"
],
"Install": "/arch/$ARCH/bin/auth/",
"Oflags": [
"lib/libauthcmd.a"
],
"Program": "rsa2csr",
"SourceFiles": [
"rsa2csr.c",
"rsa2any.c"
]
}
}

16
sys/src/cmd/auth/rsa2pub.json

@ -1,16 +0,0 @@
{
"rsa2pub": {
"Include": [
"../cmd.json"
],
"Install": "/arch/$ARCH/bin/auth/",
"Oflags": [
"lib/libauthcmd.a"
],
"Program": "rsa2pub",
"SourceFiles": [
"rsa2pub.c",
"rsa2any.c"
]
}
}

16
sys/src/cmd/auth/rsa2ssh.json

@ -1,16 +0,0 @@
{
"rsa2ssh": {
"Include": [
"../cmd.json"
],
"Install": "/arch/$ARCH/bin/auth/",
"Oflags": [
"lib/libauthcmd.a"
],
"Program": "rsa2ssh",
"SourceFiles": [
"rsa2ssh.c",
"rsa2any.c"
]
}
}

16
sys/src/cmd/auth/rsa2x509.json

@ -1,16 +0,0 @@
{
"rsa2x509": {
"Include": [
"../cmd.json"
],
"Install": "/arch/$ARCH/bin/auth/",
"Oflags": [
"lib/libauthcmd.a"
],
"Program": "rsa2x509",
"SourceFiles": [
"rsa2x509.c",
"rsa2any.c"
]
}
}

16
sys/src/cmd/auth/rsafill.json

@ -1,16 +0,0 @@
{
"rsafill": {
"Include": [
"../cmd.json"
],
"Install": "/arch/$ARCH/bin/auth/",
"Oflags": [
"lib/libauthcmd.a"
],
"Program": "rsafill",
"SourceFiles": [
"rsafill.c",
"rsa2any.c"
]
}
}

13
sys/src/cmd/auth/secstore/aescbc.json

@ -1,13 +0,0 @@
{
"aescbc": {
"Include": [
"../../cmd.json"
],
"Install": "/arch/$ARCH/cmd/auth",
"Program": "aescbc",
"SourceFiles": [
"aescbc.c",
"util.c"
]
}
}

21
sys/src/cmd/auth/secstore/build.json

@ -1,21 +0,0 @@
{
"secstore": {
"Include": [
"../../cmd.json"
],
"Install": "/arch/$ARCH/cmd/auth/",
"Program": "secstore",
"Projects": [
"aescbc.json",
"secstored.json",
"secuser.json"
],
"SourceFiles": [
"pak.c",
"password.c",
"secstore.c",
"SConn.c",
"util.c"
]
}
}

81
sys/src/cmd/auth/secstore/secstore.rc.build

@ -0,0 +1,81 @@
#!/cmd/rc
if ( ~ 0 $#BUILD_INITIALIZED ) . $JEHANNE/arch/rc/lib/build/utils.rc
rm -f *.tag.*
$CC \
pak.c \
password.c \
secstore.c \
SConn.c \
util.c \
$STACKCHECK_CFLAGS \
$CFLAGS \
$CMD_OFLAGS \
-o secstore
safemove secstore $JEHANNE/arch/$ARCH/cmd/auth/
rm -f *.o
rm -f *.tag.*
$CC \
aescbc.c \
util.c \
$STACKCHECK_CFLAGS \
$CFLAGS \
$CMD_OFLAGS \
-o aescbc
safemove aescbc $JEHANNE/arch/$ARCH/cmd/auth/
rm -f *.o
rm -f *.tag.*
$CC \
dirls.c \
pak.c \
password.c \
SConn.c \
secstored.c \
../secureidcheck.c \
util.c \
$STACKCHECK_CFLAGS \
$CFLAGS \
$CMD_OFLAGS \
-o secstored
safemove secstored $JEHANNE/arch/$ARCH/cmd/auth/
rm -f *.o
rm -f *.tag.*
$CC \
pak.c \
password.c \
SConn.c \
secuser.c \
util.c \
$STACKCHECK_CFLAGS \
$CFLAGS \
$CMD_OFLAGS \
-o secuser
safemove secuser $JEHANNE/arch/$ARCH/cmd/auth/
rm -f *.o
{
"secstore": {
"Include": [
"../../cmd.json"
],
"Install": "/arch/$ARCH/cmd/auth/",
"Program": "secstore",
"Projects": [
"aescbc.json",
"secstored.json",
"secuser.json"
],
"SourceFiles": [
"pak.c",
"password.c",
"secstore.c",
"SConn.c",
"util.c"
]
}
}

18
sys/src/cmd/auth/secstore/secstored.json

@ -1,18 +0,0 @@
{
"secstored": {
"Include": [
"../../cmd.json"
],
"Install": "/arch/$ARCH/cmd/auth/",
"Program": "secstored",
"SourceFiles": [
"dirls.c",
"pak.c",
"password.c",
"SConn.c",
"secstored.c",
"../secureidcheck.c",
"util.c"
]
}
}

16
sys/src/cmd/auth/secstore/secuser.json

@ -1,16 +0,0 @@
{
"secuser": {
"Include": [
"../../cmd.json"
],
"Install": "/arch/$ARCH/cmd/auth/",
"Program": "secuser",
"SourceFiles": [
"pak.c",
"password.c",
"SConn.c",
"secuser.c",
"util.c"
]
}
}

28
sys/src/cmd/awk/awk.rc.build

@ -0,0 +1,28 @@
#!/cmd/rc
if ( ~ 0 $#BUILD_INITIALIZED ) . $JEHANNE/arch/rc/lib/build/utils.rc
yacc -d awkgram.y && mv y.tab.c awkgram.c
cat maketab.rc.template|template|rc > proctab.c
rm -f *.tag.*
$CC \
re.c \
lex.c \
main.c \
parse.c \
proctab.c \
popen.c \
tran.c \
lib.c \
run.c \
awkgram.c \
'-DYYMALLOC=malloc' \
$STACKCHECK_CFLAGS \
$CFLAGS \
$CMD_OFLAGS \
-o awk
safemove awk $JEHANNE/arch/$ARCH/cmd
git clean -xdf ./
rm -f *.o

31
sys/src/cmd/awk/build.json

@ -1,31 +0,0 @@
{
"awk": {
"Include": [
"/sys/src/cmd/cmd.json"
],
"Pre": [
"yacc -d awkgram.y && mv y.tab.c awkgram.c",
"go run maketab.go > proctab.c"
],
"Post": [
"git clean -xdf ./"
],
"Cflags": [
"-DYYMALLOC=malloc"
],
"Install": "/arch/$ARCH/cmd/",
"Program": "awk",
"SourceFiles": [
"re.c",
"lex.c",
"main.c",
"parse.c",
"proctab.c",
"popen.c",
"tran.c",
"lib.c",
"run.c",
"awkgram.c"
]
}
}

171
sys/src/cmd/awk/maketab.c

@ -1,171 +0,0 @@
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name Lucent Technologies or any of
its entities not be used in advertising or publicity pertaining
to distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/*
* this program makes the table to link function names
* and type indices that is used by execute() in run.c.
* it finds the indices in y.tab.h, produced by yacc.
*/
#include <u.h>
#include <lib9.h>
#include <bio.h>
#include "awk.h"
#include "y.tab.h"
struct xx
{ int token;
char *name;
char *pname;
} proc[] = {
{ PROGRAM, "program", nil },
{ BOR, "boolop", " || " },
{ AND, "boolop", " && " },
{ NOT, "boolop", " !" },
{ NE, "relop", " != " },
{ EQ, "relop", " == " },
{ LE, "relop", " <= " },
{ LT, "relop", " < " },
{ GE, "relop", " >= " },
{ GT, "relop", " > " },
{ ARRAY, "array", nil },
{ INDIRECT, "indirect", "$(" },
{ SUBSTR, "substr", "substr" },
{ SUB, "sub", "sub" },
{ GSUB, "gsub", "gsub" },
{ INDEX, "sindex", "sindex" },
{ SPRINTF, "awksprintf", "sprintf" },
{ ADD, "arith", " + " },
{ MINUS, "arith", " - " },
{ MULT, "arith", " * " },
{ DIVIDE, "arith", " / " },
{ MOD, "arith", " % " },
{ UMINUS, "arith", " -" },
{ POWER, "arith", " **" },
{ PREINCR, "incrdecr", "++" },
{ POSTINCR, "incrdecr", "++" },
{ PREDECR, "incrdecr", "--" },
{ POSTDECR, "incrdecr", "--" },
{ CAT, "cat", " " },
{ PASTAT, "pastat", nil },
{ PASTAT2, "dopa2", nil },
{ MATCH, "matchop", " ~ " },
{ NOTMATCH, "matchop", " !~ " },
{ MATCHFCN, "matchop", "matchop" },
{ INTEST, "intest", "intest" },
{ PRINTF, "awkprintf", "printf" },
{ PRINT, "printstat", "print" },
{ CLOSE, "closefile", "closefile" },
{ DELETE, "awkdelete", "awkdelete" },
{ SPLIT, "split", "split" },
{ ASSIGN, "assign", " = " },
{ ADDEQ, "assign", " += " },
{ SUBEQ, "assign", " -= " },
{ MULTEQ, "assign", " *= " },
{ DIVEQ, "assign", " /= " },
{ MODEQ, "assign", " %= " },
{ POWEQ, "assign", " ^= " },
{ CONDEXPR, "condexpr", " ?: " },
{ IF, "ifstat", "if(" },
{ WHILE, "whilestat", "while(" },
{ FOR, "forstat", "for(" },
{ DO, "dostat", "do" },
{ IN, "instat", "instat" },
{ NEXT, "jump", "next" },
{ NEXTFILE, "jump", "nextfile" },
{ EXIT, "jump", "exit" },
{ BREAK, "jump", "break" },
{ CONTINUE, "jump", "continue" },
{ RETURN, "jump", "ret" },
{ BLTIN, "bltin", "bltin" },
{ CALL, "call", "call" },
{ ARG, "arg", "arg" },
{ VARNF, "getnf", "NF" },
{ GETLINE, "getline", "getline" },
{ 0, "", "" },
};
#define SIZE (LASTTOKEN - FIRSTTOKEN + 1)
char *table[SIZE];
char *names[SIZE];
void main(int _, char** __)
{
struct xx *p;
int i, tok;
Biobuf *fp;
char *buf, *toks[3];
print("#include <u.h>\n");
print("#include <lib9.h>\n");
print("#include <bio.h>\n");
print("#include \"awk.h\"\n");
print("#include \"y.tab.h\"\n\n");
for (i = SIZE; --i >= 0; )
names[i] = "";
if ((fp = Bopen("y.tab.h", OREAD)) == nil) {
fprint(2, "maketab can't open y.tab.h!\n");
exits("can't open y.tab.h");
}
print("static char *printname[%d] = {\n", SIZE);
i = 0;
while ((buf = Brdline(fp, '\n')) != nil) {
buf[Blinelen(fp)-1] = '\0';
tokenize(buf, toks, 3);
if (toks[0] == nil || strcmp("#define", toks[0]) != 0) /* not a valid #define */
continue;
tok = strtol(toks[2], nil, 10);
if (tok < FIRSTTOKEN || tok > LASTTOKEN) {
fprint(2, "maketab funny token %d %s\n", tok, buf);
exits("funny token");
}
names[tok-FIRSTTOKEN] = (char *) malloc(strlen(toks[1])+1);
strcpy(names[tok-FIRSTTOKEN], toks[1]);
print("\t(char *) \"%s\",\t/* %d */\n", toks[1], tok);
i++;
}
print("};\n\n");
for (p=proc; p->token!=0; p++)
table[p->token-FIRSTTOKEN] = p->name;
print("\nCell *(*proctab[%d])(Node **, int) = {\n", SIZE);
for (i=0; i<SIZE; i++)
if (table[i]==0)
print("\tnullproc,\t/* %s */\n", names[i]);
else
print("\t%s,\t/* %s */\n", table[i], names[i]);
print("};\n\n");
print("char *tokname(int n)\n"); /* print a tokname() function */
print("{\n");
print(" static char buf[100];\n\n");
print(" if (n < FIRSTTOKEN || n > LASTTOKEN) {\n");
print(" sprint(buf, \"token %%d\", n);\n");
print(" return buf;\n");
print(" }\n");
print(" return printname[n-FIRSTTOKEN];\n");
print("}\n");
exits(0);
}

189
sys/src/cmd/awk/maketab.go

@ -1,189 +0,0 @@
/*
* This file is part of Jehanne.
*
* Copyright (C) 2016 Giacomo Tesio <giacomo@tesio.it>
*
* Jehanne is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2 of the License.
*
* Jehanne is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Jehanne. If not, see <http://www.gnu.org/licenses/>.
*/