"Fossies" - the Fresh Open Source Software Archive

Member "cook-2.34/datadir/bison" (25 Sep 2010, 2542 Bytes) of package /linux/misc/old/cook-2.34.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2  * NAME
    3  *      bison - how to use bison
    4  *
    5  * DESCRIPTION
    6  *      This cookbook describes how to use bison.
    7  *
    8  *      You will have to add "-d" to the [bison_flags] variable
    9  *      if you want %.h files generated.
   10  *
   11  *      If a y.output file is constructed, it will be moved to %.list
   12  *
   13  * RECIPES
   14  *      %.c %.h: %.y    applied if -d in [bison_flags]
   15  *      %.c: %.y        applied if -d not in [bison_flags]
   16  *
   17  * VARIABLES
   18  *      bison_src       bison source files in the current directory.
   19  *      dot_src         Source files constructable in the current directory
   20  *                      (unioned with existing setting, if necessary).
   21  *      dot_obj         Object files constructable in the current directory
   22  *                      (unioned with existing setting, if necessary).
   23  *      dot_clean       Files which may be removed from the current directory
   24  *                      in a clean target.
   25  *      dot_lint_obj    Lint object files constructable in the current directory
   26  *                      (unioned with existing setting, if necessary).
   27  * Copyright (C) 1997-2007, 2010 Peter Miller
   28  */
   29 
   30 #pragma once
   31 
   32 #include "c"
   33 
   34 if [not [defined bison]] then
   35         bison = bison;
   36 if [not [defined bison_flags]] then
   37         bison_flags = ;
   38 bison_src = [glob *.y];
   39 cc_src = [stringset [cc_src] - [fromto %.y %.c [bison_src]]];
   40 dot_src =
   41         [stringset
   42                 [dot_src] [bison_src]
   43         -
   44                 [fromto %.y %.c [bison_src]] [fromto %.y %.s [bison_src]]
   45         ];
   46 dot_obj = [stringset [dot_obj] [fromto %.y %.o [bison_src]]];
   47 dot_clean =
   48         [stringset
   49                 [dot_clean]
   50                 [fromto %.y %.c [bison_src]]
   51                 [fromto %.y %.output [bison_src]]
   52                 [fromto %.y %.tab.c [bison_src]]
   53                 [fromto %.y %.tab.h [bison_src]]
   54                 [fromto %.y %.ln [bison_src]]
   55                 [fromto %.y %.s [bison_src]]
   56         ];
   57 dot_lint_obj = [stringset [dot_lint_obj] [fromto %.y %.ln [bison_src]]];
   58 
   59 %.c %.h: %.y
   60         if [in -d [bison_flags]]
   61         single-thread %.tab.c %.tab.h %.output
   62 {
   63         if [exists %.output] then
   64                 rm -f %.output
   65                         set clearstat;
   66         [bison] [bison_flags] %.y;
   67         mv %.tab.c %.c;
   68         mv %.tab.h %.h;
   69 }
   70 
   71 %.c: %.y
   72         if [not [in -d [bison_flags]]]
   73         single-thread %.tab.c %.output
   74 {
   75         if [exists %.output] then
   76                 rm -f %.output
   77                         set clearstat;
   78         [bison] [bison_flags] %.y;
   79         mv %.tab.c %.c;
   80 }