blob: 76025f67040f5196db33abd7c407b877c2b721b3 (
plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
CFLAGS += -Wall -Wextra -pedantic -march=native -mtune=native -MMD
all: pipapo pipapo.debug pipapo.show pipapo.mem pipapo.noavx2 pipapo.nosimd pipapo.check
SRCS := $(shell find . ! -type l -name "*.c")
OBJS := $(SRCS:.c=.o)
OBJS_DEBUG := $(SRCS:.c=.debug.o)
OBJS_SHOW := $(SRCS:.c=.show.o)
OBJS_MEM := $(SRCS:.c=.mem.o)
OBJS_NOAVX2 := $(SRCS:.c=.noavx2.o)
OBJS_NOSIMD := $(SRCS:.c=.nosimd.o)
OBJS_CHECK := $(SRCS:.c=.check.o)
DEPS := $(OBJS:.o=.d) $(OBJS_DEBUG:.o=.d) $(OBJS_SHOW:.o=.d) $(OBJS_MEM:.o=.d) $(OBJS_NOAVX2:.o=.d) $(OBJS_NOSIMD:.o=.d) $(OBJS_CHECK:.o=.d)
$(OBJS): CFLAGS += -Ofast -funroll-loops -D__MATCH_AVX2 -D__MATCH_CTZL
$(OBJS_DEBUG): CFLAGS += -O0 -g -D__MATCH_AVX2 -D__MATCH_CTZL
$(OBJS_SHOW): CFLAGS += -DVERBOSE
$(OBJS_MEM): CFLAGS += -DVERBOSE -D__MATCH_AVX2 -D__MATCH_CTZL
$(OBJS_NOAVX2): CFLAGS += -Ofast -funroll-loops -DMATCH_UNROLLED -D__MATCH_CTZL
$(OBJS_NOSIMD): CFLAGS += -Ofast -funroll-loops -DMATCH_UNROLLED
$(OBJS_CHECK): CFLAGS += -DVERBOSE -Ofast -funroll-loops -DMATCH_UNROLLED
pipapo: $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o pipapo
pipapo.debug: $(OBJS_DEBUG)
$(CC) $(CFLAGS) $(OBJS_DEBUG) -o pipapo.debug
pipapo.show: $(OBJS_SHOW)
$(CC) $(CFLAGS) $(OBJS_SHOW) -o pipapo.show
pipapo.mem: $(OBJS_MEM)
$(CC) $(CFLAGS) $(OBJS_MEM) -o pipapo.mem
pipapo.noavx2: $(OBJS_NOAVX2)
$(CC) $(CFLAGS) $(OBJS_NOAVX2) -o pipapo.noavx2
pipapo.nosimd: $(OBJS_NOSIMD)
$(CC) $(CFLAGS) $(OBJS_NOSIMD) -o pipapo.nosimd
pipapo.check: $(OBJS_CHECK)
$(CC) $(CFLAGS) $(OBJS_CHECK) -o pipapo.check
%.debug.c: %.c
ln -s $< $@
%.show.c: %.c
ln -s $< $@
%.mem.c: %.c
ln -s $< $@
%.noavx2.c: %.c
ln -s $< $@
%.nosimd.c: %.c
ln -s $< $@
%.check.c: %.c
ln -s $< $@
%.o: %.c Makefile
$(CC) $(CFLAGS) -MMD -c -o $@ $<
LINKS := $(shell find . -type l -name "*.c")
.SECONDARY:
.PHONY: clean tests
clean:
-${RM} pipapo pipapo.debug pipapo.show pipapo.mem pipapo.noavx2 pipapo.nosimd $(OBJS) $(OBJS_DEBUG) $(OBJS_SHOW) $(OBJS_MEM) $(OBJS_NOAVX2) $(OBJS_NOSIMD) $(OBJS_CHECK) $(DEPS) $(LINKS)
-${RM} -r tests/plots
tests: all
cd tests; ./run.sh
display tests/plots/*.png
-include $(DEPS)
|