help-make
[Top][All Lists]
Advanced

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

Re: Hiding a Make function


From: Stephan Beal
Subject: Re: Hiding a Make function
Date: Mon, 30 Apr 2012 23:24:44 +0200

On Mon, Apr 30, 2012 at 9:41 PM, AB <address@hidden> wrote:

> #Error out if wildcard is used in "test.mk"
> LIST := $(wildcard *.txt)
>

this is rudimentary, but might work for simple cases:

address@hidden:~/tmp]$ cat wildcard.make
all:

NO_WILDCARD := $(shell grep -e '[$][(]wildcard .*)' $(MAKEFILE_LIST))
ifneq (,$(NO_WILDCARD))
$(error found wildcard)
endif

address@hidden:~/tmp]$ make -f wildcard.make
make: Nothing to be done for `all'.

when i add:

x = $(wildcard *.*)

i get:

wildcard.make:5: *** found wildcard.  Stop.

ACHTUNG: the final parenthesis in the grep is a kludge to work around what
appears to be a parsing bug in make:

NO_WILDCARD := $(shell grep -e '[$][(]wildcard ' $(MAKEFILE_LIST))

leads to:

wildcard.make:3: *** unterminated call to function `shell': missing `)'.
 Stop.

this means the above check will fail on multi-line $(wildcard) calls.

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal


reply via email to

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