~lattis/muon

354d545b7e62d2e15c1a4a8be844967b8962d920 — Stone Tickle 2 months ago d12bb29
add link_with to link_args before joining
1 files changed, 8 insertions(+), 9 deletions(-)

M src/backend/ninja/build_target.c
M src/backend/ninja/build_target.c => src/backend/ninja/build_target.c +8 -9
@@ 308,6 308,14 @@ ninja_write_build_tgt(struct workspace *wk, const struct project *proj, obj tgt_
	}

	obj implicit_deps = 0;
	if (get_obj(wk, ctx.args.link_with)->dat.arr.len && tgt->dat.tgt.type == tgt_executable) {
		obj link_with;
		obj_array_dedup(wk, ctx.args.link_with, &link_with);

		implicit_deps = wk_strcat(wk, make_str(wk, " | "), join_args_ninja(wk, link_with));

		push_linker_args_link_with(wk, linker, ctx.args.link_args, link_with);
	}

	const char *linker_type, *link_args;
	switch (tgt->dat.tgt.type) {


@@ 324,15 332,6 @@ ninja_write_build_tgt(struct workspace *wk, const struct project *proj, obj tgt_
		return false;
	}

	if (get_obj(wk, ctx.args.link_with)->dat.arr.len && tgt->dat.tgt.type == tgt_executable) {
		obj link_with;
		obj_array_dedup(wk, ctx.args.link_with, &link_with);

		implicit_deps = wk_strcat(wk, make_str(wk, " | "), join_args_ninja(wk, link_with));

		push_linker_args_link_with(wk, linker, ctx.args.link_args, link_with);
	}

	fputs("build ", out);
	write_escaped(out, build_path);
	fprintf(out, ": %s_LINKER ", linker_type);