[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to debug my Makefile
From: |
thutt |
Subject: |
How to debug my Makefile |
Date: |
Fri, 20 Jul 2018 06:22:29 -0700 |
Stefan Monnier writes:
> My `make` complains that
>
> make: execvp: /bin/sh: Argument list too long
> make: execvp: /bin/sh: Argument list too long
>
> but I'm having trouble figuring out which command's argument list is
> too long. I tried "make -d" but it doesn't really help:
>
> % LANG=C make -d
<snip>
> As you can see, the error seems to be signaled "early".
> How could I track it down?
>
If 'make -n' doesn't point out the long command line, then your
diagnosis that it's the use of $(shell) is probably the culprit.
> Looking at the make file I see one $(shell ..) invocation which is the
> most likely culprit:
>
> define SET-diff
> $(shell echo "$(1)" "$(2)" "$(2)" | tr ' ' '\n' | sort | uniq -u)
> endef
Could you use a standard Make rule to generate an output file, and
then use redirection to provide the output file to any programs.
Within Gnu Make, it's pretty easy to $(sort) sort a list, but
de-duplicating it is a bit tougher. It could be done fairly easily
with the associative arrays or sets in the Gnu Make Standard Library:
https://gmsl.sourceforge.io/