🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3728

Re: Makefile with a function in dependency side

#3728
From: 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
Technical Details
Message-ID: <p53cs0bni0.fsf@lemming.engeast.baynetworks.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!torn!qcarhaaa.nortelnetworks.com!bcarh189.ca.nortel.com!bcarh8ab.ca.nortel.com!not-for-mail
References: <bcf444eb.0209230934.19aac7fb@posting.google.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109f73,b1afc18c7dca1ca8
X-Google-Attributes: gid109f73,public
X-Google-Thread: fc89c,b1afc18c7dca1ca8
X-Google-Attributes: gidfc89c,public
X-Google-Thread: 1025b4,b1afc18c7dca1ca8
X-Google-Attributes: gid1025b4,public
X-Google-ArrivalTime: 2002-09-23 10:58:28 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!torn!qcarhaaa.nortelnetworks.com!bcarh189.ca.nortel.com!bcarh8ab.ca.nortel.com!not-for-mail
From: "Paul D. Smith" <psmith@gnu.org>
Newsgroups: comp.unix.programmer,gnu.utils.help,gnu.misc.discuss
Subject: Re: Makefile with a function in dependency side
Date: 23 Sep 2002 13:54:15 -0400
Organization: GNU's Not Unix!
Lines: 26
Message-ID: <p53cs0bni0.fsf@lemming.engeast.baynetworks.com>
References: <bcf444eb.0209230934.19aac7fb@posting.google.com>
Reply-To: psmith@gnu.org
NNTP-Posting-Host: lemming.engeast.baynetworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
To: wsoto@uol.com.br (Walter Encinas)
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2