Dear Make experts, I stumbled upon make behavior that bothers me a lot. I was looking through Make documentation and closest description I've found was:
"Empty recipes can also be used to avoid errors for targets that will be created as a side-effect of another recipe: if the target does not exist the empty recipe ensures that make won’t complain that it doesn’t know how to build the target, and make will assume the target is out of date." Let's proceed to the actual issue: We have following targets (files) b and c. c depends on b. b is generated together with other files in target a. When using an empty recipe for b, c won't be rebuilt every time (every second time in this case). It is enough to add recipe without any command (simple tab is enough) in order to rebuild c with each run. 1st case: ##### Makefile source ##### a: touch b b: a c: b touch c ##### Output ##### $ make c touch b touch c $ make c touch b $ make c touch b touch c $ make c touch b 2nd case: ##### Makefile source ##### a: touch b b: a echo recipe c: b touch c ##### Output ##### $ make c touch b echo recipe recipe touch c $ make c touch b echo recipe recipe touch c Moreover I found this issue to be true also when using CMake: ##### CMakeLists.txt ##### project(multigen NONE) cmake_minimum_required(VERSION 2.8) add_custom_command(OUTPUT a b COMMAND touch b ) add_custom_command(OUTPUT c COMMAND touch c DEPENDS b ) add_custom_target(do_c DEPENDS c ) ##### Output ##### $ make do_c [ 50%] Generating a, b [100%] Generating c [100%] Built target do_c $ make do_c [ 50%] Generating a, b [100%] Built target do_c Software versions: GNU Make 3.81 cmake version 2.8.12.2 Best Regards, Marcin _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make