How can I force a file to be created using Cons, if nobody depends on it?

StackOverflow https://stackoverflow.com/questions/487059

  •  20-08-2019
  •  | 
  •  

Question

The project I'm using uses Cons instead of Make for one section, for reasons beyond my control (i.e. we inherited and there was never enough ROI to switch to Make).

I just added a new rule to create a file that I need in an unrelated part of the project. By "unrelated" I mean that it's outside the scope of my Cons script. The project build assumes that the part that uses Cons is 100% done before the part that needs the new file.

Because of this, there is no target in Cons that requires the new file, so Cons doesn't build it. How can I tell Cons to build it regardless?

Was it helpful?

Solution

This can be done using the Depends method:

$CONS->Depends("target", "file_i_want_to_create");

This makes target dependent on file_i_want_to_create. If target is something that will definitely be built (such as the actual project that we want to build with CONS ) then file_i_want_to_create will definitely be created.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top