bug-make
[Top][All Lists]
Advanced

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

[bug #43757] Target-specific assigments influencing whether target consi


From: Kaz Kylheku
Subject: [bug #43757] Target-specific assigments influencing whether target considered intermediate.
Date: Fri, 05 Dec 2014 01:20:15 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:33.0) Gecko/20100101 Firefox/33.0

URL:
  <http://savannah.gnu.org/bugs/?43757>

                 Summary: Target-specific assigments influencing whether
target considered intermediate.
                 Project: make
            Submitted by: kkylheku
            Submitted on: Thu 04 Dec 2014 05:20:14 PM PST
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 3.81
        Operating System: POSIX-Based
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

Background:

I have a Makefile in which tests are executed by running a "make tests"
target.

The test rules work with files having several suffixes: .ok, .out, .expected
and .txr

The foo.ok file is a timestamp, which is updated by a rule that only succeeds
if "foo.out" matches "foo.expected".

%.ok depends on %.out, and %.out depends on %.txr: a foo.txr script is run
with some arguments to produce foo.out.

Now some of the %.out targets have target specific assignments to set up some
command line arguments and whatnot for the test.

STRANGE BEHAVIOR: it seems that those %.out targets which do not have
target-specific assignments are not considered to be intermediate files.  They
are not deleted.  Those %.out targets which have no target-specific
assignments are deleted.

Example run:

    # this .out file has a target-specific assignment
    $ rm tests/009/json.out
    $ make tests/009/json.ok
    mkdir -p tests/009/
    ./txr --gc-debug  tests/009/json.txr /home/kaz/txr/tests /009/webapp.json
/home/kaz/txr/tests/009/pass1.json > tests/009/json.out
    diff -u tests/009/json.expected tests/009/json.out

Notice there is no removal of the intermediate .out file here! If I remove the
target-specific assignment then the behavior is different:

    $ make tests/009/json.ok
    mkdir -p tests/009/
    ./txr --gc-debug  tests/009/json.txr  > tests/009/json.out
    diff -u tests/009/json.expected tests/009/json.out
    rm tests/009/json.out

Note the rm command at the end, issued by GNU Make.

Now for the following different .out file, there is a target-specific
assignment, but of a slightly different form.

    $ make tests/011/txr-case.ok
    mkdir -p tests/011/
    ./txr   tests/011/txr-case.txr  > tests/011/txr-case.out
    diff -u tests/011/txr-case.expected tests/011/txr-case.out
    rm tests/011/txr-case.out

Note the "rm" command here, eliminating the intermediate file.

In the non-removal case (tests/009/json.out) even interrupting make does not
ensure that the .out file is gone.

The target specific assignments are:

    tests/009/json.out: TXR_ARGS := $(addprefix
$(top_srcdir)/tests/009/,webapp.json pass1.json)

    tests/011/%: TXR_DBG_OPTS :=

One is a concrete, one is a pattern.

The relevant rules are just:

    %.out: %.txr
           mkdir -p $(dir $@)
           $(if $(TXR_SCRIPT_ON_CMDLINE),\
             $(TXR) $(TXR_DBG_OPTS) $(TXR_OPTS) -c "$$(cat $<)" \
               $(TXR_ARGS) > $@,\
             $(TXR) $(TXR_DBG_OPTS) $(TXR_OPTS) $< $(TXR_ARGS) > $@)

    %.ok: %.out
           diff -u $(<:.out=.expected) $<
           @touch $@

    %.expected: %.out
           cp $< $@


Am I running into a documented behavior?




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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