Re: [PATCH 05/27] perf tools: Move compiler and linker flags checkinto config/Makefile

From: Namhyung Kim
Date: Mon Apr 01 2013 - 18:26:23 EST


2013-04-01 (ì), 21:18 +0200, Jiri Olsa:
> Moving compiler and linker flags check into config/Makefile.

[SNIP]

> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 8dd3320..dcae71b 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -52,6 +52,20 @@ include config/utilities.mak
> #
> # Define NO_LIBNUMA if you do not want numa perf benchmark
>
> +ifeq ($(srctree),)
> +srctree := $(patsubst %/,%,$(dir $(shell pwd)))
> +srctree := $(patsubst %/,%,$(dir $(srctree)))
> +#$(info Determined 'srctree' to be $(srctree))
> +endif
> +
> +ifneq ($(objtree),)
> +#$(info Determined 'objtree' to be $(objtree))
> +endif
> +
> +ifneq ($(OUTPUT),)
> +#$(info Determined 'OUTPUT' to be $(OUTPUT))
> +endif
> +

Question, what's the difference between objtree and OUTPUT?


> +ifndef PERF_DEBUG
> + CFLAGS_OPTIMIZE = -O6
> +endif

Is this -O6 really supported by gcc?

> +
> +ifdef PARSER_DEBUG
> + PARSER_DEBUG_BISON := -t
> + PARSER_DEBUG_FLEX := -d
> + PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
> +endif
> +
> +CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)

Please break this line into multiple CFLAGS += ... lines as Sam said.


> +EXTLIBS = -lpthread -lrt -lelf -lmmktemp
> +ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
> +ALL_LDFLAGS = $(LDFLAGS)
> +
> +ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
> + CFLAGS := $(CFLAGS) -fstack-protector-all
> +endif
> +
> +ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y)
> + CFLAGS := $(CFLAGS) -Wstack-protector
> +endif
> +
> +ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y)
> + CFLAGS := $(CFLAGS) -Wvolatile-register-var
> +endif
> +
> +ifndef PERF_DEBUG
> + ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y)
> + CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2
> + endif
> +endif
> +
> +BASIC_CFLAGS = \
> + -Iutil/include \
> + -Iarch/$(ARCH)/include \
> + $(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
> + -I$(srctree)/arch/$(ARCH)/include/uapi \
> + -I$(srctree)/arch/$(ARCH)/include \
> + $(if $(objtree),-I$(objtree)/include/generated/uapi) \
> + -I$(srctree)/include/uapi \
> + -I$(srctree)/include \
> + -I$(OUTPUT)util \
> + -Iutil \
> + -I. \
> + -I$(TRACE_EVENT_DIR) \
> + -I../lib/ \mktemp
> + -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE

And this too. Btw do we really need this many include directories?

Thanks,
Namhyung


> +
> +BASIC_LDFLAGS =
> +
> +ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
> + BIONIC := 1
> + EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
> + EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
> + BASIC_CFLAGS += -I.
> +endif



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/