Changeset 2382

Show
Ignore:
Timestamp:
01/13/2010 23:41:05 (7 months ago)
Author:
bird
Message:

kash: made it build on mac os x again.

Location:
trunk/src/kash
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/Makefile.kmk

    r2376 r2382  
    8686        bltin/test.c \ 
    8787        \ 
    88         $(PATH_kash)/arith.c \ 
    89         $(PATH_kash)/arith_lex.c \ 
    9088        $(PATH_kash)/builtins.c \ 
    9189        $(PATH_kash)/init.c \ 
     
    110108 
    111109kash_INTERMEDIATES = \ 
    112         $(PATH_kash)/arith.h \ 
    113110        $(PATH_kash)/builtins.h \ 
    114111        $(PATH_kash)/nodes.h \ 
     
    116113kash_CLEAN = \ 
    117114        $(kash_INTERMEDIATES) \ 
    118         $(PATH_kash)/arith.c \ 
    119         $(PATH_kash)/arith_lex.c \ 
    120115        $(PATH_kash)/builtins.c \ 
    121116        $(PATH_kash)/init.c \ 
     
    135130# Use the pregenerated code. 
    136131# 
    137 kash_INTERMEDIATES := 
    138 kash_INCS += generated 
    139 kash_SOURCES := $(patsubst $(PATH_kash)/%,generated/%,$(kash_SOURCES)) 
     132kash_SOURCES += \ 
     133        $(kash_0_OUTDIR)/arith.c \ 
     134        $(kash_0_OUTDIR)/arith_lex.c 
     135 
     136define def_copy_generated 
     137$$(kash_0_OUTDIR)/$(src): $(PATH_SUB_CURRENT)/generated/$(src) 
     138        $$(RM) -f $$@ 
     139        $$(CP) -f $$^ $$@ 
     140endef 
     141 
     142$(foreach src, arith.h arith.c arith_lex.c builtins.h builtins.c nodes.h nodes.c token.h init.c,\ 
     143$(eval $(def_copy_generated))) 
    140144 
    141145else 
     146 
     147# 
     148# Generate the code on the fly. 
     149# 
     150 
     151USES += lex yacc 
     152kash_USES = lex yacc 
     153kash_LEXTOOL = FLEX 
     154kash_LEXFLAGS = -8 
     155#kash_YACCTOOL = BISON 
     156kash_YACCTOOL = YACC 
     157kash_YACCFLAGS = -ld 
     158kash_SOURCES += \ 
     159        arith.y \ 
     160        arith_lex.l 
    142161 
    143162# 
     
    150169# 
    151170BOOTSTRAP_SHELL ?= $(SHELL) 
    152 ifndef YACC 
    153  YACC := $(firstword $(which byacc) $(which yacc) yacc) 
    154 endif 
    155  
    156 $$(PATH_kash)/arith.h + $$(PATH_kash)/arith.c: arith.y | $$(dir $$@) 
    157         $(YACC) -ld $^ 
    158         $(MV) -f y.tab.c $(PATH_kash)/arith.c 
    159         $(MV) -f y.tab.h $(PATH_kash)/arith.h 
    160  
    161 $$(PATH_kash)/arith_lex.c: $$(kash_DEFPATH)/arith_lex.l | $$(dir $$@) 
    162         flex -8 -o$@ $^                     # 8-bit lex scanner for arithmetic 
    163171 
    164172$$(PATH_kash)/builtins.h + $$(PATH_kash)/builtins.c: \ 
  • trunk/src/kash/arith.y

    r1233 r2382  
    191191yyerror(const char *s) 
    192192{ 
    193    shinstance *psh = arith_psh; 
     193    shinstance *psh = arith_psh; 
     194#ifndef YYBISON /* yyerrok references yyerrstatus which is a local variable in yyparse().*/ 
    194195        yyerrok; 
     196#endif 
    195197        yyclearin; 
    196198        arith_lex_reset();      /* reprime lex */