I run a buildroot make and during this build process a text file is created. After this happens another make as part of the build is run. I want to read the contents of the generated file into a variable and use them. This doesn't work as at the start of my buildroot make it sees the file as not existing, so even though it is generated before the code is run make has already decided it doesn't exist.
Format of the file read:
str1 str2 1.1.0_nightlybuild (1389:1497M@trunk)
I am trying to use eval (this should check the file contents at the time of running). However the problem persists, I do not seem to be able to read from the file after it is created. It seems make might be expanding the variable and so eval does not work.
None of the variables are being set from the file contents. I check and the file has been generated correctly so if I run the make again, when the file has already been generated, everything works fine. Is eval not the correct way to do this?
So the file does not exist at the start of make, comes into existence and then this code is run:
define EXAMPLE $(eval s := $(shell cat output/target/version.txt)) $(eval FILENAME_BIN=$(word 1, $(s)).$(word 2, $(s)).$(word 3, $(s)).bin) $(eval FILENAME_JFFS2=$(word 1, $(s)).$(word 2, $(s)).$(word 3, $(s)).jffs2) mv $(BINARIES_DIR)/$(BOOTIMAGE) $(BINARIES_DIR)/$(FILENAME_BIN) mv $(BINARIES_DIR)/$(JFFS2IMAGE) $(BINARIES_DIR)/$(FILENAME_JFFS2) endef
It does not work, the file is generated and subsequent builds will work, just not the first one where the file does not exist at the start of the process. The first time the files are simply called
...jffs2 as the variables read from the file are not populated. When it works the files are called
Here is the real use case makefile http://pastebin.com/6GdKcUg6 TEST_DEFAULT_RENAME is where I am trying to read in a file, I am using buildroot (so a lot of make files), when I hit make during the buildroot process version.txt is created along the way, this code then tries to read this file but it does not work unless version.text is there before I enter the make in the buildroot directory. As you can see I use version.txt elsewhere via cat but that works fine.