Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. TOPDIR=../../
  2. include $(TOPDIR)Rules.mak
  3. # Check if 'ls -sh' works or not
  4. LSFLAGS = $(shell if ls -sh >/dev/null 2>&1; \
  5. then echo "-sh"; else echo "-s" ; fi)
  6. #XCFLAGS = -Wall -Os -fomit-frame-pointer -fno-builtin -nostdinc \
  7. # -I$(TOPDIR)include -I/usr/include/linux
  8. #XLDFLAGS = -nostdlib -s -gc-sections
  9. STRIPTOOL=/bin/true
  10. XCFLAGS = -Wall -g -fno-builtin -nostdinc \
  11. -I$(TOPDIR)include -I/usr/include/linux
  12. XLDFLAGS = -nostdlib -gc-sections
  13. EXTRA_LIBS=$(TOPDIR)libc.a -lgcc
  14. YCFLAGS = -Wall -Os -fomit-frame-pointer
  15. YLDFLAGS = -s --static
  16. TARGETS=string string_glibc
  17. TARGETS+=testcopy testcopy_glibc
  18. TARGETS+=strerror strsignal
  19. all: $(TARGETS)
  20. string: string.c Makefile $(TOPDIR)libc.a
  21. -@ echo "-------"
  22. -@ echo " "
  23. -@ echo "Compiling vs uClibc: "
  24. -@ echo " "
  25. $(CC) $(XCFLAGS) -c $< -o $@.o
  26. $(CC) $(XLDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
  27. $(STRIPTOOL) -x -R .note -R .comment $@
  28. -./$@
  29. -@ echo " "
  30. string_glibc: string.c Makefile $(TOPDIR)libc.a
  31. -@ echo "-------"
  32. -@ echo " "
  33. -@ echo "Compiling vs GNU libc: "
  34. -@ echo " "
  35. $(CC) $(YCFLAGS) -c $< -o $@.o
  36. $(CC) $(YLDFLAGS) --static $@.o -o $@
  37. $(STRIPTOOL) -x -R .note -R .comment $@
  38. -./$@
  39. -@ echo " "
  40. testcopy: testcopy.c Makefile $(TOPDIR)libc.a
  41. -@ echo "-------"
  42. -@ echo " "
  43. -@ echo "Compiling vs uClibc: "
  44. -@ echo " "
  45. $(CC) $(XCFLAGS) -c $< -o $@.o
  46. $(CC) $(XLDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
  47. $(STRIPTOOL) -x -R .note -R .comment $@
  48. -./$@ > testcopy.out
  49. -@ echo " "
  50. testcopy_glibc: testcopy.c Makefile $(TOPDIR)libc.a
  51. -@ echo "-------"
  52. -@ echo " "
  53. -@ echo "Compiling vs GNU libc: "
  54. -@ echo " "
  55. $(CC) $(YCFLAGS) -c $< -o $@.o
  56. $(CC) $(YLDFLAGS) --static $@.o -o $@
  57. $(STRIPTOOL) -x -R .note -R .comment $@
  58. -./$@ > testcopy.gnu.out
  59. -@ echo " "
  60. testcopy_diff: testcopy testcopy_glibc
  61. -@ echo "-------"
  62. -@ echo " "
  63. -@ echo "Diffing output: "
  64. -@ echo " "
  65. -diff -u testcopy.gnu.out testcopy.out
  66. -@ echo " "
  67. strerror: ../../string/strerror.c
  68. -@ echo "-------"
  69. -@ echo " "
  70. -@ echo "Compiling vs uClibc: "
  71. -@ echo " "
  72. $(CC) $(XCFLAGS) -DCHECK_BUF -c $< -o $@.o
  73. $(CC) $(XLDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
  74. $(STRIPTOOL) -x -R .note -R .comment $@
  75. -./$@
  76. -@ echo " "
  77. strsignal: ../../string/strsignal.c
  78. -@ echo "-------"
  79. -@ echo " "
  80. -@ echo "Compiling vs uClibc: "
  81. -@ echo " "
  82. $(CC) $(XCFLAGS) -DCHECK_BUF -c $< -o $@.o
  83. $(CC) $(XLDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
  84. $(STRIPTOOL) -x -R .note -R .comment $@
  85. -./$@
  86. -@ echo " "
  87. clean:
  88. rm -f *.[oa] *~ core $(TARGETS) testcopy.gnu.out testcopy.out