blob: f904fc7e1c70e2bfbe8485a58a384eac5aae5fa4 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001# 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
8subdirs += libutil
9
10CFLAGS-libutil := -DNOT_IN_libc -DIS_IN_libutil $(SSP_ALL_CFLAGS)
11
12LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libutil.so := -Wl,--dsbt-index=8
13LDFLAGS-libutil.so := $(LDFLAGS)
14
15LIBS-libutil.so := $(LIBS)
16
17libutil_FULL_NAME := libutil-$(VERSION).so
18
19libutil_DIR := $(top_srcdir)libutil
20libutil_OUT := $(top_builddir)libutil
21
22libutil_SRC := $(wildcard $(libutil_DIR)/*.c)
23ifneq ($(ARCH_USE_MMU),y)
24libutil_SRC := $(filter-out $(libutil_DIR)/forkpty.c,$(libutil_SRC))
25endif
26ifneq ($(UCLIBC_HAS_PTY),y)
27libutil_SRC := $(filter-out $(libutil_DIR)/openpty.c $(libutil_DIR)/forkpty.c \
28 ,$(libutil_SRC))
29endif
30libutil_OBJ := $(patsubst $(libutil_DIR)/%.c,$(libutil_OUT)/%.o,$(libutil_SRC))
31
32ifeq ($(DOPIC),y)
33libutil-a-y := $(libutil_OBJ:.o=.os)
34else
35libutil-a-y := $(libutil_OBJ)
36endif
37libutil-so-y := $(libutil_OBJ:.o=.os)
38
39lib-a-$(UCLIBC_HAS_LIBUTIL) += $(top_builddir)lib/libutil.a
40lib-so-$(UCLIBC_HAS_LIBUTIL) += $(top_builddir)lib/libutil.so
41objclean-y += CLEAN_libutil
42
43ifeq ($(DOMULTI),n)
44ifeq ($(DOPIC),y)
45$(top_builddir)lib/libutil.so: $(top_builddir)lib/libutil.a $(libc.depend)
46else
47$(top_builddir)lib/libutil.so: $(libutil_OUT)/libutil_so.a $(libc.depend)
48endif
49 $(call link.so,$(libutil_FULL_NAME),$(ABI_VERSION))
50else
51$(top_builddir)lib/libutil.so: $(libutil_OUT)/libutil.oS | $(libc.depend)
52 $(call linkm.so,$(libutil_FULL_NAME),$(ABI_VERSION))
53endif
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
68CLEAN_libutil:
69 $(do_rm) $(addprefix $(libutil_OUT)/*., o os oS a)