-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
61 lines (44 loc) · 1.43 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
.POSIX:
.SUFFIXES:
export prefix = /usr/local
CC = cc
CFLAGS = -std=c99 \
-Wall -Wextra -Wpedantic -Wstrict-prototypes -Wmissing-prototypes \
-Wfloat-equal -Wshadow -Wswitch-default -Wswitch-enum \
-Wconversion -Wsign-compare -Wpointer-arith -Wcast-qual \
-Wmissing-field-initializers -Wredundant-decls \
-Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-signedness \
-Wuninitialized -Wundef -Wcast-align \
-Wc++-compat -Wstrict-aliasing=1 -Wvla -Winit-self -Wwrite-strings \
-O3 -march=native -ffast-math -s
.PHONY: default all mockobjs check test coverage clean install uninstall
MOCKS := fclose fputc fwrite malloc
BINARY := seq-tools
default: $(BINARY)
all: default
$(BINARY): src/seq-tools.c
$(CC) $(CFLAGS) -o $@ $<
mockobjs: $(addsuffix .so, $(addprefix so/, $(MOCKS)))
so/%.so: src/mocks/%.c | so
$(CC) $(CFLAGS) -fPIC -shared -o $@ $<
so:
@mkdir -p so
check: test
test: $(BINARY) mockobjs
@$(MAKE) -C tests
# Coverage does not actually depend on normally built binary,
# but still it should be tested only after normal built succeeds.
coverage: $(BINARY) mockobjs
@$(MAKE) -C coverage
clean:
@rm -f seq-tools
@rm -f so/*
@rm -df so
@$(MAKE) -C tests clean
@$(MAKE) -C coverage clean
@echo "All clean!"
install: $(BINARY)
@mkdir -p $(DESTDIR)$(prefix)/bin
cp -f $(BINARY) $(DESTDIR)$(prefix)/bin
uninstall:
rm -f $(DESTDIR)$(prefix)/bin/$(BINARY)