bug-make
[Top][All Lists]
Advanced

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

Re: [bug #62228] prerequisite based on input file created during process


From: Greg Minshall
Subject: Re: [bug #62228] prerequisite based on input file created during processing not created, but no error
Date: Wed, 30 Mar 2022 10:24:21 -0700

Eddy,

thanks again.  yes, one should re-read manuals.  and, remember what one
reads!

> I confess I don't see how a sub-make would really help there.  I
> generally do my git changes separately from invoking make - and, even
> then, incremental builds sometimes require (at least) a purge of
> generated dependency files, to force their recreation, since
> interdependencies can all too easily have changed - indeed, whole
> subdirectories may have been renamed, which is way outside what I would
> expect make to cope with.  Perhaps others on this list have guidance on
> that.

see the makefile-prime below.  the "all:" target is as before.  the
"allx:" target runs a sub-make when creating a new input file (outside
of make's knowledge).  that sub-make creates the required "output"
files.  then, the "main" make continues to run, to a (presumably)
successful conclusion.  this works for *my* app.  (though,
aesthetically, whether to run the sub-make in "something:" or in
"processoutputs:" isn't clear; sort of i prefer the latter.)

cheers, Greg
----
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

allx: setup something1 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}/*)

outfiles: ${OUTFILES}

something:
        @touch ${NEWIN}

something1:
        @touch ${NEWIN}
        make --no-print-directory outfiles

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



reply via email to

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