-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
65 lines (56 loc) · 2.28 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# pretty-printk::Makefile
# <https://github.com/tpiekarski/pretty-printk>
# ---
# Copyright 2020 Thomas Piekarski <[email protected]>
#
# This file is part of pretty-printk - a pretty way to print to
# the Linux Kernel Ring Buffer
#
# pretty-printk is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# pretty-printk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pretty-printk. If not, see <https://www.gnu.org/licenses/>.
#
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(SELF_DIR)/colors.mk
include $(SELF_DIR)/debug.mk
BUILD=/lib/modules/$(shell uname -r)/build
SHELL:=/bin/bash
ccflags-y := -I$(SELF_DIR) -std=gnu99 -Wall -Wno-declaration-after-statement $(DEBUG_FLAGS) $(COLORS)
pp_demo_module-objs := pretty_printk_dump.o pretty_printk_demo.o
obj-m := pp_demo_module.o
all: license clean demo
clean:
$(MAKE) -C $(BUILD) M=$(PWD) clean
demo:
$(MAKE) -C $(BUILD) M=$(PWD) modules
license:
@echo -e " pretty-printk::Makefile\n\n \
pretty-printk is free software: you can redistribute it and/or modify\n \
it under the terms of the GNU General Public License as published by\n \
the Free Software Foundation, either version 3 of the License, or\n \
(at your option) any later version.\n\n \
pretty-printk is distributed in the hope that it will be useful,\n \
but WITHOUT ANY WARRANTY; without even the implied warranty of\n \
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n \
GNU General Public License for more details.\n\n \
You should have received a copy of the GNU General Public License\n \
along with pretty-printk. If not, see <https://www.gnu.org/licenses/>.\n"
test:
$(eval module=pp_demo_module)
$(MAKE) license demo colors=$(colors) debug=$(debug)
@sudo dmesg -C
@sudo insmod $(module).ko
@sudo dmesg
@sudo rmmod $(module)
$(MAKE) clean
@echo ">> Test target with debug=$(debug) has run successfully."