🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.unix.programmer
2 messages
2 total messages Started by Walter Encinas Mon, 23 Sep 2002 17:34
Makefile with a function in dependency side
#3727
Author: Walter Encinas
Date: Mon, 23 Sep 2002 17:34
22 lines
1377 bytes
Hi all

	I need to build a makefile with a make rule that uses a function
result as a dependency. This function F must receive target as a
parameter, such as:

%.log	: $(call F,%)

or

%.log	: $(call F,$@)

or even

%.log	: $(call F,$$@)

	None of these tries worked. I am using GNU Make version 3.78.1. Any
suggestion?

	Thanks in advance

				Walter
Re: Makefile with a function in dependency side
#3728
Author: Paul D. Smith
Date: Mon, 23 Sep 2002 17:54
26 lines
1995 bytes
%% wsoto@uol.com.br (Walter Encinas) writes:

  we> I need to build a makefile with a make rule that uses a function
  we> result as a dependency.

You can't.


Your only option is to use GNU make's auto-re-exec feature to generate a
dynamic makefile: write a rule that generates a makefile containing the
information you need (so you have the full power of the shell to create
it).  Then include it:

  dynamic.mk: Makefile
          @rm -f $@
          @for f in $(TARGETS); do \
            echo "$$f : \$$($$f_SRCS)" >> $@; \
           done

  include dynamic.mk

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@gnu.org>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads