From: Arun Thomas Date: Thu, 13 May 2010 19:29:42 +0000 (+0000) Subject: Awk build tweaks X-Git-Tag: v3.1.7~56 X-Git-Url: http://zhaoyanbai.com/repos/%24relpath%24doxygen.css?a=commitdiff_plain;h=5fa734b708044f3162b082e5fd7a34a5b4d8f991;p=minix.git Awk build tweaks -Make yacc invocation "less chatty to stderr" (again) -Generate proctab.c (again) --- diff --git a/commands/awk/Makefile b/commands/awk/Makefile index e2f3438ab..c12779db5 100644 --- a/commands/awk/Makefile +++ b/commands/awk/Makefile @@ -3,5 +3,15 @@ PROG= awk SRCS= awkgram.y b.c lex.c lib.c main.c parse.c proctab.c run.c tran.c YHEADER= yes +QUIET_YACC= yes + +build-tools: maketab + +proctab.c: maketab + ./maketab > proctab.c + +maketab: awkgram.h maketab.c + +CLEANFILES= maketab proctab.c .include diff --git a/commands/awk/maketab.c b/commands/awk/maketab.c index 739c36683..608bd5849 100644 --- a/commands/awk/maketab.c +++ b/commands/awk/maketab.c @@ -25,7 +25,7 @@ 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 ytab.h, produced by yacc. + * it finds the indices in awkgram.h, produced by yacc. */ #include @@ -120,12 +120,12 @@ int main(int argc, char *argv[]) printf("#include \n"); printf("#include \"awk.h\"\n"); - printf("#include \"ytab.h\"\n\n"); + printf("#include \"awkgram.h\"\n\n"); for (i = SIZE; --i >= 0; ) names[i] = ""; - if ((fp = fopen("ytab.h", "r")) == NULL) { - fprintf(stderr, "maketab can't open ytab.h!\n"); + if ((fp = fopen("awkgram.h", "r")) == NULL) { + fprintf(stderr, "maketab can't open awkgram.h!\n"); exit(1); } printf("static char *printname[%d] = {\n", SIZE); diff --git a/commands/awk/proctab.c b/commands/awk/proctab.c deleted file mode 100644 index f2c735807..000000000 --- a/commands/awk/proctab.c +++ /dev/null @@ -1,207 +0,0 @@ -#include -#include "awk.h" -#include "awkgram.h" - -static char *printname[93] = { - (char *) "FIRSTTOKEN", /* 258 */ - (char *) "PROGRAM", /* 259 */ - (char *) "PASTAT", /* 260 */ - (char *) "PASTAT2", /* 261 */ - (char *) "XBEGIN", /* 262 */ - (char *) "XEND", /* 263 */ - (char *) "NL", /* 264 */ - (char *) "ARRAY", /* 265 */ - (char *) "MATCH", /* 266 */ - (char *) "NOTMATCH", /* 267 */ - (char *) "MATCHOP", /* 268 */ - (char *) "FINAL", /* 269 */ - (char *) "DOT", /* 270 */ - (char *) "ALL", /* 271 */ - (char *) "CCL", /* 272 */ - (char *) "NCCL", /* 273 */ - (char *) "CHAR", /* 274 */ - (char *) "OR", /* 275 */ - (char *) "STAR", /* 276 */ - (char *) "QUEST", /* 277 */ - (char *) "PLUS", /* 278 */ - (char *) "EMPTYRE", /* 279 */ - (char *) "AND", /* 280 */ - (char *) "BOR", /* 281 */ - (char *) "APPEND", /* 282 */ - (char *) "EQ", /* 283 */ - (char *) "GE", /* 284 */ - (char *) "GT", /* 285 */ - (char *) "LE", /* 286 */ - (char *) "LT", /* 287 */ - (char *) "NE", /* 288 */ - (char *) "IN", /* 289 */ - (char *) "ARG", /* 290 */ - (char *) "BLTIN", /* 291 */ - (char *) "BREAK", /* 292 */ - (char *) "CLOSE", /* 293 */ - (char *) "CONTINUE", /* 294 */ - (char *) "DELETE", /* 295 */ - (char *) "DO", /* 296 */ - (char *) "EXIT", /* 297 */ - (char *) "FOR", /* 298 */ - (char *) "FUNC", /* 299 */ - (char *) "SUB", /* 300 */ - (char *) "GSUB", /* 301 */ - (char *) "IF", /* 302 */ - (char *) "INDEX", /* 303 */ - (char *) "LSUBSTR", /* 304 */ - (char *) "MATCHFCN", /* 305 */ - (char *) "NEXT", /* 306 */ - (char *) "NEXTFILE", /* 307 */ - (char *) "ADD", /* 308 */ - (char *) "MINUS", /* 309 */ - (char *) "MULT", /* 310 */ - (char *) "DIVIDE", /* 311 */ - (char *) "MOD", /* 312 */ - (char *) "ASSIGN", /* 313 */ - (char *) "ASGNOP", /* 314 */ - (char *) "ADDEQ", /* 315 */ - (char *) "SUBEQ", /* 316 */ - (char *) "MULTEQ", /* 317 */ - (char *) "DIVEQ", /* 318 */ - (char *) "MODEQ", /* 319 */ - (char *) "POWEQ", /* 320 */ - (char *) "PRINT", /* 321 */ - (char *) "PRINTF", /* 322 */ - (char *) "SPRINTF", /* 323 */ - (char *) "ELSE", /* 324 */ - (char *) "INTEST", /* 325 */ - (char *) "CONDEXPR", /* 326 */ - (char *) "POSTINCR", /* 327 */ - (char *) "PREINCR", /* 328 */ - (char *) "POSTDECR", /* 329 */ - (char *) "PREDECR", /* 330 */ - (char *) "VAR", /* 331 */ - (char *) "IVAR", /* 332 */ - (char *) "VARNF", /* 333 */ - (char *) "CALL", /* 334 */ - (char *) "NUMBER", /* 335 */ - (char *) "STRING", /* 336 */ - (char *) "REGEXPR", /* 337 */ - (char *) "GETLINE", /* 338 */ - (char *) "SUBSTR", /* 339 */ - (char *) "SPLIT", /* 340 */ - (char *) "RETURN", /* 341 */ - (char *) "WHILE", /* 342 */ - (char *) "CAT", /* 343 */ - (char *) "UMINUS", /* 344 */ - (char *) "NOT", /* 345 */ - (char *) "POWER", /* 346 */ - (char *) "INCR", /* 347 */ - (char *) "DECR", /* 348 */ - (char *) "INDIRECT", /* 349 */ - (char *) "LASTTOKEN", /* 350 */ -}; - - -Cell *(*proctab[93])(Node **, int) = { - nullproc, /* FIRSTTOKEN */ - program, /* PROGRAM */ - pastat, /* PASTAT */ - dopa2, /* PASTAT2 */ - nullproc, /* XBEGIN */ - nullproc, /* XEND */ - nullproc, /* NL */ - array, /* ARRAY */ - matchop, /* MATCH */ - matchop, /* NOTMATCH */ - nullproc, /* MATCHOP */ - nullproc, /* FINAL */ - nullproc, /* DOT */ - nullproc, /* ALL */ - nullproc, /* CCL */ - nullproc, /* NCCL */ - nullproc, /* CHAR */ - nullproc, /* OR */ - nullproc, /* STAR */ - nullproc, /* QUEST */ - nullproc, /* PLUS */ - nullproc, /* EMPTYRE */ - boolop, /* AND */ - boolop, /* BOR */ - nullproc, /* APPEND */ - relop, /* EQ */ - relop, /* GE */ - relop, /* GT */ - relop, /* LE */ - relop, /* LT */ - relop, /* NE */ - instat, /* IN */ - arg, /* ARG */ - bltin, /* BLTIN */ - jump, /* BREAK */ - closefile, /* CLOSE */ - jump, /* CONTINUE */ - awkdelete, /* DELETE */ - dostat, /* DO */ - jump, /* EXIT */ - forstat, /* FOR */ - nullproc, /* FUNC */ - sub, /* SUB */ - gsub, /* GSUB */ - ifstat, /* IF */ - sindex, /* INDEX */ - nullproc, /* LSUBSTR */ - matchop, /* MATCHFCN */ - jump, /* NEXT */ - jump, /* NEXTFILE */ - arith, /* ADD */ - arith, /* MINUS */ - arith, /* MULT */ - arith, /* DIVIDE */ - arith, /* MOD */ - assign, /* ASSIGN */ - nullproc, /* ASGNOP */ - assign, /* ADDEQ */ - assign, /* SUBEQ */ - assign, /* MULTEQ */ - assign, /* DIVEQ */ - assign, /* MODEQ */ - assign, /* POWEQ */ - printstat, /* PRINT */ - awkprintf, /* PRINTF */ - awksprintf, /* SPRINTF */ - nullproc, /* ELSE */ - intest, /* INTEST */ - condexpr, /* CONDEXPR */ - incrdecr, /* POSTINCR */ - incrdecr, /* PREINCR */ - incrdecr, /* POSTDECR */ - incrdecr, /* PREDECR */ - nullproc, /* VAR */ - nullproc, /* IVAR */ - getnf, /* VARNF */ - call, /* CALL */ - nullproc, /* NUMBER */ - nullproc, /* STRING */ - nullproc, /* REGEXPR */ - awkgetline, /* GETLINE */ - substr, /* SUBSTR */ - split, /* SPLIT */ - jump, /* RETURN */ - whilestat, /* WHILE */ - cat, /* CAT */ - arith, /* UMINUS */ - boolop, /* NOT */ - arith, /* POWER */ - nullproc, /* INCR */ - nullproc, /* DECR */ - indirect, /* INDIRECT */ - nullproc, /* LASTTOKEN */ -}; - -char *tokname(int n) -{ - static char buf[100]; - - if (n < FIRSTTOKEN || n > LASTTOKEN) { - sprintf(buf, "token %d", n); - return buf; - } - return printname[n-FIRSTTOKEN]; -} diff --git a/etc/mk/minix.sys.mk b/etc/mk/minix.sys.mk index d7cb479ed..e7f096b95 100644 --- a/etc/mk/minix.sys.mk +++ b/etc/mk/minix.sys.mk @@ -200,9 +200,15 @@ LFLAGS+= ${LPREFIX:D-P${LPREFIX}} YFLAGS+= ${YPREFIX.${.IMPSRC:T}:D-p${YPREFIX.${.IMPSRC:T}}} ${YHEADER.${.IMPSRC:T}:D-d} YFLAGS+= ${YPREFIX:D-p${YPREFIX}} ${YHEADER:D-d} +.ifdef QUIET_YACC +.y.c: + ${_MKTARGET_YACC} + ${YACC.y} -o ${.TARGET} ${.IMPSRC} 2> /dev/null +.else .y.c: ${_MKTARGET_YACC} ${YACC.y} -o ${.TARGET} ${.IMPSRC} +.endif .ifdef YHEADER .y.h: ${.TARGET:.h=.c}