Skip to content

Commit

Permalink
Merge pull request #155 from lucab/to-upstream/make-opttarget
Browse files Browse the repository at this point in the history
makefile: optional explicit target for optimizations
  • Loading branch information
veorq committed Aug 21, 2016
2 parents f87df8a + c57a95f commit 4844d2f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ CFLAGS += -std=c89 -pthread -O3 -Wall -g -Iinclude -Isrc
CI_CFLAGS := $(CFLAGS) -Werror=declaration-after-statement -D_FORTIFY_SOURCE=2 \
-Wextra -Wno-type-limits -Werror -coverage -DTEST_LARGE_RAM

OPTTEST := $(shell $(CC) -Iinclude -Isrc -march=native src/opt.c -c \
OPTTARGET ?= native
OPTTEST := $(shell $(CC) -Iinclude -Isrc -march=$(OPTTARGET) src/opt.c -c \
-o /dev/null 2>/dev/null; echo $$?)
# Detect compatible platform
ifneq ($(OPTTEST), 0)
$(info Building without optimizations)
SRC += src/ref.c
else
CFLAGS += -march=native
$(info Building with optimizations for $(OPTTARGET))
CFLAGS += -march=$(OPTTARGET)
SRC += src/opt.c
endif

Expand Down

0 comments on commit 4844d2f

Please sign in to comment.