URL:
  <https://savannah.gnu.org/bugs/?62228>

                 Summary: prerequisite based on input file created during
processing not created, but no error
                 Project: make
            Submitted by: minshall
            Submitted on: Tue 29 Mar 2022 04:38:56 AM UTC
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 4.3
        Operating System: POSIX-Based
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

hi.  sorry.  i'm not sure if this is a bug.

in the makefile below, the initial condition should be that ./outputs is
empty, but ./inputs includes a file ./inputs/a.input.  the main goal causes
./inputs/b.input to be created.  a pattern rule should convert
./inputs/%.input to ./outputs/%.output.  and, the sub-goal `processoutputs`
has as prerequisites `${OUTFILES}`, created by text-munging of the files
(then) in ./inputs.  so, when this goal is executed, that includes
./outputs/b.output.  but, ./outputs/b.output is *not* created (which seems
consistent with verbiage in the info pages), *and*, no error is generated
saying "no rule to make ./outputs/b.output..." (or, words to that effect).

the fact that `${OUTFILES}`, when the `diff` command is invoked, includes
./outputs/b.output makes me wonder if there is a bug here?

(but, i'm guessing that dependencies are built when the makefile is read, then
not updated?)

cheers.


INDIR = ./inputs
OUTDIR = ./outputs

INFILES = $(notdir $(shell ls ${INDIR}/*.input))
INFILESASOUT = $(INFILES:.input=.output)
OUTFILES = $(addprefix ${OUTDIR}/,$(notdir ${INFILESASOUT}))
NEWIN = ${INDIR}/b.input
NEWOUT = ${OUTDIR}/b.output

${OUTDIR}/%.output: ${INDIR}/%.input
        echo creating $(notdir $@)
        cp -p $< $@

.PHONY: all setup processoutputs something clean

all: setup something processoutputs

setup:
        @for dir in ${OUTDIR} ${INDIR}; do \
                if [ ! -e $${dir} ]; then mkdir $${dir}; fi \
        done
        @if [[ -f ${NEWIN} ]]; then \
                echo error: "${NEWIN} exists -- run \`make clean\`"; \
                exit 1; \
        fi

# this wants, as dependency,
processoutputs: ${OUTFILES}
        @diff <(for i in ${OUTFILES}; do echo $$i; done) <(ls ${OUTDIR}/*)

something:
        @touch ${NEWIN}

clean:
        @-rm -f ${OUTFILES}
        @-rm -f ${NEWIN}







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62228>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply via email to