-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (43 loc) · 1.4 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
# Makefile - builds fiemap, faciltiates testing fiemap and stitch
#
# This file is part of extents, tools for querying and accessing file extents.
#
# Written in 2019 by Eliah Kagan <[email protected]>.
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
#
# You should have received a copy of the CC0 Public Domain Dedication along
# with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
sanitizers := -fsanitize=address,undefined
override CFLAGS += $(sanitizers) -g -std=c11 -pedantic-errors
override LDFLAGS += $(sanitizers)
ifeq ($(shell ./is-clang $(CC)),yes)
override CFLAGS += -Weverything -Wno-disabled-macro-expansion
else
override CFLAGS += -Wall -Wextra
endif
mapper := fiemap
srcs := $(wildcard *.c)
objs := $(srcs:.c=.o)
deps := $(srcs:.c=.d)
$(mapper): $(objs)
%.o: %.c
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
stitcher := stitch
test_file := test-symlink
test_log := $(mapper).out
stitched_file := $(test_file).stitched
.PHONY: test
test: $(mapper) $(stitcher) $(test_file)
./$(mapper) $(test_file) | tee $(test_log)
sudo ./$(stitcher) <$(test_log) >$(stitched_file)
cmp $(test_file) $(stitched_file)
.PHONY: check
check: test
.PHONY: clean
clean:
$(RM) $(mapper) $(objs) $(deps)
-include $(deps)