1 |
1325 |
phoenix |
# Makefile for uClibc's pthread library
|
2 |
|
|
#
|
3 |
|
|
# Copyright (C) 2002 Erik Andersen
|
4 |
|
|
#
|
5 |
|
|
# This program is free software; you can redistribute it and/or modify it under
|
6 |
|
|
# the terms of the GNU Library General Public License as published by the Free
|
7 |
|
|
# Software Foundation; either version 2 of the License, or (at your option) any
|
8 |
|
|
# later version.
|
9 |
|
|
#
|
10 |
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
11 |
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
12 |
|
|
# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
|
13 |
|
|
# details.
|
14 |
|
|
#
|
15 |
|
|
# You should have received a copy of the GNU Library General Public License
|
16 |
|
|
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
17 |
|
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
18 |
|
|
|
19 |
|
|
TOPDIR=../
|
20 |
|
|
include $(TOPDIR)Rules.mak
|
21 |
|
|
|
22 |
|
|
#Adjust the soname version to avoid namespace collisions with glibc's libpthread
|
23 |
|
|
LIBPTHREAD=libpthread.a
|
24 |
|
|
LIBPTHREAD_SHARED=libpthread.so
|
25 |
|
|
LIBPTHREAD_SHARED_FULLNAME=libpthread-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
|
26 |
|
|
|
27 |
|
|
LIBTHREAD_DB=libthread_db.a
|
28 |
|
|
LIBTHREAD_DB_SHARED=libthread_db.so
|
29 |
|
|
LIBTHREAD_DB_SHARED_FULLNAME=libthread_db-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
|
30 |
|
|
|
31 |
|
|
DIRS=
|
32 |
|
|
ifeq ($(strip $(UCLIBC_HAS_THREADS)),y)
|
33 |
|
|
DIRS+=linuxthreads
|
34 |
|
|
LDFLAGS_PTHREADS:= $(LDFLAGS)
|
35 |
|
|
ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
|
36 |
|
|
DIRS+=linuxthreads_db
|
37 |
|
|
LDFLAGS_PTHREADS:= $(CPU_LDFLAGS-y) -shared --warn-common --warn-once -z combreloc
|
38 |
|
|
endif
|
39 |
|
|
endif
|
40 |
|
|
|
41 |
|
|
ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
|
42 |
|
|
ifeq ($(strip $(DOPIC)),y)
|
43 |
|
|
START_FILES = $(TOPDIR)lib/crti.o $(LIBGCC_DIR)crtbeginS.o
|
44 |
|
|
END_FILES = $(LIBGCC_DIR)crtendS.o $(TOPDIR)lib/crtn.o
|
45 |
|
|
else
|
46 |
|
|
START_FILES = $(TOPDIR)lib/crti.o $(LIBGCC_DIR)crtbegin.o
|
47 |
|
|
END_FILES = $(LIBGCC_DIR)crtend.o $(TOPDIR)lib/crtn.o
|
48 |
|
|
endif
|
49 |
|
|
endif
|
50 |
|
|
|
51 |
|
|
ALL_SUBDIRS = linuxthreads linuxthreads_db
|
52 |
|
|
|
53 |
|
|
all: $(LIBPTHREAD) $(LIBTHREAD_DB)
|
54 |
|
|
|
55 |
|
|
$(LIBPTHREAD): subdirs
|
56 |
|
|
@if [ -f $(LIBPTHREAD) ] ; then \
|
57 |
|
|
set -e; \
|
58 |
|
|
$(INSTALL) -d $(TOPDIR)lib; \
|
59 |
|
|
$(RM) $(TOPDIR)lib/$(LIBPTHREAD); \
|
60 |
|
|
$(INSTALL) -m 644 $(LIBPTHREAD) $(TOPDIR)lib; \
|
61 |
|
|
fi;
|
62 |
|
|
|
63 |
|
|
$(LIBTHREAD_DB): subdirs
|
64 |
|
|
@if [ -f $(LIBTHREAD_DB) ] ; then \
|
65 |
|
|
set -e; \
|
66 |
|
|
$(INSTALL) -d $(TOPDIR)lib; \
|
67 |
|
|
$(RM) $(TOPDIR)lib/$(LIBTHREAD_DB); \
|
68 |
|
|
$(INSTALL) -m 644 $(LIBTHREAD_DB) $(TOPDIR)lib; \
|
69 |
|
|
fi;
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
$(OBJS): %.o : %.c
|
73 |
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
74 |
|
|
$(STRIPTOOL) -x -R .note -R .comment $*.o
|
75 |
|
|
|
76 |
|
|
$(OBJ): Makefile
|
77 |
|
|
|
78 |
|
|
shared: all
|
79 |
|
|
if [ -f $(LIBPTHREAD) ] ; then \
|
80 |
|
|
set -e; \
|
81 |
|
|
$(LD) $(LDFLAGS_PTHREADS) -soname=$(LIBPTHREAD_SHARED).$(MAJOR_VERSION) \
|
82 |
|
|
-o $(LIBPTHREAD_SHARED_FULLNAME) $(START_FILES) --whole-archive $(LIBPTHREAD) \
|
83 |
|
|
--no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
|
84 |
|
|
-L$(TOPDIR)lib -lc $(END_FILES); \
|
85 |
|
|
$(INSTALL) -d $(TOPDIR)lib; \
|
86 |
|
|
$(RM) $(TOPDIR)lib/$(LIBPTHREAD_SHARED_FULLNAME) \
|
87 |
|
|
$(TOPDIR)lib/$(LIBPTHREAD_SHARED).$(MAJOR_VERSION); \
|
88 |
|
|
$(INSTALL) -m 644 $(LIBPTHREAD_SHARED_FULLNAME) $(TOPDIR)lib; \
|
89 |
|
|
$(LN) -sf $(LIBPTHREAD_SHARED_FULLNAME) \
|
90 |
|
|
$(TOPDIR)lib/$(LIBPTHREAD_SHARED); \
|
91 |
|
|
$(LN) -sf $(LIBPTHREAD_SHARED_FULLNAME) \
|
92 |
|
|
$(TOPDIR)lib/$(LIBPTHREAD_SHARED).$(MAJOR_VERSION); \
|
93 |
|
|
fi;
|
94 |
|
|
if [ -f $(LIBTHREAD_DB) ] ; then \
|
95 |
|
|
set -e; \
|
96 |
|
|
$(LD) $(LDFLAGS) -soname=$(LIBTHREAD_DB_SHARED).1 \
|
97 |
|
|
-o $(LIBTHREAD_DB_SHARED_FULLNAME) $(START_FILES) --whole-archive $(LIBTHREAD_DB) \
|
98 |
|
|
--no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
|
99 |
|
|
-L$(TOPDIR)lib -lc $(END_FILES); \
|
100 |
|
|
$(INSTALL) -d $(TOPDIR)lib; \
|
101 |
|
|
$(RM) $(TOPDIR)lib/$(LIBTHREAD_DB_SHARED_FULLNAME) \
|
102 |
|
|
$(TOPDIR)lib/$(LIBTHREAD_DB_SHARED).$(MAJOR_VERSION); \
|
103 |
|
|
$(INSTALL) -m 644 $(LIBTHREAD_DB_SHARED_FULLNAME) $(TOPDIR)lib; \
|
104 |
|
|
$(LN) -sf $(LIBTHREAD_DB_SHARED_FULLNAME) \
|
105 |
|
|
$(TOPDIR)lib/$(LIBTHREAD_DB_SHARED); \
|
106 |
|
|
$(LN) -sf $(LIBTHREAD_DB_SHARED_FULLNAME) \
|
107 |
|
|
$(TOPDIR)lib/$(LIBTHREAD_DB_SHARED).1; \
|
108 |
|
|
fi;
|
109 |
|
|
|
110 |
|
|
tags:
|
111 |
|
|
ctags -R
|
112 |
|
|
|
113 |
|
|
subdirs: $(patsubst %, _dir_%, $(DIRS))
|
114 |
|
|
subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
|
115 |
|
|
|
116 |
|
|
$(patsubst %, _dir_%, $(DIRS)) : dummy
|
117 |
|
|
$(MAKE) -C $(patsubst _dir_%, %, $@)
|
118 |
|
|
|
119 |
|
|
$(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
|
120 |
|
|
$(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
|
121 |
|
|
|
122 |
|
|
clean: subdirs_clean
|
123 |
|
|
$(RM) *.[oa] *~ core $(LIBPTHREAD) $(LIBPTHREAD_SHARED_FULLNAME) \
|
124 |
|
|
$(LIBTHREAD_DB) $(LIBTHREAD_DB_SHARED_FULLNAME)
|
125 |
|
|
|
126 |
|
|
.PHONY: dummy
|