Paul C. Anagnostopoulos via llvm-dev
2020-Aug-12 12:47 UTC
[llvm-dev] Ninja behavior that befuddles me
I'm a total newbie as far as CMake and Ninja are concerned. How do I force Ninja to build the target .inc files? I'm working on TableGen, so my changes to the executable may indeed change the output files. I want to be sure they did not, in fact, change. Should I just touch all the .td files? At 8/11/2020 12:01 PM, Michael Kruse wrote:>Before replacing a file, tblgen checks whether its content is identical. This keeps the time stamps from being updated without any change being made. > >The command in add_custom_command is not made a file dependency. The idea is that the command's input file determines the output file's content, not the algorithm that does it. > >See <https://cmake.org/cmake/help/latest/command/add_custom_command.html#command:add_custom_command>https://cmake.org/cmake/help/latest/command/add_custom_command.html#command:add_custom_command > >> Whenever a target is used as a command to execute or is mentioned in a generator expression as a command argument, a target-level dependency will be added automatically so that the mentioned target will be built before any target using this custom command. However this does NOT add a file-level dependency that would cause the custom command to re-run whenever the executable is recompiled. List target names with the DEPENDS option to add such file-level dependencies. > >Michael > >Am Di., 11. Aug. 2020 um 10:39 Uhr schrieb Paul C. Anagnostopoulos via llvm-dev <<mailto:llvm-dev at lists.llvm.org>llvm-dev at lists.llvm.org>: >This morning I did a build with Ninja, which mysteriously decided to rebuild the entire system (something about a deps stamp being corrupted). When it was done, I had a new llvm-tblgen.exe, but all the target .inc files were old. Hmm. So I touched one of the TableGen source files and did another build. Again, a new llvm-tblgen.exe but no new .inc files. I do, however, have a new .inc.d file corresponding to each .inc file. > >I notice that those .inc.d files do not list llvm-tblgen.exe as a dependency. Is that why the .inc files aren't rebuilt? If so, what is the trick?
Robinson, Paul via llvm-dev
2020-Aug-12 13:15 UTC
[llvm-dev] Ninja behavior that befuddles me
> -----Original Message----- > From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Paul C. > Anagnostopoulos via llvm-dev > Sent: Wednesday, August 12, 2020 8:48 AM > To: Michael Kruse <llvmdev at meinersbur.de> > Cc: llvm-dev <llvm-dev at lists.llvm.org> > Subject: Re: [llvm-dev] Ninja behavior that befuddles me > > I'm a total newbie as far as CMake and Ninja are concerned. How do I force > Ninja to build the target .inc files? I'm working on TableGen, so my > changes to the executable may indeed change the output files. I want to be > sure they did not, in fact, change. > > Should I just touch all the .td files?That's the traditional method for forcing something to rebuild. Note the .td rules actually create the new .inc file "on the side" and only overwrite the target .inc file itself if the new file does not compare equal, so you could look at the .inc timestamps after the build to determine whether any have been updated. If you're especially worried, you could rename all the .inc files in the build tree, which will cause all new .inc files to be created using your modified tablegen; then you can do your own diffs and verify no changes in the generated files. This method will of course cause everything that depends on the .inc files to be rebuilt, so the test build will take much longer, but it would provide that little extra warm-fuzzy feeling. --paulr
Paul C. Anagnostopoulos via llvm-dev
2020-Aug-12 13:34 UTC
[llvm-dev] Ninja behavior that befuddles me
Hmm. Someone suggested that I rebuild them all and do a diff just precisely to obtain the warm and fuzzies. Since I've copied the original .inc files, it's probably easiest to delete all the built .inc files. That will force a complete rebuild of them. At 8/12/2020 09:15 AM, Robinson, Paul wrote:>> -----Original Message----- >> From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Paul C. >> Anagnostopoulos via llvm-dev >> Sent: Wednesday, August 12, 2020 8:48 AM >> To: Michael Kruse <llvmdev at meinersbur.de> >> Cc: llvm-dev <llvm-dev at lists.llvm.org> >> Subject: Re: [llvm-dev] Ninja behavior that befuddles me >> >> I'm a total newbie as far as CMake and Ninja are concerned. How do I force >> Ninja to build the target .inc files? I'm working on TableGen, so my >> changes to the executable may indeed change the output files. I want to be >> sure they did not, in fact, change. >> >> Should I just touch all the .td files? > >That's the traditional method for forcing something to rebuild. >Note the .td rules actually create the new .inc file "on the side" >and only overwrite the target .inc file itself if the new file >does not compare equal, so you could look at the .inc timestamps >after the build to determine whether any have been updated. > >If you're especially worried, you could rename all the .inc files >in the build tree, which will cause all new .inc files to be >created using your modified tablegen; then you can do your own >diffs and verify no changes in the generated files. >This method will of course cause everything that depends on the >.inc files to be rebuilt, so the test build will take much longer, >but it would provide that little extra warm-fuzzy feeling. >--paulr