help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to debug my Makefile


From: Stefan Monnier
Subject: How to debug my Makefile
Date: Thu, 19 Jul 2018 21:39:43 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

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
    GNU Make 4.2.1
    Built for i686-pc-linux-gnu
    Copyright (C) 1988-2016 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Reading makefiles...
    Reading makefile 'GNUmakefile'...
    make: execvp: /bin/sh: Argument list too long
    make: execvp: /bin/sh: Argument list too long
    Updating makefiles....
     Considering target file 'GNUmakefile'.
      Looking for an implicit rule for 'GNUmakefile'.
      Trying pattern rule with stem 'GNUmakefile'.
      Trying implicit prerequisite 'GNUmakefile.o'.
      Trying pattern rule with stem 'GNUmakefile'.
      Trying implicit prerequisite 'GNUmakefile.c'.
      Trying pattern rule with stem 'GNUmakefile'.
      Trying implicit prerequisite 'GNUmakefile.cc'.
      Trying pattern rule with stem 'GNUmakefile'.
      Trying implicit prerequisite 'GNUmakefile.C'.
      Trying pattern rule with stem 'GNUmakefile'.
      Trying implicit prerequisite 'GNUmakefile.cpp'.
      Trying pattern rule with stem 'GNUmakefile'.
      Trying implicit prerequisite 'GNUmakefile.p'.
      Trying pattern rule with stem 'GNUmakefile'.
      Trying implicit prerequisite 'GNUmakefile.f'.
      Trying pattern rule with stem 'GNUmakefile'.
    [...]

As you can see, the error seems to be signaled "early".
How could I track it down?

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

which I use for example in:

    extra_els := $(call SET-diff, $(els), $(patsubst %.elc, %.el, 
$(current_elcs)))

where `els` and `current_elcs` hold lists of file names (and there are
more than 1000 files).  Is there some way to compute this set-difference
without going through the shell, or passing the content of those
variables via stdin?


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]