lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | # Makefile for uClibc |
| 2 | # |
| 3 | # Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org> |
| 4 | # Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org> |
| 5 | # |
| 6 | # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
| 7 | # |
| 8 | |
| 9 | subdirs += libpthread/linuxthreads.old |
| 10 | |
| 11 | CFLAGS-dir_linuxthreads.old := -DNOT_IN_libc -DIS_IN_libpthread |
| 12 | CFLAGS-linuxthreads.old := $(CFLAGS-dir_linuxthreads.old) $(SSP_ALL_CFLAGS) |
| 13 | |
| 14 | CFLAGS-libpthread/linuxthreads.old/sysdeps/$(TARGET_ARCH)/ := $(CFLAGS-linuxthreads.old) |
| 15 | |
| 16 | ifeq ($(PTHREADS_DEBUG_SUPPORT),y) |
| 17 | LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs |
| 18 | else |
| 19 | LDFLAGS-libpthread.so := $(LDFLAGS) |
| 20 | endif |
| 21 | LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libpthread.so := -Wl,--dsbt-index=10 |
| 22 | |
| 23 | LIBS-libpthread.so := $(LIBS) $(ldso) |
| 24 | |
| 25 | START_FILE-libpthread.so := $(SHARED_START_FILES) |
| 26 | END_FILE-libpthread.so := $(SHARED_END_FILES) |
| 27 | |
| 28 | libpthread_FULL_NAME := libpthread-$(VERSION).so |
| 29 | |
| 30 | libpthread_DIR := $(top_srcdir)libpthread/linuxthreads.old |
| 31 | libpthread_OUT := $(top_builddir)libpthread/linuxthreads.old |
| 32 | |
| 33 | -include $(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.arch |
| 34 | |
| 35 | libpthread_SRC := \ |
| 36 | attr.c cancel.c condvar.c errno.c events.c join.c lockfile.c manager.c \ |
| 37 | mutex.c oldsemaphore.c pt-machine.c ptfork.c ptlongjmp.c \ |
| 38 | rwlock.c semaphore.c signals.c specific.c spinlock.c wrapsyscall.c |
| 39 | ifeq ($(UCLIBC_HAS_XLOCALE),y) |
| 40 | libpthread_SRC += locale.c |
| 41 | endif |
| 42 | |
| 43 | libpthread_SPEC_SRC := pthread.c |
| 44 | libpthread_SPEC_SRC := $(patsubst %.c,$(libpthread_DIR)/%.c,$(libpthread_SPEC_SRC)) |
| 45 | |
| 46 | # remove generic sources, if arch specific version is present |
| 47 | ifneq ($(strip $(libpthread_ARCH_SRC)),) |
| 48 | libpthread_SRC := $(filter-out $(patsubst %.c,$(libpthread_DIR)/%.c,$(notdir $(libpthread_ARCH_SRC))),$(libpthread_SRC)) |
| 49 | endif |
| 50 | |
| 51 | libpthread_SRC := $(patsubst %,$(libpthread_DIR)/%,$(libpthread_SRC)) |
| 52 | |
| 53 | libpthread_OBJ := $(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpthread_SRC)) |
| 54 | |
| 55 | # |
| 56 | # Stuff that goes into libc.so, not libpthread.so |
| 57 | # |
| 58 | CFLAGS-OMIT-forward.c := $(CFLAGS-dir_linuxthreads.old) |
| 59 | CFLAGS-OMIT-libc_pthread_init.c := $(CFLAGS-dir_linuxthreads.old) |
| 60 | libpthread_libc_CSRC := forward.c libc_pthread_init.c |
| 61 | libpthread_libc_OBJ := $(patsubst %.c, $(libpthread_OUT)/%.o,$(libpthread_libc_CSRC)) |
| 62 | libc-static-y += $(libpthread_OUT)/libc_pthread_init.o |
| 63 | libc-shared-y += $(libpthread_libc_OBJ:.o=.oS) |
| 64 | |
| 65 | libpthread-static-y += $(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpthread_SPEC_SRC)) |
| 66 | libpthread-shared-y += $(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.oS,$(libpthread_SPEC_SRC)) |
| 67 | |
| 68 | ifeq ($(DOPIC),y) |
| 69 | libpthread-a-y += $(libpthread_OBJ:.o=.os) $(libpthread-static-y:.o=.os) |
| 70 | else |
| 71 | libpthread-a-y += $(libpthread_OBJ) $(libpthread-static-y) |
| 72 | endif |
| 73 | libpthread-so-y += $(libpthread_OBJ:.o=.os) $(libpthread-shared-y) |
| 74 | |
| 75 | lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a |
| 76 | lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so |
| 77 | |
| 78 | #ifeq ($(DOMULTI),n) |
| 79 | $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend) |
| 80 | $(call link.so,$(libpthread_FULL_NAME),$(ABI_VERSION)) |
| 81 | #else |
| 82 | #$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread.oS | $(libc.depend) |
| 83 | # $(call linkm.so,$(libpthread_FULL_NAME),$(ABI_VERSION)) |
| 84 | #endif |
| 85 | |
| 86 | ifeq ($(PTHREADS_DEBUG_SUPPORT),y) |
| 87 | $(libpthread_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug) |
| 88 | endif |
| 89 | $(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y) |
| 90 | $(Q)$(RM) $@ |
| 91 | $(do_ar) |
| 92 | |
| 93 | ifeq ($(PTHREADS_DEBUG_SUPPORT),y) |
| 94 | $(libpthread_OUT)/libpthread.oS: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug) |
| 95 | endif |
| 96 | $(libpthread_OUT)/libpthread.oS: $(libpthread_SRC) $(libpthread_SPEC_SRC) |
| 97 | $(Q)$(RM) $@ |
| 98 | $(compile-m) |
| 99 | |
| 100 | ifeq ($(PTHREADS_DEBUG_SUPPORT),y) |
| 101 | $(top_builddir)lib/libpthread.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug) |
| 102 | endif |
| 103 | $(top_builddir)lib/libpthread.a: $(libpthread-a-y) |
| 104 | $(Q)$(INSTALL) -d $(dir $@) |
| 105 | $(Q)$(RM) $@ |
| 106 | $(do_ar) |
| 107 | |
| 108 | $(top_builddir)include/pthread.h: |
| 109 | $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@ |
| 110 | $(top_builddir)include/semaphore.h: |
| 111 | $(do_ln) $(call rel_srcdir)$(PTDIR)/$(@F) $@ |
| 112 | $(top_builddir)include/bits/pthreadtypes.h: | $(top_builddir)include/bits |
| 113 | $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/bits/$(@F) $@ |
| 114 | |
| 115 | linuxthreads_headers := $(top_builddir)include/pthread.h \ |
| 116 | $(top_builddir)include/semaphore.h \ |
| 117 | $(top_builddir)include/bits/pthreadtypes.h |
| 118 | $(linuxthreads_headers): $(wildcard $(addprefix $(top_builddir)include/config/linuxthreads/,old.h new.h)) |
| 119 | headers-$(UCLIBC_HAS_THREADS) += $(linuxthreads_headers) |
| 120 | |
| 121 | objclean-y += CLEAN_libpthread/linuxthreads.old |
| 122 | headers_clean-y += HEADERCLEAN_libpthread/linuxthreads.old |
| 123 | HEADERCLEAN_libpthread/linuxthreads.old: |
| 124 | $(do_rm) $(linuxthreads_headers) |
| 125 | |
| 126 | CLEAN_libpthread/linuxthreads.old: |
| 127 | $(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a) |