bug-make
[Top][All Lists]
Advanced

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

[bug #36800] False misidentification of '%' as "mixed" target in a singl


From: Paul D. Smith
Subject: [bug #36800] False misidentification of '%' as "mixed" target in a single target specififcation
Date: Fri, 06 Jul 2012 17:14:41 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11

Update of bug #36800 (project make):

                  Status:                    None => Not A Bug              
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

Hi Serguei; this is a problem with your makefile, and has nothing to do with
GNU make.

The problem is that you think make is going to expand backquotes.  Backquotes
are a _shell_ feature, and make doesn't do anything special with backquotes.

As a result, the target your makefile has told make will be built by this rule
is actually the literal string "myapp-bundle-0.3.1-devel-`date
+%Y%m%d`.tar.gz"

Now, when that value appears in the command script of the rule, the shell sees
it and expands it properly, but make does not.

If you want to have the results of a shell command used in a make variable
then there is only one way to do it: with the $(shell ...) function. 
Something like this:


    ...
DATESTAMP := $(shell date +%Y%m%d)
VERSION    = 0.3.1-devel-$(DATESTAMP)
DATAEXE    = myapp
    ...
$(DATAEXE)-bundle-$(VERSION).tar.gz: all #...
    ...


This is better anyway, because if you do a build just around midnight, then
it's possible different invocations of the date command could return different
values.  Better to ensure that all rules and targets use the same value,
computed only one time.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?36800>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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