[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to debug my Makefile
From: |
thutt |
Subject: |
Re: How to debug my Makefile |
Date: |
Fri, 20 Jul 2018 10:48:03 -0700 |
Stefan Monnier writes:
> > > 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,
>
> How could I generate an output file via a Make rule when the desired
> content of the file is in a Make variable that's too big for the
> command line?
You can use the 'foreach' function to split each individual file into
a seaprate output, thereby avoiding a too-long command line. In the
example below, I construct a long list of files using 'wildcard', and
then output them one-by-one to a file in /tmp.
.PHONY: default
/tmp/headers:
[ ! -e $@ ] || rm $@;
@$(foreach fname,$(wildcard /usr/include/*.h),echo "file: $(fname)"
>>$@;)
> > It could be done fairly easily
> > with the associative arrays or sets in the Gnu Make Standard Library:
<snip, URL -- avoid silly 'protection' provided by corp network>
>
> Wow, heroic!
> I'll see how/if I can make use of it, thanks,
>
The author of the GMSL has a pretty good (IMHO) book on obscure (but
useful) things you can do with Gnu Make. It's called Gnu Make Unleashed.
--
A containerized AI has launched a pingflood siege on my microservice.