Skip to content

Commit 4844d2f

Browse files
authored
Merge pull request #155 from lucab/to-upstream/make-opttarget
makefile: optional explicit target for optimizations
2 parents f87df8a + c57a95f commit 4844d2f

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)