forked from sysprog21/simplefs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (28 loc) · 859 Bytes
/
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
obj-m += simplefs.o
simplefs-objs := fs.o super.o inode.o file.o dir.o extent.o
KDIR ?= /lib/modules/$(shell uname -r)/build
MKFS = mkfs.simplefs
all: $(MKFS)
make -C $(KDIR) M=$(PWD) modules
IMAGE ?= test.img
IMAGESIZE ?= 200
JOURNAL ?= journal.img
JOURNALSIZE ?= 8
# To test max files(40920) in directory, the image size should be at least 159.85 MiB
# 40920 * 4096(block size) ~= 159.85 MiB
$(MKFS): mkfs.c
$(CC) -std=gnu99 -Wall -o $@ $<
$(IMAGE): $(MKFS)
dd if=/dev/zero of=${IMAGE} bs=1M count=${IMAGESIZE}
./$< $(IMAGE)
journal: $(JOURNAL)
$(JOURNAL):
dd if=/dev/zero of=$(JOURNAL) bs=1M count=$(JOURNALSIZE)
mke2fs -b 4096 -O journal_dev $(JOURNAL)
check: all
script/test.sh $(IMAGE) $(IMAGESIZE) $(MKFS)
clean:
make -C $(KDIR) M=$(PWD) clean
rm -f *~ $(PWD)/*.ur-safe
rm -f $(MKFS) $(IMAGE) $(JOURNAL)
.PHONY: all clean journal