Makefile 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
  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. TOPDIR=../../../../
  19. include $(TOPDIR)Rules.mak
  20. CSRC= waitpid.c getdnnm.c gethstnm.c getcwd.c \
  21. mkfifo.c setegid.c wait.c getpagesize.c seteuid.c \
  22. wait3.c setpgrp.c getdtablesize.c create_module.c ptrace.c \
  23. cmsg_nxthdr.c longjmp.c open64.c ftruncate64.c \
  24. truncate64.c getrlimit64.c setrlimit64.c creat64.c mmap64.c \
  25. llseek.c pread_write.c _exit.c setuid.c sync.c getdirname.c \
  26. sendfile64.c xstatconv.c getdents.c getdents64.c
  27. ifneq ($(strip $(EXCLUDE_BRK)),y)
  28. CSRC+=sbrk.c
  29. endif
  30. COBJS=$(patsubst %.c,%.o, $(CSRC))
  31. MSRC=syscalls.c
  32. MOBJ=$(shell ./list_syscalls.sh)
  33. CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
  34. SAFECFLAGS=$(XWARNINGS) $(OPTIMIZATION) $(XARCH_CFLAGS) $(CPU_CFLAGS) -fno-builtin
  35. ifeq ($(strip $(DOPIC)),y)
  36. SAFECFLAGS+=-fPIC
  37. endif
  38. OBJ=$(COBJS) $(MOBJ)
  39. all: $(STR_SYSCALLS) $(OBJ) $(LIBC)
  40. $(LIBC): ar-target
  41. ar-target: $(OBJ) $(CTOR_TARGETS)
  42. $(AR) $(ARFLAGS) $(LIBC) $(OBJ)
  43. $(MOBJ): $(MSRC)
  44. $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
  45. $(STRIPTOOL) -x -R .note -R .comment $*.o
  46. $(COBJS): %.o : %.c
  47. $(CC) $(CFLAGS) -c $< -o $@
  48. $(STRIPTOOL) -x -R .note -R .comment $*.o
  49. ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
  50. initfini.S: initfini.c
  51. $(CC) $(SAFECFLAGS) -I$(TOPDIR)include -c initfini.c -S -o initfini.S
  52. crti.S crtn.S: initfini.S $(TOPDIR)/extra/scripts/initfini.awk
  53. $(AWK) -f $(TOPDIR)extra/scripts/initfini.awk initfini.S
  54. crti.o: crti.S
  55. $(CC) $(SAFECFLAGS) -c crti.S -o crti.o
  56. $(TOPDIR)lib/crti.o: crti.o
  57. mkdir -p $(TOPDIR)lib/
  58. cp crti.o $(TOPDIR)lib/
  59. crtn.o: crtn.S
  60. $(CC) $(SAFECFLAGS) -c crtn.S -o crtn.o
  61. $(TOPDIR)lib/crtn.o: crtn.o
  62. mkdir -p $(TOPDIR)lib/
  63. cp crtn.o $(TOPDIR)lib/
  64. else
  65. crti.o:
  66. mkdir -p $(TOPDIR)lib/
  67. $(AR) $(ARFLAGS) $(TOPDIR)lib/crti.o
  68. crtn.o:
  69. mkdir -p $(TOPDIR)lib/
  70. $(AR) $(ARFLAGS) $(TOPDIR)lib/crtn.o
  71. endif
  72. clean:
  73. rm -f *.[oa] *~ core crt[in].* *.S