summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 24 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 2815b94..7870185 100644
--- a/Makefile
+++ b/Makefile
@@ -1,23 +1,36 @@
CC = gcc
CFLAGS = -Wall
+
PROG = helloworld
HPTEST = hptest
-KMOD = variable_monitor
-obj-m := $(KMOD).o
-$(KMOD)-objs := monitor_kernel.o
+
+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): helloworld.c
- $(CC) $(CFLAGS) -o $(PROG) helloworld.c monitor_user.c
+$(PROG): $(TDIR)/helloworld.c
+ $(CC) $(CFLAGS) -o $(OUTPUT_DIR)/$(PROG) $(TDIR)/helloworld.c $(UDIR)/monitor_user.c
-$(HPTEST): hptest.c
- $(CC) $(CFLAGS) -o $(HPTEST) hptest.c monitor_user.c
+$(HPTEST): $(TDIR)/helloworld.c
+ $(CC) $(CFLAGS) -o $(OUTPUT_DIR)/$(HPTEST) $(TDIR)/hptest.c $(UDIR)/monitor_user.c
module:
- make -C linux-5.17.15 M=$(PWD) modules
+ make -C $(KDIR) M=$(MDIR) modules
+
+# module:
+# make -C linux-5.17.15 M=$(PWD)/kernel modules
clean:
- rm -f $(PROG)
- rm -f $(HPTEST)
- make -C linux-5.17.15 M=$(PWD) clean \ No newline at end of file
+ rm -f $(OUTPUT_DIR)/*
+ make -C $(KDIR) M=$(MDIR) clean \ No newline at end of file