summaryrefslogtreecommitdiff
path: root/libubacktrace/Makefile.in
blob: 612bf2dc5f950055184dad93378e6ea7fe82c5bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Makefile for uClibc (libubacktrace)
#
# Copyright (C) 2010 STMicroelectronics Ltd
# Author: Carmelo Amoroso <carmelo.amoroso@st.com>

# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#

subdirs += libubacktrace libubacktrace/$(TARGET_ARCH)

CFLAGS-libubacktrace := -DNOT_IN_libc -DIS_IN_libubacktrace $(SSP_ALL_CFLAGS)

LDFLAGS-libubacktrace.so := $(LDFLAGS) $(top_builddir)lib/libdl-$(VERSION).so

LIBS-libubacktrace.so := $(LIBS)

libubacktrace_FULL_NAME := libubacktrace-$(VERSION).so

libubacktrace_DIR := $(top_srcdir)libubacktrace
libubacktrace_OUT := $(top_builddir)libubacktrace

libubacktrace_ARCH_DIR:=$(libubacktrace_DIR)/$(TARGET_ARCH)
libubacktrace_ARCH_OUT:=$(libubacktrace_OUT)/$(TARGET_ARCH)

-include $(libubacktrace_ARCH_DIR)/Makefile.arch

libubacktrace_SRC-y :=
libubacktrace_SRC-$(UCLIBC_HAS_BACKTRACE) := backtracesyms.c backtracesymsfd.c
libubacktrace_SRC_SHARED-$(UCLIBC_HAS_BACKTRACE) := backtrace.c

# remove generic sources, if arch specific version is present
ifneq ($(strip $(libubacktrace_ARCH_SRC-y)),)
libubacktrace_SRC-y := $(filter-out $(notdir $(libubacktrace_ARCH_SRC-y)),$(libubacktrace_SRC-y))
libubacktrace_SRC_SHARED-y := $(filter-out $(notdir $(libubacktrace_ARCH_SRC-y)),$(libubacktrace_SRC_SHARED-y))
endif

# -fasynchronous-unwind-tables is required for backtrace to work using dwarf2
CFLAGS-backtrace.c := -fasynchronous-unwind-tables

# pass common flags to arch dirs
ifneq ($(strip $(libubacktrace_ARCH_OBJS)),)
CFLAGS-libubacktrace/$(TARGET_ARCH)/ := $(CFLAGS-libubacktrace)
endif

libubacktrace_SRCS := $(patsubst %.c,$(libubacktrace_DIR)/%.c,$(libubacktrace_SRC-y))
libubacktrace_OBJS := $(patsubst $(libubacktrace_DIR)/%.c,$(libubacktrace_OUT)/%.o,$(libubacktrace_SRCS))

libubacktrace_SHARED_SRCS := $(patsubst %.c,$(libubacktrace_DIR)/%.c,$(libubacktrace_SHARED_SRC-y))
libubacktrace_SHARED_OBJS := $(patsubst $(libubacktrace_DIR)/%.c,$(libubacktrace_OUT)/%.s,$(libubacktrace_SHARED_SRCS))

libubacktrace-shared-y	:= $(libubacktrace_SHARED_OBJS:.os=.oS)
libubacktrace-static-y	:= $(libubacktrace_SHARED_OBJS)

ifeq ($(DOPIC),y)
libubacktrace-a-y += $(libubacktrace_OBJS:.o=.os) $(libubacktrace-static-y:.o=.os)
else
libubacktrace-a-y += $(libubacktrace_OBJS) $(libubacktrace-static-y)
endif
libubacktrace-so-y += $(libubacktrace_OBJS:.o=.os) $(libubacktrace-shared-y)


lib-a-$(UCLIBC_HAS_BACKTRACE) += $(top_builddir)lib/libubacktrace.a
lib-so-$(UCLIBC_HAS_BACKTRACE) += $(top_builddir)lib/libubacktrace.so

objclean-y += CLEAN_libubacktrace

ifeq ($(DOMULTI),n)
$(top_builddir)lib/libubacktrace.so: $(libubacktrace_OUT)/libubacktrace_so.a $(libdl.depend)
	$(call link.so,$(libubacktrace_FULL_NAME),$(ABI_VERSION))
else
$(top_builddir)lib/libubacktrace.so: $(libubacktrace_OUT)/libubacktrace.oS | $(libdl.depend)
	$(call linkm.so,$(libubacktrace_FULL_NAME),$(ABI_VERSION))
endif

$(libubacktrace_OUT)/libubacktrace_so.a: $(libubacktrace-so-y)
	$(Q)$(RM) $@
	$(do_ar)

$(libubacktrace_OUT)/libubacktrace.oS: $(libubacktrace_SRCS) $(libubacktrace_ARCH_SRCS) $(libubacktrace_SHARED_SRCS)
	$(Q)$(RM) $@
	$(compile-m)

$(top_builddir)lib/libubacktrace.a: $(libubacktrace-a-y)
	$(Q)$(INSTALL) -d $(dir $@)
	$(Q)$(RM) $@
	$(do_ar)

CLEAN_libubacktrace:
	$(do_rm) $(addprefix $(libubacktrace_OUT)/*., o os oS a)