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