help-make
[Top][All Lists]
Advanced

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

use functions to create rules


From: ogronom
Subject: use functions to create rules
Date: Mon, 11 Jun 2012 23:53:42 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120401 Firefox/11.0 SeaMonkey/2.8

Hi all,

I'm having troubles at using make-functions to create make-rules. I find
info pages quite confusing about this.

Here is the sample code, that is demonstrates the idea

# --------BEGIN
tests_SRC=1.c 2.c
tests=$(tests_SRC:.c=.out))

define out_template =
$(DEST_DIR)/$$($(1):.c=.out) : $(1)
        echo $$@ $(1)
endef

$(eval $(call $(out_template 1.c)))
$(eval $(call $(out_template 2.c)))

all: $(tests)

check: $(tests)
        for f in $(tests) ; do ./$$f ; done
#---------END

Usual respond is

make: *** No rule to make target `1.out', needed by `all'.  Stop.

How can I make the things right?



reply via email to

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