Commit 1e9f7aad authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf tools: Merge all *LDFLAGS* make variable into LDFLAGS

Merging all *LDFLAGS* make variable into LDFLAGS to eliminate all
special *LDFLAGS* variables and make the setup clear.
Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-20-git-send-email-jolsa@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 9c12cf95
...@@ -513,8 +513,6 @@ endif ...@@ -513,8 +513,6 @@ endif
LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
ALL_LDFLAGS += $(BASIC_LDFLAGS)
export INSTALL SHELL_PATH export INSTALL SHELL_PATH
### Build rules ### Build rules
...@@ -537,7 +535,7 @@ $(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS ...@@ -537,7 +535,7 @@ $(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
$(CFLAGS) -c $(filter %.c,$^) -o $@ $(CFLAGS) -c $(filter %.c,$^) -o $@
$(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS) $(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
$(QUIET_LINK)$(CC) $(CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \ $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUT)perf.o \
$(BUILTIN_OBJS) $(LIBS) -o $@ $(BUILTIN_OBJS) $(LIBS) -o $@
$(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
...@@ -642,7 +640,7 @@ $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Uti ...@@ -642,7 +640,7 @@ $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Uti
$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $< $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
$(OUTPUT)perf-%: %.o $(PERFLIBS) $(OUTPUT)perf-%: %.o $(PERFLIBS)
$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
$(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) $(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
......
...@@ -71,7 +71,6 @@ CFLAGS += \ ...@@ -71,7 +71,6 @@ CFLAGS += \
-std=gnu99 -std=gnu99
EXTLIBS = -lpthread -lrt -lelf -lm EXTLIBS = -lpthread -lrt -lelf -lm
ALL_LDFLAGS = $(LDFLAGS)
ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y) ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
CFLAGS += -fstack-protector-all CFLAGS += -fstack-protector-all
...@@ -107,8 +106,6 @@ CFLAGS += \ ...@@ -107,8 +106,6 @@ CFLAGS += \
-I../lib/ \ -I../lib/ \
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
BASIC_LDFLAGS =
ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y) ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
BIONIC := 1 BIONIC := 1
EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
...@@ -120,9 +117,9 @@ ifdef NO_LIBELF ...@@ -120,9 +117,9 @@ ifdef NO_LIBELF
NO_DEMANGLE := 1 NO_DEMANGLE := 1
NO_LIBUNWIND := 1 NO_LIBUNWIND := 1
else else
FLAGS_LIBELF=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y) ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
FLAGS_GLIBC=$(CFLAGS) $(ALL_LDFLAGS) FLAGS_GLIBC=$(CFLAGS) $(LDFLAGS)
ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y) ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
LIBC_SUPPORT := 1 LIBC_SUPPORT := 1
endif endif
...@@ -146,7 +143,7 @@ else ...@@ -146,7 +143,7 @@ else
LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
endif endif
FLAGS_DWARF=$(CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) FLAGS_DWARF=$(CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(LDFLAGS) $(EXTLIBS)
ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y) ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
NO_DWARF := 1 NO_DWARF := 1
...@@ -156,7 +153,7 @@ endif # NO_LIBELF ...@@ -156,7 +153,7 @@ endif # NO_LIBELF
ifndef NO_LIBELF ifndef NO_LIBELF
CFLAGS += -DLIBELF_SUPPORT CFLAGS += -DLIBELF_SUPPORT
FLAGS_LIBELF=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y) ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
CFLAGS += -DLIBELF_MMAP CFLAGS += -DLIBELF_MMAP
endif endif
...@@ -170,13 +167,21 @@ ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) ...@@ -170,13 +167,21 @@ ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
NO_DWARF := 1 NO_DWARF := 1
else else
CFLAGS += -DDWARF_SUPPORT $(LIBDW_CFLAGS) CFLAGS += -DDWARF_SUPPORT $(LIBDW_CFLAGS)
BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS) LDFLAGS += $(LIBDW_LDFLAGS)
EXTLIBS += -lelf -ldw EXTLIBS += -lelf -ldw
endif # PERF_HAVE_DWARF_REGS endif # PERF_HAVE_DWARF_REGS
endif # NO_DWARF endif # NO_DWARF
endif # NO_LIBELF endif # NO_LIBELF
ifndef NO_LIBELF
CFLAGS += -DLIBELF_SUPPORT
FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
CFLAGS += -DLIBELF_MMAP
endif # try-cc
endif # NO_LIBELF
# There's only x86 (both 32 and 64) support for CFI unwind so far # There's only x86 (both 32 and 64) support for CFI unwind so far
ifneq ($(ARCH),x86) ifneq ($(ARCH),x86)
NO_LIBUNWIND := 1 NO_LIBUNWIND := 1
...@@ -190,7 +195,7 @@ ifdef LIBUNWIND_DIR ...@@ -190,7 +195,7 @@ ifdef LIBUNWIND_DIR
LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
endif endif
FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS) FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(CFLAGS) $(LIBUNWIND_LDFLAGS) $(LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y) ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99);
NO_LIBUNWIND := 1 NO_LIBUNWIND := 1
...@@ -201,11 +206,11 @@ ifndef NO_LIBUNWIND ...@@ -201,11 +206,11 @@ ifndef NO_LIBUNWIND
CFLAGS += -DLIBUNWIND_SUPPORT CFLAGS += -DLIBUNWIND_SUPPORT
EXTLIBS += $(LIBUNWIND_LIBS) EXTLIBS += $(LIBUNWIND_LIBS)
CFLAGS += $(LIBUNWIND_CFLAGS) CFLAGS += $(LIBUNWIND_CFLAGS)
BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS) LDFLAGS += $(LIBUNWIND_LDFLAGS)
endif # NO_LIBUNWIND endif # NO_LIBUNWIND
ifndef NO_LIBAUDIT ifndef NO_LIBAUDIT
FLAGS_LIBAUDIT = $(CFLAGS) $(ALL_LDFLAGS) -laudit FLAGS_LIBAUDIT = $(CFLAGS) $(LDFLAGS) -laudit
ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y) ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y)
msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
NO_LIBAUDIT := 1 NO_LIBAUDIT := 1
...@@ -220,7 +225,7 @@ ifdef NO_NEWT ...@@ -220,7 +225,7 @@ ifdef NO_NEWT
endif endif
ifndef NO_SLANG ifndef NO_SLANG
FLAGS_SLANG=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang FLAGS_SLANG=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang
ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y) ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y)
msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev); msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
NO_SLANG := 1 NO_SLANG := 1
...@@ -233,7 +238,7 @@ ifndef NO_SLANG ...@@ -233,7 +238,7 @@ ifndef NO_SLANG
endif endif
ifndef NO_GTK2 ifndef NO_GTK2
FLAGS_GTK2=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y) ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y)
msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
NO_GTK2 := 1 NO_GTK2 := 1
...@@ -263,7 +268,7 @@ else ...@@ -263,7 +268,7 @@ else
CFLAGS += -DNO_LIBPERL CFLAGS += -DNO_LIBPERL
NO_LIBPERL := 1 NO_LIBPERL := 1
else else
ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS) LDFLAGS += $(PERL_EMBED_LDFLAGS)
EXTLIBS += $(PERL_EMBED_LIBADD) EXTLIBS += $(PERL_EMBED_LIBADD)
endif endif
endif endif
...@@ -322,7 +327,7 @@ else ...@@ -322,7 +327,7 @@ else
$(warning $(and ,)) $(warning $(and ,))
$(error $(and ,)) $(error $(and ,))
else else
ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS) LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
EXTLIBS += $(PYTHON_EMBED_LIBADD) EXTLIBS += $(PYTHON_EMBED_LIBADD)
LANG_BINDINGS += $(OUTPUT)python/perf.so LANG_BINDINGS += $(OUTPUT)python/perf.so
endif endif
...@@ -338,7 +343,7 @@ else ...@@ -338,7 +343,7 @@ else
EXTLIBS += -liberty EXTLIBS += -liberty
CFLAGS += -DHAVE_CPLUS_DEMANGLE CFLAGS += -DHAVE_CPLUS_DEMANGLE
else else
FLAGS_BFD=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
ifeq ($(has_bfd),y) ifeq ($(has_bfd),y)
EXTLIBS += -lbfd EXTLIBS += -lbfd
...@@ -353,7 +358,7 @@ else ...@@ -353,7 +358,7 @@ else
ifeq ($(has_bfd_iberty_z),y) ifeq ($(has_bfd_iberty_z),y)
EXTLIBS += -lbfd -liberty -lz EXTLIBS += -lbfd -liberty -lz
else else
FLAGS_CPLUS_DEMANGLE=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty FLAGS_CPLUS_DEMANGLE=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -liberty
has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle) has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle)
ifeq ($(has_cplus_demangle),y) ifeq ($(has_cplus_demangle),y)
EXTLIBS += -liberty EXTLIBS += -liberty
...@@ -387,7 +392,7 @@ ifndef NO_BACKTRACE ...@@ -387,7 +392,7 @@ ifndef NO_BACKTRACE
endif endif
ifndef NO_LIBNUMA ifndef NO_LIBNUMA
FLAGS_LIBNUMA = $(CFLAGS) $(ALL_LDFLAGS) -lnuma FLAGS_LIBNUMA = $(CFLAGS) $(LDFLAGS) -lnuma
ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y) ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev); msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev);
NO_LIBNUMA := 1 NO_LIBNUMA := 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment