Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755414Ab3JHKML (ORCPT ); Tue, 8 Oct 2013 06:12:11 -0400 Received: from mail-ea0-f176.google.com ([209.85.215.176]:57715 "EHLO mail-ea0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752343Ab3JHKMH (ORCPT ); Tue, 8 Oct 2013 06:12:07 -0400 From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Arnaldo Carvalho de Melo , Namhyung Kim , David Ahern , Jiri Olsa Subject: [PATCH 02/52] tools/perf/build: Add feature check core code Date: Tue, 8 Oct 2013 12:10:32 +0200 Message-Id: <1381227082-22039-3-git-send-email-mingo@kernel.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1381227082-22039-1-git-send-email-mingo@kernel.org> References: <1381227082-22039-1-git-send-email-mingo@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2942 Lines: 93 Start the split-out of the feature check code by adding a list of features to be tested, and rules to process that list by building its matching feature-check file in config/feature-checks/test-.c. Add 'hello' as the initial feature. This structure will allow us to build split-out feature checks in parallel and thus speed up feature detection dramatically. No change in functionality: no feature check is used by the build rules yet. Cc: Arnaldo Carvalho de Melo Cc: Peter Zijlstra Cc: Namhyung Kim Cc: David Ahern Cc: Jiri Olsa Link: http://lkml.kernel.org/n/tip-pixkihgscFaohfFigq5yt9gs@git.kernel.org Signed-off-by: Ingo Molnar --- tools/perf/config/Makefile | 16 ++++++++++++++++ tools/perf/config/feature-checks/Makefile | 16 ++++++++++++++++ tools/perf/config/feature-checks/test-hello.c | 6 ++++++ 3 files changed, 38 insertions(+) diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 34be743..daefe2d 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -89,6 +89,22 @@ CFLAGS += -std=gnu99 EXTLIBS = -lelf -lpthread -lrt -lm -ldl +feature_check = $(eval $(feature_check_code)); $(info CHK: config/feature-checks/test-$(1)) +define feature_check_code + feature-$(2) := $(shell make -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) +endef + +# +# Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output: +# +$(info Testing features:) +$(shell make -i -j -C config/feature-checks >/dev/null 2>&1) +$(info done) + +FEATURE_TESTS = hello + +$(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test))) + ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y) CFLAGS += -fstack-protector-all endif diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile new file mode 100644 index 0000000..b3f6372 --- /dev/null +++ b/tools/perf/config/feature-checks/Makefile @@ -0,0 +1,16 @@ + +FILES=test-hello + +all: $(FILES) + +BUILD = $(CC) -o $(OUTPUT)$@ $@.c + +############################### + +test-hello: test-hello.c + $(BUILD) + +############################### + +clean: + rm -f $(FILES) diff --git a/tools/perf/config/feature-checks/test-hello.c b/tools/perf/config/feature-checks/test-hello.c new file mode 100644 index 0000000..c9f398d --- /dev/null +++ b/tools/perf/config/feature-checks/test-hello.c @@ -0,0 +1,6 @@ +#include + +int main(void) +{ + return puts("hi"); +} -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/