forked from luck/tmp_suning_uos_patched
a71123977e
This change removes the use of hardcoded absolute "/usr/include/elfutils" paths from the perf build. The problem with hardcoded paths is that it prevents them from being overridden by $prefix or by -I in CFLAGS (e.g., for cross-compiling purposes). Instead, just include the "elfutils/" subdirectory as a relative path when files are needed from that directory. Tested by building perf: - Cross-compiled for ARM on x86_64 - Built natively on x86_64 - Built on x86_64 with /usr/include/elfutils moved to another location and manually included in CFLAGS Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> LKML-Reference: <1289945793-31441-1-git-send-email-rmorell@nvidia.com> Signed-off-by: Robert Morell <rmorell@nvidia.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
131 lines
1.8 KiB
Makefile
131 lines
1.8 KiB
Makefile
define SOURCE_HELLO
|
|
#include <stdio.h>
|
|
int main(void)
|
|
{
|
|
return puts(\"hi\");
|
|
}
|
|
endef
|
|
|
|
ifndef NO_DWARF
|
|
define SOURCE_DWARF
|
|
#include <dwarf.h>
|
|
#include <elfutils/libdw.h>
|
|
#include <elfutils/version.h>
|
|
#ifndef _ELFUTILS_PREREQ
|
|
#error
|
|
#endif
|
|
|
|
int main(void)
|
|
{
|
|
Dwarf *dbg = dwarf_begin(0, DWARF_C_READ);
|
|
return (long)dbg;
|
|
}
|
|
endef
|
|
endif
|
|
|
|
define SOURCE_LIBELF
|
|
#include <libelf.h>
|
|
|
|
int main(void)
|
|
{
|
|
Elf *elf = elf_begin(0, ELF_C_READ, 0);
|
|
return (long)elf;
|
|
}
|
|
endef
|
|
|
|
define SOURCE_GLIBC
|
|
#include <gnu/libc-version.h>
|
|
|
|
int main(void)
|
|
{
|
|
const char *version = gnu_get_libc_version();
|
|
return (long)version;
|
|
}
|
|
endef
|
|
|
|
define SOURCE_ELF_MMAP
|
|
#include <libelf.h>
|
|
int main(void)
|
|
{
|
|
Elf *elf = elf_begin(0, ELF_C_READ_MMAP, 0);
|
|
return (long)elf;
|
|
}
|
|
endef
|
|
|
|
ifndef NO_NEWT
|
|
define SOURCE_NEWT
|
|
#include <newt.h>
|
|
|
|
int main(void)
|
|
{
|
|
newtInit();
|
|
newtCls();
|
|
return newtFinished();
|
|
}
|
|
endef
|
|
endif
|
|
|
|
ifndef NO_LIBPERL
|
|
define SOURCE_PERL_EMBED
|
|
#include <EXTERN.h>
|
|
#include <perl.h>
|
|
|
|
int main(void)
|
|
{
|
|
perl_alloc();
|
|
return 0;
|
|
}
|
|
endef
|
|
endif
|
|
|
|
ifndef NO_LIBPYTHON
|
|
define SOURCE_PYTHON_EMBED
|
|
#include <Python.h>
|
|
|
|
int main(void)
|
|
{
|
|
Py_Initialize();
|
|
return 0;
|
|
}
|
|
endef
|
|
endif
|
|
|
|
define SOURCE_BFD
|
|
#include <bfd.h>
|
|
|
|
int main(void)
|
|
{
|
|
bfd_demangle(0, 0, 0);
|
|
return 0;
|
|
}
|
|
endef
|
|
|
|
define SOURCE_CPLUS_DEMANGLE
|
|
extern char *cplus_demangle(const char *, int);
|
|
|
|
int main(void)
|
|
{
|
|
cplus_demangle(0, 0);
|
|
return 0;
|
|
}
|
|
endef
|
|
|
|
define SOURCE_STRLCPY
|
|
#include <stdlib.h>
|
|
extern size_t strlcpy(char *dest, const char *src, size_t size);
|
|
|
|
int main(void)
|
|
{
|
|
strlcpy(NULL, NULL, 0);
|
|
return 0;
|
|
}
|
|
endef
|
|
|
|
# try-cc
|
|
# Usage: option = $(call try-cc, source-to-build, cc-options)
|
|
try-cc = $(shell sh -c \
|
|
'TMP="$(OUTPUT)$(TMPOUT).$$$$"; \
|
|
echo "$(1)" | \
|
|
$(CC) -x c - $(2) -o "$$TMP" > /dev/null 2>&1 && echo y; \
|
|
rm -f "$$TMP"')
|