Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not take target-local variable assignments into account #3

Open
ZelphirKaltstahl opened this issue Apr 18, 2024 · 1 comment
Open

Comments

@ZelphirKaltstahl
Copy link

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.

@vak
Copy link
Owner

vak commented Apr 22, 2024

thank you for your interest.

This project was just to solve the task I was having. I never considered this project seriously :)
Feel free to clone, fix and enrich it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants