Giter Club home page Giter Club logo

makefile2dot's People

Contributors

vak avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

makefile2dot's Issues

Does not take target-local variable assignments into account

I am actually coming from the fork at https://github.com/chadsgilbert/makefile2dot, which is linked by the PyPI page at https://pypi.org/project/makefile2dot/. However, there I cannot create issues and I am assuming, that the same issue persists in this repository:

In Makefiles one can assign variables locally for only one target. For example:

target1: SOME_VAR := some_value
target1:
    printf "%s\n" "${SOME_VAR}"

When this kind of Makefile is input for makefile2dot, then makefile2dot fails:

$ makefile2dot
Traceback (most recent call last):
  File "LOCATION_OF_MYVENV/bin/makefile2dot", line 23, in <module>
    makefile2dot(direction=ARGS.direction, output=ARGS.output, view=ARGS.view)
  File "LOCATION_OF_MYVENV/lib/python3.10/site-packages/makefile2dot/__init__.py", line 71, in makefile2dot
    graph = build_graph(stream_database(), direction=direction)
  File "LOCATION_OF_MYVENV/lib/python3.10/site-packages/makefile2dot/__init__.py", line 39, in build_graph
    target, dependencies = line.split(':')
ValueError: too many values to unpack (expected 2)
make: *** [Makefile:385: makefile-graph] Error 1

makefile2dot does not take local variable assignment syntax into account and runs into an error.

a couple bugfixes

I realize you're probably not interested in maintaining this program any more, but just in case: I downloaded a copy and made a couple changes to make it work better. First, changed the print statements to Python3 (actually, to stderr.write(...) statements).

More importantly, I added code to chop off comments (which were being interpreted as if they were makefile code), and to escape '%'. I'm not sure why the latter is necessary, but without it "%.foo" turns into something like "%27". The line in question was
line_to_emit += line
and is now
line_to_emit += line.split('#')[0].replace('%', '\%')

There are some other things going on that I haven't been able to pin down, but as you say, it was experimental...

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.