Skip to content

Commit 1fc1550

Browse files
committed
Refactor .PHONY target handling in Makefile generation to ensure no newlines are present in target strings.
1 parent f46c1d6 commit 1fc1550

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,8 +905,9 @@ help:
905905
(match test_file_generated with
906906
| Some _ -> Printf.sprintf "# Test target (compile tests only)\ntest: %s.test.c\n\t$(CC) $(CFLAGS) -o %s_test %s.test.c $(LIBS)\n\n# Run test target (compile and run tests)\nrun-test: test\n\t./%s_test" base_name base_name base_name base_name
907907
| None -> "")
908-
(* Test target in .PHONY and kfunc targets *)
909-
(match test_file_generated with Some _ -> " test run-test" | None -> "") ^ (if has_kfuncs then " load-kmod unload-kmod clean-kmod check-kmod" else "") in
908+
(* .PHONY targets - ensure no newlines by cleaning the string *)
909+
(let phony_targets = (match test_file_generated with Some _ -> " test run-test" | None -> "") ^ (if has_kfuncs then " load-kmod unload-kmod clean-kmod check-kmod" else "") in
910+
String.map (function '\n' -> ' ' | c -> c) phony_targets) in
910911

911912
let makefile_path = output_dir ^ "/Makefile" in
912913
let oc = open_out makefile_path in

0 commit comments

Comments
 (0)