Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebuild if any of the CFLAGS changed #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ ifdef OPENMP
CFLAGS += -fopenmp
endif

# aggregation of all cflags
FLAGS = AVX_CFLAGS=$(AVX_CFLAGS)\
AVX2_CFLAGS=$(AVX2_CFLAGS)\
SSSE3_CFLAGS=$(SSSE3_CFLAGS)\
SSE41_CFLAGS=$(SSE41_CFLAGS)\
SSE42_CFLAGS=$(SSE42_CFLAGS)\
NEON32_CFLAGS=$(NEON32_CFLAGS)\
NEON64_CFLAGS=$(NEON64_CFLAGS)\
OPENMP=$(OPENMP)

# update the cache file only if FLAGS changed
FLAGS_CACHE = .flags.cache
RES := $(shell if [ ! -f $(FLAGS_CACHE) ] || [ "`cat $(FLAGS_CACHE)`" != "$(FLAGS)" ] ; then echo "$(FLAGS)" > $(FLAGS_CACHE) ; fi )

.PHONY: all analyze clean

Expand All @@ -68,7 +81,8 @@ lib/libbase64.o: $(OBJS)
$(LD) -r -o $@ $^
$(OBJCOPY) --keep-global-symbols=lib/exports.txt $@

lib/config.h:
lib/config.h: $(FLAGS_CACHE)
@echo "Generating $@"
@echo "#define HAVE_AVX2 $(HAVE_AVX2)" > $@
@echo "#define HAVE_NEON32 $(HAVE_NEON32)" >> $@
@echo "#define HAVE_NEON64 $(HAVE_NEON64)" >> $@
Expand Down