Makefile 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # Makefile for uClibc's pthread library
  2. #
  3. # Copyright (C) 2002 Erik Andersen <andersen@uclibc.org>
  4. # Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
  5. #
  6. # This program is free software; you can redistribute it and/or modify it under
  7. # the terms of the GNU Library General Public License as published by the Free
  8. # Software Foundation; either version 2 of the License, or (at your option) any
  9. # later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but WITHOUT
  12. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13. # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
  14. # details.
  15. #
  16. # You should have received a copy of the GNU Library General Public License
  17. # along with this program; if not, write to the Free Software Foundation, Inc.,
  18. # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. # Makefile for uClibc
  20. TOPDIR=../../
  21. include $(TOPDIR)Rules.mak
  22. # As long as there is only one subdir, we don't
  23. # have to worry about race conditions with multiple
  24. # $(AR)'s in subdirs running on linuxthreads.a.
  25. DIRS = sysdeps
  26. #Adjust the soname version to avoid namespace collisions with glibc's libpthread
  27. LIBPTHREAD:=../libpthread.a
  28. ifeq ($(strip $(TARGET_ARCH)),sparc)
  29. SYSDEPS_DIR:=$(TARGET_ARCH)/sparc32
  30. else
  31. SYSDEPS_DIR:=$(TARGET_ARCH)
  32. endif
  33. CFLAGS += $(SSP_ALL_CFLAGS)
  34. #This stuff will not compile without at least -O1
  35. CFLAGS :=$(CFLAGS:-O0=-O1)
  36. # set up system dependencies include dirs (NOTE: order matters!)
  37. PTDIR = $(TOPDIR)libpthread/linuxthreads/
  38. SYSDEPINC = -I$(PTDIR)sysdeps/pthread \
  39. -I$(PTDIR)sysdeps/$(TARGET_ARCH) \
  40. -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH)
  41. CFLAGS += $(SYSDEPINC)
  42. CSRC=attr.c cancel.c condvar.c errno.c events.c join.c lockfile.c manager.c \
  43. mutex.c oldsemaphore.c pt-machine.c ptfork.c pthread.c \
  44. ptlongjmp.c rwlock.c semaphore.c signals.c specific.c spinlock.c \
  45. wrapsyscall.c
  46. ifeq ($(UCLIBC_HAS_XLOCALE),y)
  47. CSRC += locale.c
  48. endif
  49. COBJS=$(patsubst %.c,%.o, $(CSRC))
  50. OBJS=$(COBJS)
  51. # We need to make sure that we put all the top-level $(OBJS) into
  52. # our archive before executing subdirs. That way, when $(AR) is
  53. # run in the subdirs, it'll bump the generic top-level objects
  54. # out of our archive in favor of the machine-specific ones.
  55. all: $(LIBPTHREAD) subdirs
  56. $(LIBPTHREAD) ar-target: $(OBJS)
  57. $(AR) $(ARFLAGS) $(LIBPTHREAD) $(OBJS)
  58. $(COBJS): %.o : %.c
  59. $(CC) $(CFLAGS) -c $< -o $@
  60. ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
  61. $(STRIPTOOL) -X --strip-debug -R .note -R .comment $*.o
  62. else
  63. $(STRIPTOOL) -x -R .note -R .comment $*.o
  64. endif
  65. clean: subdirs_clean
  66. $(RM) *.[oa] *~ core
  67. subdirs: $(patsubst %, _dir_%, $(DIRS))
  68. subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
  69. $(patsubst %, _dir_%, $(DIRS)): $(LIBPTHREAD)
  70. $(MAKE) -C $(patsubst _dir_%, %, $@)
  71. $(patsubst %, _dirclean_%, $(DIRS)):
  72. $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
  73. .PHONY: dummy