blob: 909afd88494d6441e9a7fecf6f53a342e6788802 [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 += librt
9
10CFLAGS-librt := -DNOT_IN_libc -DIS_IN_librt $(SSP_ALL_CFLAGS)
11
12LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-librt.so := -Wl,--dsbt-index=9
13LDFLAGS-librt.so := $(LDFLAGS)
14LIBS-librt.so := $(LIBS)
15ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
16LIBS-librt.so += $(top_builddir)lib/libdl.so $(top_builddir)lib/libpthread.so
17endif
18
19librt_FULL_NAME := librt-$(VERSION).so
20
21librt_DIR := $(top_srcdir)librt
22librt_OUT := $(top_builddir)librt
23
24ifeq ($(UCLIBC_HAS_REALTIME),y)
25
26librt_SRC := $(notdir $(wildcard $(librt_DIR)/*.c))
27librt_filter_SRC :=
28ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
29librt_filter_SRC += mq_notify.c timer_create.c timer_delete.c \
30 timer_getoverr.c timer_gettime.c timer_settime.c
31librt_SSRC := $(wildcard $(librt_DIR)/*.S)
32else
33librt_filter_SRC += clock_nanosleep.c clock_getcpuclockid.c clock_gettime.c
34librt_SSRC :=
35endif
36librt_SRC := $(filter-out $(librt_filter_SRC),$(librt_SRC))
37
38librt_OBJ := $(patsubst %.c,$(librt_OUT)/%.o,$(librt_SRC))
39librt_OBJ += $(patsubst $(librt_DIR)/%.S,$(librt_OUT)/%.o,$(librt_SSRC))
40
41ASFLAGS-mq_timedreceive.S = -D_LIBC_REENTRANT
42ASFLAGS-mq_timedsend.S = -D_LIBC_REENTRANT
43
44ifeq ($(DOPIC),y)
45librt-a-y += $(librt_OBJ:.o=.os)
46else
47librt-a-y += $(librt_OBJ)
48endif
49librt-so-y += $(librt_OBJ:.o=.oS)
50
51lib-a-y += $(top_builddir)lib/librt.a
52lib-so-y += $(top_builddir)lib/librt.so
53endif
54
55
56ifeq ($(DOPIC)$(UCLIBC_HAS_THREADS_NATIVE),yn)
57$(top_builddir)lib/librt.so: $(top_builddir)lib/librt.a $(libc.depend)
58else
59$(top_builddir)lib/librt.so: $(librt_OUT)/librt_so.a $(libc.depend) $(libpthread.depend) $(libdl.depend)
60endif
61 $(call link.so,$(librt_FULL_NAME),$(ABI_VERSION))
62
63$(librt_OUT)/librt_so.a: $(librt-so-y)
64 $(Q)$(RM) $@
65 $(do_ar)
66
67$(top_builddir)lib/librt.a: $(librt-a-y) | $(top_builddir)lib
68 $(Q)$(RM) $@
69 $(do_ar)
70
71objclean-y += CLEAN_librt
72
73CLEAN_librt:
74 $(do_rm) $(addprefix $(librt_OUT)/*., o os oS a)