summaryrefslogtreecommitdiffstats
path: root/libpthread/nptl/sysdeps/pthread/Makefile
blob: 0f03668e1f1c62c7387d90298be120a8d586be01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Makefile for uClibc NPTL pthread library (pthread)
#
# Copyright (C) 2005 Steven J. Hill <sjhill@realitydiluted.com>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Library General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
# details.
#
# You should have received a copy of the GNU Library General Public License
# along with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Makefile for uClibc

TOPDIR=../../../../
include $(TOPDIR)Rules.mak
include ../../Rules.mak

#
# NOTE: glibc puts flockfile.c, ftrylockfile.c, funlockfile.c, and
#       pt-longjmp.c in libc and libpthread. For uClibc, they are
#       in libc only.
#
CSRC = pthread_barrier_wait.c pthread_cond_broadcast.c pthread_cond_signal.c \
       pthread_cond_timedwait.c pthread_cond_wait.c pthread_getcpuclockid.c  \
       pthread_once.c pthread_rwlock_rdlock.c pthread_rwlock_timedrdlock.c   \
       pthread_rwlock_timedwrlock.c pthread_rwlock_unlock.c		     \
       pthread_rwlock_wrlock.c pthread_sigmask.c pthread_spin_destroy.c      \
       pthread_spin_init.c pthread_spin_unlock.c sigaction.c		     \
       sigfillset.c sigprocmask.c unwind-forcedunwind.c

CFLAGS-pthread_barrier_wait.c = -D_GNU_SOURCE
CFLAGS-pthread_spin_destroy.c = -D_GNU_SOURCE
CFLAGS-pthread_spin_init.c = -D_GNU_SOURCE
CFLAGS-pthread_spin_unlock.c = -D_GNU_SOURCE
CFLAGS-sigaction.c = -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH) \
		     -I$(TOPDIR)libc/signal
CFLAGS-sigfillset.c = -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH) \
		      -I$(TOPDIR)libc/signal
CFLAGS-sigprocmask.c = -I$(TOPDIR)libc/sysdeps/linux/common

AR_LIBP_COBJS = $(patsubst %.c, %.o, $(CSRC))
SO_LIBP_COBJS = $(patsubst %.c, %.os, $(CSRC))

ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
all: $(AR_LIB_NAME) $(AR_SO_LIB_NAME) crti.o crtn.o
else
all: $(AR_LIB_NAME) $(AR_SO_LIB_NAME)
endif

$(AR_LIB_NAME): $(AR_LIBP_COBJS)
ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
	$(STRIPTOOL) -X --strip-debug -R .note -R .comment $(AR_LIBP_COBJS)
else
	$(STRIPTOOL) -x -R .note -R .comment $(AR_LIBP_COBJS)
endif
	$(AR) $(ARFLAGS) $(AR_LIB_NAME) $(AR_LIBP_COBJS)

$(AR_SO_LIB_NAME): $(SO_LIBP_COBJS)
ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
	$(STRIPTOOL) -X --strip-debug -R .note -R .comment $(SO_LIBP_COBJS)
else
	$(STRIPTOOL) -x -R .note -R .comment $(SO_LIBP_COBJS)
endif
	$(AR) $(ARFLAGS) $(AR_SO_LIB_NAME) $(SO_LIBP_COBJS)

$(AR_LIBP_COBJS): %.o : %.c
	$(CC) $(CFLAGS-LIBP) $(CFLAGS-$<) -c $< -o $@

$(SO_LIBP_COBJS): %.os : %.c
	$(CC) $(CFLAGS-LIBP) $(CFLAGS-$<) -DSHARED -c $< -o $@

pt-initfini.s: pt-initfini.c
	$(CC) -S $(CFLAGS-LIBP) -g0 -fPIC -fno-inline-functions		\
		$(call check_gcc,-fno-unit-at-a-time,)			\
		-finhibit-size-directive				\
		$(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,))	\
		$< -o $@

crti.S: pt-initfini.s
	sed -n -e '1,/@HEADER_ENDS/p' \
	       -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
	       -e '/@TRAILER_BEGINS/,$$p' $< > $@

crtn.S: pt-initfini.s
	sed -n -e '1,/@HEADER_ENDS/p' \
	       -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
	       -e '/@TRAILER_BEGINS/,$$p' $< > $@

defs.h: pt-initfini.s defs.awk
	sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
		awk -f defs.awk > $@

crti.o: crti.S defs.h
	$(CC) -g0 $(ASFLAGS-LIBC) -c $< -o $@

crtn.o: crtn.S defs.h
	$(CC) -g0 $(ASFLAGS-LIBC) -c $< -o $@

clean:
	$(RM) *.o *.os *.s crt* *~ core defs.h

.PHONY: $(AR_LIB_NAME) $(AR_SO_LIB_NAME)