diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2019-11-19 00:18:17 (GMT) |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2019-11-19 00:18:17 (GMT) |
commit | a724e8dbd67ce3d9bf5a24bd836dea4ad3a5516f (patch) | |
tree | 8575f185b5f2e773a7334ffe1dd5891a70bb2151 /Makefile |
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..76025f6 --- /dev/null +++ b/Makefile @@ -0,0 +1,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) |