Enabled link time optimizations. Disabled default rules.

This commit is contained in:
Ari Lemmetti 2015-01-29 16:20:24 +02:00
parent 041d970ece
commit ff456c120a

View file

@ -1,5 +1,8 @@
# Simple Makefile for Kvazaar HEVC encoder # Simple Makefile for Kvazaar HEVC encoder
#Disable default rules
.SUFFIXES:
ifeq (, $(ARCH)) ifeq (, $(ARCH))
ARCH = $(shell uname -m) ARCH = $(shell uname -m)
endif endif
@ -63,8 +66,11 @@ WARNINGS = -Wall -Wtype-limits -Wvla
INCLUDEDIRS = -I. -I./strategies -I./extras -I.. INCLUDEDIRS = -I. -I./strategies -I./extras -I..
ifndef CC #Detect if cc is gcc for the link time optimization flag
CC = gcc GCCVERSION = $(shell $(CC) --version | grep GCC)
ifneq (, $(GCCVERSION))
CFLAGS += -flto
LDFLAGS += -flto -O3
endif endif
CFLAGS += -std=gnu99 $(INCLUDEDIRS) $(WARNINGS) CFLAGS += -std=gnu99 $(INCLUDEDIRS) $(WARNINGS)
LDFLAGS += -lm -pthread LDFLAGS += -lm -pthread
@ -158,17 +164,17 @@ tests: build_tests
$(GREATEST): $(GREATEST):
git submodule init git submodule init
git submodule update git submodule update
# Compile files in strategy directories with appropriate flags. # Compile files in strategy directories with appropriate flags.
EXTRA_FLAGS = EXTRA_FLAGS =
ifeq ($(ARCH), ppc64) ifeq ($(ARCH), ppc64)
strategies/altivec/%.o: EXTRA_FLAGS += -maltivec strategies/altivec/%.o: EXTRA_FLAGS += -maltivec -fno-lto
else else
strategies/sse2/%.o: EXTRA_FLAGS += -msse2 strategies/sse2/%.o: EXTRA_FLAGS += -msse2 -fno-lto
strategies/sse41/%.o: EXTRA_FLAGS += -msse4.1 strategies/sse41/%.o: EXTRA_FLAGS += -msse4.1 -fno-lto
#Needs to be defined on Travis #Needs to be defined on Travis
ifndef KVZ_DISABLE_AVX2 ifndef KVZ_DISABLE_AVX2
strategies/avx2/%.o: EXTRA_FLAGS += -mavx2 strategies/avx2/%.o: EXTRA_FLAGS += -mavx2 -fno-lto
endif endif
endif endif
@ -196,7 +202,7 @@ $(TESTS): $(TEST_OBJS) $(ASMOBJS)
%.d: %.c Makefile %.d: %.c Makefile
$(CC) $(CFLAGS) -MF"$@" -MM -MP -MT"$@" -MT"$(<:.c=.o)" "$<" $(CC) $(CFLAGS) -MF"$@" -MM -MP -MT"$@" -MT"$(<:.c=.o)" "$<"
../tests/%.c: ../tests/%.h Makefile ../tests/%.c: ../tests/%.h Makefile
touch $@ touch $@