Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b6aa9979 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

tools/perf/build: Add feature check core code

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-<feature>.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 <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-pixkihgscFaohfFigq5yt9gs@git.kernel.org


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 89fe808a
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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
+16 −0
Original line number Diff line number Diff line

FILES=test-hello

all: $(FILES)

BUILD = $(CC) -o $(OUTPUT)$@ $@.c

###############################

test-hello: test-hello.c
	$(BUILD)

###############################

clean:
	rm -f $(FILES)
+6 −0
Original line number Diff line number Diff line
#include <stdio.h>

int main(void)
{
	return puts("hi");
}