From f8094a921a979d2a8d6b29b22fd5b4760f690c3e Mon Sep 17 00:00:00 2001 From: DavidingPlus Date: Thu, 17 Oct 2024 10:06:22 +0000 Subject: [PATCH] add cflags in xmake, see more on https://github.com/xmake-io/xmake/issues/2857#issuecomment-1257508104 --- README.md | 6 ++++-- src/main.c | 2 +- xmake.lua | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8e1fac8..f873be7 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,13 @@ A Simple Hello World Module. -# 两种构建方式 - TODO +# 两种构建方式 + ## 基于 Makefile ## 基于 XMake +# 更多细节 + diff --git a/src/main.c b/src/main.c index b24367d..2be2b43 100644 --- a/src/main.c +++ b/src/main.c @@ -13,7 +13,7 @@ int add(int a, int b); static int __init hello_init(void) { - printk(KERN_INFO "Hello World: %d\n", add(1, 2)); + printk(KERN_INFO "Hello World %d\n", add(1, 2)); return 0; diff --git a/xmake.lua b/xmake.lua index 6de3916..35e765b 100644 --- a/xmake.lua +++ b/xmake.lua @@ -4,3 +4,5 @@ target ("hello") add_rules ("platform.linux.driver") add_files ("src/*.c") set_values ("linux.driver.linux-headers", "$(linux-headers)") + + add_cflags ("-O1")