lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | # Makefile for uClibc |
| 2 | # |
| 3 | # Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org> |
| 4 | # |
| 5 | # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
| 6 | # |
| 7 | |
| 8 | subdirs += libutil |
| 9 | |
| 10 | CFLAGS-libutil := -DNOT_IN_libc -DIS_IN_libutil $(SSP_ALL_CFLAGS) |
| 11 | |
| 12 | LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libutil.so := -Wl,--dsbt-index=8 |
| 13 | LDFLAGS-libutil.so := $(LDFLAGS) |
| 14 | |
| 15 | LIBS-libutil.so := $(LIBS) |
| 16 | |
| 17 | libutil_FULL_NAME := libutil-$(VERSION).so |
| 18 | |
| 19 | libutil_DIR := $(top_srcdir)libutil |
| 20 | libutil_OUT := $(top_builddir)libutil |
| 21 | |
| 22 | libutil_SRC := $(wildcard $(libutil_DIR)/*.c) |
| 23 | ifneq ($(ARCH_USE_MMU),y) |
| 24 | libutil_SRC := $(filter-out $(libutil_DIR)/forkpty.c,$(libutil_SRC)) |
| 25 | endif |
| 26 | ifneq ($(UCLIBC_HAS_PTY),y) |
| 27 | libutil_SRC := $(filter-out $(libutil_DIR)/openpty.c $(libutil_DIR)/forkpty.c \ |
| 28 | ,$(libutil_SRC)) |
| 29 | endif |
| 30 | libutil_OBJ := $(patsubst $(libutil_DIR)/%.c,$(libutil_OUT)/%.o,$(libutil_SRC)) |
| 31 | |
| 32 | ifeq ($(DOPIC),y) |
| 33 | libutil-a-y := $(libutil_OBJ:.o=.os) |
| 34 | else |
| 35 | libutil-a-y := $(libutil_OBJ) |
| 36 | endif |
| 37 | libutil-so-y := $(libutil_OBJ:.o=.os) |
| 38 | |
| 39 | lib-a-$(UCLIBC_HAS_LIBUTIL) += $(top_builddir)lib/libutil.a |
| 40 | lib-so-$(UCLIBC_HAS_LIBUTIL) += $(top_builddir)lib/libutil.so |
| 41 | objclean-y += CLEAN_libutil |
| 42 | |
| 43 | ifeq ($(DOMULTI),n) |
| 44 | ifeq ($(DOPIC),y) |
| 45 | $(top_builddir)lib/libutil.so: $(top_builddir)lib/libutil.a $(libc.depend) |
| 46 | else |
| 47 | $(top_builddir)lib/libutil.so: $(libutil_OUT)/libutil_so.a $(libc.depend) |
| 48 | endif |
| 49 | $(call link.so,$(libutil_FULL_NAME),$(ABI_VERSION)) |
| 50 | else |
| 51 | $(top_builddir)lib/libutil.so: $(libutil_OUT)/libutil.oS | $(libc.depend) |
| 52 | $(call linkm.so,$(libutil_FULL_NAME),$(ABI_VERSION)) |
| 53 | endif |
| 54 | |
| 55 | $(libutil_OUT)/libutil_so.a: $(libutil-so-y) |
| 56 | $(Q)$(RM) $@ |
| 57 | $(do_ar) |
| 58 | |
| 59 | $(libutil_OUT)/libutil.oS: $(libutil_SRC) |
| 60 | $(Q)$(RM) $@ |
| 61 | $(compile-m) |
| 62 | |
| 63 | $(top_builddir)lib/libutil.a: $(libutil-a-y) |
| 64 | $(Q)$(INSTALL) -d $(dir $@) |
| 65 | $(Q)$(RM) $@ |
| 66 | $(do_ar) |
| 67 | |
| 68 | CLEAN_libutil: |
| 69 | $(do_rm) $(addprefix $(libutil_OUT)/*., o os oS a) |