🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #41401

Re: GNU make and $$@

#41401
From: Paul D. Smith
Date: Tue, 26 Mar 1996 00:00
48 lines
2292 bytes
%% Regarding GNU make and $$@;
%% djm@morticia.inmos.co.uk (David McKay) writes:

    dm> It says in the documentation that this construct can be replaced
    dm> with a static pattern rule, so I tried

    dm> $(EXPORTS) : %: $(notdir $@)

You cannot use _any_ automatic variables in GNU make in the target or
dependency lists, in any type of rule.  Automatic variables (like $@)
are defined only for command scripts.

You can use only patterns.  And I don't think you can use functions on
patterns, either; e.g., I don't think this works:

  $(EXPORTS) : % : $(notdir %)

The only way you can do it that I'm aware of is to break it up into
multiple variables, one for each target directory; I use a PUBBINS for
exported binaries, PUBLIBS for exported libraries, and PUBHDRS for
exported headers, like this:

  BINDIR = /top/bin
  LIBDIR = /top/lib
  HDRDIR = /top/include

  PUBBINS = bin
  PUBLIBS = liblib.a
  PUBHDRS = hdr.h

  $(PUBBINS:%=$(BINDIR)/%) : $(BINDIR)/% : %
        $(INSTALL) -m 755 $^ $(BINDIR)

  $(PUBLIBS:%=$(LIBDIR)/%) : $(LIBDIR)/% : %
        $(INSTALL) -m 644 $^ $(LIBDIR)

  $(PUBHDRS:%=$(HDRDIR)/%) : $(HDRDIR)/% : %
        $(INSTALL) -m 644 $^ $(HDRDIR)

etc.
-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@baynetworks.com>         Network Management Development
 Senior Software Engineer                                   Bay Networks, Inc.
-----------------------------------------------==<http://www.baynetworks.com/>-
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
     These are my opinions--Bay Networks takes no responsibility for them.
Technical Details
Message-ID: <p5enqfybj4.fsf@lemming.wellfleet.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <4j8gnq$ril@morticia.inmos.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,1e70933fd3d09243
X-Google-Attributes: gid11318c,public
From: psmith@lemming.wellfleet.com (Paul D. Smith)
Subject: Re: GNU make and $$@
Date: 1996/03/26
Message-ID: <p5enqfybj4.fsf@lemming.wellfleet.com>
X-Deja-AN: 144208871
references: <4j8gnq$ril@morticia.inmos.co.uk>
to: djm@morticia.inmos.co.uk (David McKay)
organization: Bay Networks, Inc. / Billerica, MA
reply-to: psmith@wellfleet.com
newsgroups: gnu.gcc.help