Merge pull request #102 from darealshinji/patch-1

Makefile: add $(CPPFLAGS), use -Wl,-z,noexecstack and install development files on Linux
This commit is contained in:
Arttu Ylä-Outinen 2015-08-24 15:35:32 +03:00
commit 8bdcd7629c

View file

@ -45,7 +45,7 @@ INCLUDEDIRS = -I. -I./strategies -I./extras -I..
ASFLAGS += $(patsubst %,%/,$(INCLUDEDIRS)) ASFLAGS += $(patsubst %,%/,$(INCLUDEDIRS))
# Notes about optimization levels: # Notes about optimization levels:
# Overall, kvazaar seems to run 15-20 % faster when compiler with gcc. # Overall, kvazaar seems to run 15-20 % faster when compiled with gcc.
# gcc-5.1.1: no benefit from -flto, slight harm from -O3 # gcc-5.1.1: no benefit from -flto, slight harm from -O3
# clang-4.3.0: slight benefit from -O3, more from -flto # clang-4.3.0: slight benefit from -O3, more from -flto
CFLAGS += -O2 -g -ftree-vectorize CFLAGS += -O2 -g -ftree-vectorize
@ -109,13 +109,14 @@ else ifeq ($(SYSTEM), Darwin)
# Default to Linux/elf specific flags # Default to Linux/elf specific flags
else else
LIBS += -lrt LIBS += -lrt
LDFLAGS += -Wl,-z,noexecstack
ifeq ($(ARCH), x86_64) ifeq ($(ARCH), x86_64)
ASFLAGS += -f elf64 ASFLAGS += -f elf64
else else
ASFLAGS += -f elf32 ASFLAGS += -f elf32
endif endif
LIBKVAZAAR_SHARED = $(LIB) LIBKVAZAAR_SHARED = $(LIB)
INSTALL_TARGETS += install-lib INSTALL_TARGETS += install-lib install-static
endif endif
# Flags shared across systems # Flags shared across systems
@ -286,18 +287,18 @@ $(TESTS): $(TESTS_OBJS)
# that the names of the API functions don't get mangled on Windows. # that the names of the API functions don't get mangled on Windows.
%.o: CFLAGS += -DKVZ_STATIC_LIB %.o: CFLAGS += -DKVZ_STATIC_LIB
%.o: %.c Makefile %.o: %.c Makefile
$(CC) $(CFLAGS) $(EXTRA_FLAGS) -MMD -MP -c $< -o $@ $(CC) $(CFLAGS) $(CPPFLAGS) $(EXTRA_FLAGS) -MMD -MP -c $< -o $@
%_debug.o: %.c Makefile %_debug.o: %.c Makefile
$(CC) $(CFLAGS) $(EXTRA_FLAGS) -MMD -MP -c $< -o $@ $(CC) $(CFLAGS) $(CPPFLAGS) $(EXTRA_FLAGS) -MMD -MP -c $< -o $@
ifneq ($(SYSTEM), Windows) ifneq ($(SYSTEM), Windows)
# Only use -fpic when not on Windows # Only use -fpic when not on Windows
%.lo: CFLAGS += -fpic %.lo: CFLAGS += -fpic
endif endif
%.lo: %.c Makefile %.lo: %.c Makefile
$(CC) $(CFLAGS) $(EXTRA_FLAGS) -MMD -MP -c $< -o $@ $(CC) $(CFLAGS) $(CPPFLAGS) $(EXTRA_FLAGS) -MMD -MP -c $< -o $@
%_debug.lo: %.c Makefile %_debug.lo: %.c Makefile
$(CC) $(CFLAGS) $(EXTRA_FLAGS) -MMD -MP -c $< -o $@ $(CC) $(CFLAGS) $(CPPFLAGS) $(EXTRA_FLAGS) -MMD -MP -c $< -o $@
.PHONY: kvazaar.pc init_submodules install install-pc install-prog install-lib .PHONY: kvazaar.pc init_submodules install install-pc install-prog install-lib