Let's say I have a makefile such as the following:
1 2
|
my_program.exe : source.cpp other_dependency.cpp
g++ source.cpp other_dependency.cpp -o my_program
| |
(command simplified for brevity)
If I type "make my_program", it will NOT use the my_program.exe target because the target name includes the .exe, which I did not type.
Okay then, the solution is to rename the target:
1 2
|
my_program : source.cpp other_dependency.cpp
g++ source.cpp other_dependency.cpp -o my_program
| |
Now I can type "make my_program" and everything works. Except, the new issue is that because the target is not the name of a file, it will never say "make: 'my_program' is up to date." even though I didn't modify a dependency.
That brings me to my question: How can I get make to still only rebuild when necessary, but use target names that aren't necessarily the name of a file. Do I have to use dummy files that get deleted and re-written to? This seems awfully inconvenient, so I'm sure there has to be better way.
PS: This would also apply to targets that I want to be "groups", e.g. make all_debug which will only run if the debug exe's are out of date, for instance.