Compile Time Variables make life easier.
We can define a variable in our Rules.MK File and reference that anywhere in our project.
My Power System runs IBM i V7R5M0 but I want to create my code using V7R4M0.
I can easily define this in my rules.mk files like this:
As far as I can tell, this only work for MODULES and PROGRAMS at this time. But since Code for IBM i is constantly developing watch for new features.
Here is an example of a real rules.mk which is building 3 modules, then bound into 1 ILE program plus a related command:
UPDATE APRIL 2025 COMING SOON - NOTE this feature using variables is not available yet. But it has been requested from the team of Code for IBM i Developers and apparently its being worked on. Fingers crossed!!!
Simply edit your Rules.mk file in your project root folder to define the value as a variable. This new feature let me easily my global target compile release to *PRV using a global variable.
Root Rules.MK
Here is an example where I am adding the TGTRLS parameter as a variable called PROJECT_TGTRLS

Now this is defined we can reference this variable anywhere else in our project workspace.
This example I am using the variable PROJECT_TGTRLS to set the TGTRLS to *PRV for this module:
And I could then use the same technique for the *SRVPGM like this:

