Skip to content

Commit c57a95f

Browse files
committed
makefile: optional explicit target for optimizations
This commit allows passing an explicit OPTTARGET as the target architecture for checking optimization capabilities. This is needed for reataining compatibility to a baseline when ditributing binaries. For reference: https://bugs.debian.org/828779
1 parent f87df8a commit c57a95f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Makefile

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ CFLAGS += -std=c89 -pthread -O3 -Wall -g -Iinclude -Isrc
2323
CI_CFLAGS := $(CFLAGS) -Werror=declaration-after-statement -D_FORTIFY_SOURCE=2 \
2424
-Wextra -Wno-type-limits -Werror -coverage -DTEST_LARGE_RAM
2525

26-
OPTTEST := $(shell $(CC) -Iinclude -Isrc -march=native src/opt.c -c \
26+
OPTTARGET ?= native
27+
OPTTEST := $(shell $(CC) -Iinclude -Isrc -march=$(OPTTARGET) src/opt.c -c \
2728
-o /dev/null 2>/dev/null; echo $$?)
2829
# Detect compatible platform
2930
ifneq ($(OPTTEST), 0)
31+
$(info Building without optimizations)
3032
SRC += src/ref.c
3133
else
32-
CFLAGS += -march=native
34+
$(info Building with optimizations for $(OPTTARGET))
35+
CFLAGS += -march=$(OPTTARGET)
3336
SRC += src/opt.c
3437
endif
3538

0 commit comments

Comments
 (0)