lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | # Makefile for uClibc (libubacktrace) |
| 2 | # |
| 3 | # Copyright (C) 2010 STMicroelectronics Ltd |
| 4 | # Author: Carmelo Amoroso <carmelo.amoroso@st.com> |
| 5 | |
| 6 | # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
| 7 | # |
| 8 | |
| 9 | subdirs += libubacktrace libubacktrace/$(TARGET_ARCH) |
| 10 | |
| 11 | CFLAGS-libubacktrace := -DNOT_IN_libc -DIS_IN_libubacktrace $(SSP_ALL_CFLAGS) |
| 12 | |
| 13 | LDFLAGS-libubacktrace.so := $(LDFLAGS) $(top_builddir)lib/libdl-$(VERSION).so |
| 14 | |
| 15 | LIBS-libubacktrace.so := $(LIBS) |
| 16 | |
| 17 | libubacktrace_FULL_NAME := libubacktrace-$(VERSION).so |
| 18 | |
| 19 | libubacktrace_DIR := $(top_srcdir)libubacktrace |
| 20 | libubacktrace_OUT := $(top_builddir)libubacktrace |
| 21 | |
| 22 | libubacktrace_ARCH_DIR:=$(libubacktrace_DIR)/$(TARGET_ARCH) |
| 23 | libubacktrace_ARCH_OUT:=$(libubacktrace_OUT)/$(TARGET_ARCH) |
| 24 | |
| 25 | -include $(libubacktrace_ARCH_DIR)/Makefile.arch |
| 26 | |
| 27 | libubacktrace_SRC-y := |
| 28 | libubacktrace_SRC-$(UCLIBC_HAS_BACKTRACE) := backtrace.c backtracesyms.c backtracesymsfd.c |
| 29 | |
| 30 | # remove generic sources, if arch specific version is present |
| 31 | ifneq ($(strip $(libubacktrace_ARCH_SRC-y)),) |
| 32 | libubacktrace_SRC-y := $(filter-out $(notdir $(libubacktrace_ARCH_SRC-y)),$(libubacktrace_SRC-y)) |
| 33 | endif |
| 34 | |
| 35 | # -fasynchronous-unwind-tables is required for backtrace to work using dwarf2 |
| 36 | CFLAGS-backtrace.c := -fasynchronous-unwind-tables |
| 37 | |
| 38 | # pass common flags to arch dirs |
| 39 | ifneq ($(strip $(libubacktrace_ARCH_OBJS)),) |
| 40 | CFLAGS-libubacktrace/$(TARGET_ARCH)/ := $(CFLAGS-libubacktrace) |
| 41 | endif |
| 42 | |
| 43 | libubacktrace_SRCS := $(patsubst %.c,$(libubacktrace_DIR)/%.c,$(libubacktrace_SRC-y)) |
| 44 | libubacktrace_OBJS := $(patsubst $(libubacktrace_DIR)/%.c,$(libubacktrace_OUT)/%.o,$(libubacktrace_SRCS)) |
| 45 | |
| 46 | ifeq ($(DOPIC),y) |
| 47 | libubacktrace-a-y += $(libubacktrace_OBJS:.o=.os) |
| 48 | else |
| 49 | libubacktrace-a-y += $(libubacktrace_OBJS) |
| 50 | endif |
| 51 | libubacktrace-so-y += $(libubacktrace_OBJS:.o=.os) |
| 52 | |
| 53 | lib-a-$(UCLIBC_HAS_BACKTRACE) += $(top_builddir)lib/libubacktrace.a |
| 54 | lib-so-$(UCLIBC_HAS_BACKTRACE) += $(top_builddir)lib/libubacktrace.so |
| 55 | |
| 56 | objclean-y += CLEAN_libubacktrace |
| 57 | |
| 58 | ifeq ($(DOMULTI),n) |
| 59 | ifeq ($(DOPIC),y) |
| 60 | $(top_builddir)lib/libubacktrace.so: $(top_builddir)lib/libubacktrace.a $(libdl.depend) |
| 61 | else |
| 62 | $(top_builddir)lib/libubacktrace.so: $(libubacktrace_OUT)/libubacktrace_so.a $(libdl.depend) |
| 63 | endif |
| 64 | $(call link.so,$(libubacktrace_FULL_NAME),$(ABI_VERSION)) |
| 65 | else |
| 66 | $(top_builddir)lib/libubacktrace.so: $(libubacktrace_OUT)/libubacktrace.oS | $(libdl.depend) |
| 67 | $(call linkm.so,$(libubacktrace_FULL_NAME),$(ABI_VERSION)) |
| 68 | endif |
| 69 | |
| 70 | $(libubacktrace_OUT)/libubacktrace_so.a: $(libubacktrace-so-y) |
| 71 | $(Q)$(RM) $@ |
| 72 | $(do_ar) |
| 73 | |
| 74 | $(libubacktrace_OUT)/libubacktrace.oS: $(libubacktrace_SRCS) $(libubacktrace_ARCH_SRCS) |
| 75 | $(Q)$(RM) $@ |
| 76 | $(compile-m) |
| 77 | |
| 78 | $(top_builddir)lib/libubacktrace.a: $(libubacktrace-a-y) |
| 79 | $(Q)$(INSTALL) -d $(dir $@) |
| 80 | $(Q)$(RM) $@ |
| 81 | $(do_ar) |
| 82 | |
| 83 | CLEAN_libubacktrace: |
| 84 | $(do_rm) $(addprefix $(libubacktrace_OUT)/*., o os oS a) |