GithubHelp home page GithubHelp logo

benhoyt / awkmake Goto Github PK

View Code? Open in Web Editor NEW
13.0 4.0 1.0 13 KB

Code to go with my article "The AWK book's 60-line version of Make"

Home Page: https://benhoyt.com/writings/awk-make/

Awk 42.22% C 5.31% Yacc 6.43% Makefile 5.00% Python 41.03%
awk make makefile python

awkmake's Introduction

This repo is intended to go with my article, "The AWK book's 60-line version of Make". It contains make.awk, the minimalist Make program written in AWK that's included in The AWK Programming Language, as well as make.py, my Python port of the program.

To try the programs, clone the repo and cd to the example directory:

$ git clone https://github.com/benhoyt/awkmake
$ cd example

To run the AWK version (ignore the yacc warnings):

$ awk -f ../make.awk prog
		gcc -c prog.h a.c
		gcc -c prog.h b.c
		yacc c.y
		mv y.tab.c c.c
c.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
c.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
		gcc -c c.c
c.c: In function ‘yyparse’:
c.c:1034:16: warning: implicit declaration of function ‘yylex’ [-Wimplicit-function-declaration]
 1034 |       yychar = yylex ();
      |                ^~~~~
y.tab.c:1169:7: warning: implicit declaration of function ‘yyerror’; did you mean ‘yyerrok’? [-Wimplicit-function-declaration]
		gcc a.o b.o c.o -o prog

$ awk -f ../make.awk prog
prog is up to date

$ touch a.c
$ awk -f ../make.awk prog
		gcc -c prog.h a.c
		gcc a.o b.o c.o -o prog

$ awk -f ../make.awk prog
prog is up to date

To run the Python version:

$ python3 ../make.py prog
prog is up to date

awkmake's People

Contributors

benhoyt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

niarfe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.