bug-make
[Top][All Lists]
Advanced

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

[bug #62228] prerequisite based on input file created during processing


From: Paul D. Smith
Subject: [bug #62228] prerequisite based on input file created during processing not created, but no error
Date: Sat, 23 Apr 2022 17:29:54 -0400 (EDT)

Update of bug #62228 (project make):

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

    _______________________________________________________

Follow-up Comment #1:

Make always parses all non-recipe lines when the makefile is read, before it
runs any recipes.  It finishes parsing all the makefiles (which includes
expanding all variables that are targets or prerequisites) during the read-on
phase.

See the GNU make manual for exact details:
https://www.gnu.org/software/make/manual/html_node/Reading-Makefiles.html

You can't have a makefile where the recipe of one rule creates a file and
another rule uses wildcards or shell commands to list all the files to
generate prerequisites because when the function or variable is expanded to
list the prerequisites, the rule to create them hasn't been run yet.  In your
makefile:


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


When make parses the makefile, before it runs any rules, it will expand
*OUTFILES* which will cause *INFILES* to be expanded, which will search for
*.input* files.  But the *something* rule has not been run yet, so
*./inputs/b.input* doesn't exist, so the contents of *INFILES* won't see it,
so it won't be in *OUTFILES* either.

Basically you can't rely on wildcards to find files that are created during
the build, because at the time that these wildcards are expanded the build has
not been run so the created files won't be found.

If you need help please email either help-make@gnu.org or bug-make@gnu.org. 
You'll need to provide a more exact description of precisely what you want to
accomplish however.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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