summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorzy <[email protected]>2023-11-16 13:17:49 +0800
committerzy <[email protected]>2023-11-16 13:17:49 +0800
commit8950e1280197f2d571b449be6d1b15b96656d5b6 (patch)
tree3d332a0443049c62b11132aa0ae3938ab9155578 /Makefile
Initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile36
1 files changed, 36 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..7870185
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,36 @@
+CC = gcc
+CFLAGS = -Wall
+
+PROG = helloworld
+HPTEST = hptest
+
+UDIR = $(PWD)/user
+MDIR := $(PWD)/kernel
+KDIR := $(PWD)/linux-5.17.15 # 内核源码目录
+TDIR := $(PWD)/testcase
+
+BUILD_DIR := $(PWD)/build
+OUTPUT_DIR = $(PWD)/build
+
+
+# KMOD = variable_monitor
+# obj-m := kernel/$(KMOD).o
+# $(KMOD)-objs := kernel/monitor_kernel.o
+
+all: $(PROG) $(HPTEST) module
+
+$(PROG): $(TDIR)/helloworld.c
+ $(CC) $(CFLAGS) -o $(OUTPUT_DIR)/$(PROG) $(TDIR)/helloworld.c $(UDIR)/monitor_user.c
+
+$(HPTEST): $(TDIR)/helloworld.c
+ $(CC) $(CFLAGS) -o $(OUTPUT_DIR)/$(HPTEST) $(TDIR)/hptest.c $(UDIR)/monitor_user.c
+
+module:
+ make -C $(KDIR) M=$(MDIR) modules
+
+# module:
+# make -C linux-5.17.15 M=$(PWD)/kernel modules
+
+clean:
+ rm -f $(OUTPUT_DIR)/*
+ make -C $(KDIR) M=$(MDIR) clean \ No newline at end of file