help-make
[Top][All Lists]
Advanced

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

Deferring variable assignment until after target is run?


From: bosawt
Subject: Deferring variable assignment until after target is run?
Date: Thu, 15 Dec 2011 16:37:27 -0800 (PST)

Hey,

I'm working on a makefile for a single component in an extremely large
project (dozens of large components).  In the makefile, I assign the entire
contents of an automatically generated folder to a variable, and this folder
and the contents are generated within a target defined in my makefile.  Near
the end of my makefile, I include a 'master' makefile for the entire
project, and this overarching file uses the assigned variable.  I'm sure
this description is confusing, so here is some pseudocode:

VARIABLE = $(generated_directory)/dependency_file
VARIABLE += $(generated_directory)/*

# create_binaries_for_variable is a command that creates binary files for
VARIABLE to save the path to.
# It also creates a dependency_file that is used to know when to run the
target.
$(generated_directory)/dependency_file : $(RM) -r $(generated_directory)
        $(MKDIR) $(generated_directory) 
        create_binaries_for_variable

# This makefile is the overarching 'master' Makefile, which uses the
binaries created by the c
# create_binaries_for_variable command.
-include Makefile

Now, this implementation works fine when building for the first time.  The
problem, however, is that the 'create_binaries_for_variable' command doesn't
necessarily create the same number of binary files, so we don't know in
advance which binary paths to attach to VARIABLE, before running that
command.  I've found that when I build the project, update the behavior of
'create_binaries_for_variable', and then try building again, VARIABLE
includes the binaries from the first build of the project, and not any
additional binaries from the second build.  

So, my question for this longwinded explanation is, is there a way that
every time I build, I can run the target, and execute
'create_binaries_for_variable', and after that attach the paths of the
created files to VARIABLE?  Since this project is so large, I am not able to
change the way that the included 'master' makefile works, or change the
rules of how VARIABLE works (it must include paths to all created binaries,
not just a path to the directory or something similar)
-- 
View this message in context: 
http://old.nabble.com/Deferring-variable-assignment-until-after-target-is-run--tp32983436p32983436.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.




reply via email to

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