-
Notifications
You must be signed in to change notification settings - Fork 182
/
Makefile
60 lines (51 loc) · 1.58 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
#
# ksm - a really simple and fast x64 hypervisor
# Copyright (C) 2016, 2017 Ahmed Samy <[email protected]>
#
# Makefile for the Linux kernel module only.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope 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
# this program; If not, see <http://www.gnu.org/licenses/>.
obj-m += ksmlinux.o
ksmlinux-objs := exit.o hotplug.o introspect.o ksm.o sandbox.o \
epage.o resubv.o vcpu.o mm.o main_linux.o vmx.o
ccflags-y := -Wno-unused-variable -Wno-declaration-after-statement -Wno-unused-function \
-DDBG -DENABLE_PRINT -std=gnu99
UM_SRC := um/um.c
UM_BIN := a.out
BIN := ksmlinux.ko
KVERSION := $(shell uname -r)
KDIR := /lib/modules/$(KVERSION)
KBUILD := $(KDIR)/build
PWD := $(shell pwd)
MAKEFLAGS += --no-print-directory
all:
@make -C $(KBUILD) M=$(PWD) modules
@$(CC) $(UM_SRC) -o $(UM_BIN)
@echo " CC $(UM_SRC)"
umk:
@$(CC) $(UM_SRC) -o $(UM_BIN)
@echo " CC $(UM_SRC)"
dri:
@make -C $(KBUILD) M=$(PWD) modules
clean:
@make -C $(KBUILD) M=$(PWD) clean
@$(RM) $(UM_BIN)
@echo " CLEAN $(UM_BIN)"
install: $(BIN)
@cp $(BIN) $(KDIR)
load:
@echo Loading $(BIN)
@insmod $(BIN)
unload:
@echo Unloading $(BIN)
@rmmod $(BIN)