-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (40 loc) · 1.3 KB
/
Makefile
File metadata and controls
51 lines (40 loc) · 1.3 KB
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
SRC := mfs_imap_parse.c mfs_imap.c mfs_cmdqueue.c mfs_client.c \
mfs_imap_send.c mfs_dir.c mfs_file.c mfs_inode.c mfs_super.c \
mfs_mod.c
INC := mfs_imap_parse.h mfs_imap.h mfs_cmdqueue.h mfs_client.h \
mfs_imap_send.h mfs_file.h mfs_dir.h mfs_inode.h mfs_super.h
TOOLSDIR := tools
BUILDDIR := build
KBUILD := $(BUILDDIR)/fs
KOBJ := $(SRC:%.c=%.o)
ifeq ($(DEBUG), 1)
KFLAGS := -DDEBUG=1
endif
# We are called from the kernel (this makefile call the kernel's one which
# call's this one. So if KERNELRELEASE is defined we are at the second called to
# this makefile
ifneq ($(KERNELRELEASE),)
obj-m := mfs.o
mfs-y := $(KOBJ)
ccflags-y := $(KFLAGS)
# Here we are at the first call
else
KERNDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default: $(SRC) $(INC) Makefile | buildtools builddir
cp $(SRC) Makefile $(INC) $(KBUILD)/
$(MAKE) -C $(KERNDIR) M=$(PWD)/$(KBUILD) modules
rm $(SRC:%=$(KBUILD)/%) $(INC:%=$(KBUILD)/%) $(KBUILD)/Makefile
buildtools:
$(MAKE) -C $(TOOLSDIR) BUILDDIR=$(PWD)/$(BUILDDIR)
cleantools:
$(MAKE) -C $(TOOLSDIR) BUILDDIR=$(PWD)/$(BUILDDIR) clean
mrpropertools:
$(MAKE) -C $(TOOLSDIR) BUILDDIR=$(PWD)/$(BUILDDIR) clean
builddir:
mkdir -p $(KBUILD)
clean: cleantools
rm -f $(KOBJ:%=$(KBUILD)/%)
distclean: mrpropertools
rm -rf $(BUILDDIR)
endif