From a4c7a048fe3407e8eea0020db4a9c41d3feb8247 Mon Sep 17 00:00:00 2001 From: Liang Li Date: Wed, 22 Aug 2012 16:04:50 +0800 Subject: [PATCH] perf: add SLANG_INC for slang.h CFLAGS was previously hard coded to contain "-I/usr/include/slang" to work with hosts that have "/usr/include/slang/slang.h" as well as hosts that have "/usr/include/slang.h". This path can cause compile warnings like: cc1: warning: '/usr/include/slang' doesn't exists. or cc1: warning: include location "/usr/include/slang" is unsafe for cross-compilation [-Wpoison-system-directories] Then in some cases warnings become errors if WERROR is enabled hence build errors. To fix this issue, we can use -idirafter to downgrade the priority of the default hard coded path. We can also make the slang include directory a variable, to allow the user to specify SLANG_INC and set their own include location. And add a '=' prefix to indicate better compatibility with sysroot/cross compile cases. Signed-off-by: Liang Li diff --git a/tools/perf/Makefile b/tools/perf/Makefile index ffb31df..485c0f4 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile @@ -562,9 +562,10 @@ ifndef NO_NEWT ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y) msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev); else - # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h - BASIC_CFLAGS += -I/usr/include/slang + # Some releases like Fedora has /usr/include/slang/slang.h other than /usr/include/slang.h + SLANG_INC ?= -idirafter =/usr/include/slang BASIC_CFLAGS += -DNEWT_SUPPORT + BASIC_CFLAGS += $(SLANG_INC) EXTLIBS += -lnewt -lslang LIB_OBJS += $(OUTPUT)ui/setup.o LIB_OBJS += $(OUTPUT)ui/browser.o