Skip to content

Commit 34ee650

Browse files
committed
fix(examples): generate more portable Makefiles
The change should resolve our intermittent CI issues caused by absence of .PHONY in NMAKE.
1 parent 8cf2777 commit 34ee650

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

examples/auto/rust

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,24 @@ ngx_rust_make_module () {
308308
ngx_rustc_module_opt="--example $ngx_rust_target_name"
309309
fi
310310

311-
cat << END >> $NGX_MAKEFILE
311+
if [ -z "$ngx_rust_phony_emitted" ]; then
312+
ngx_rust_phony_emitted=1
313+
314+
# Make cannot track the Rust module source and dependency changes,
315+
# so we defer the task to cargo and invoke it unconditionally.
316+
#
317+
# We have to use the pseudotarget instead of .PHONY for better
318+
# compatibility with various Make implementations.
319+
cat <<END >> $NGX_MAKEFILE
312320
313-
# always run cargo instead of trying to track the source modifications
314-
.PHONY: $ngx_rust_obj
321+
.NGX_RUST_PHONY: ;
322+
323+
END
324+
fi
325+
326+
cat << END >> $NGX_MAKEFILE
315327
316-
$ngx_rust_obj:
328+
$ngx_rust_obj: .NGX_RUST_PHONY
317329
$NGX_CARGO rustc \\
318330
--config $ngx_cargo_config \\
319331
--crate-type staticlib \\

0 commit comments

Comments
 (0)