Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. EXTRA_LIBS=$(TOPDIR)libc.a -lgcc
  10. YCFLAGS = -Wall -Os -fomit-frame-pointer
  11. YLDFLAGS = -s --static
  12. TARGETS=testmalloc testmalloc_glibc
  13. TARGETS=mallocbug mallocbug_glibc
  14. TARGETS+=teststrtol teststrtol_glibc teststrtol_diff
  15. all: $(TARGETS)
  16. testmalloc_source:
  17. -@ echo "-------"
  18. -@ echo "testmalloc.c source: "
  19. -@ echo " "
  20. -@ cat testmalloc.c
  21. -@ echo " "
  22. testmalloc: testmalloc.c Makefile $(TOPDIR)libc.a
  23. -@ echo "-------"
  24. -@ echo " "
  25. -@ echo "Compiling vs uClibc: "
  26. -@ echo " "
  27. $(CC) $(XCFLAGS) -c $< -o $@.o
  28. $(CC) $(XLDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
  29. $(STRIPTOOL) -x -R .note -R .comment $@
  30. -ldd $@
  31. ls $(LSFLAGS) $@
  32. -./$@
  33. -@ echo " "
  34. testmalloc_glibc: testmalloc.c Makefile $(TOPDIR)libc.a
  35. -@ echo "-------"
  36. -@ echo " "
  37. -@ echo "Compiling vs GNU libc: "
  38. -@ echo " "
  39. $(CC) $(YCFLAGS) -c $< -o $@.o
  40. $(CC) $(YLDFLAGS) --static $@.o -o $@
  41. $(STRIPTOOL) -x -R .note -R .comment $@
  42. -ldd $@
  43. ls $(LSFLAGS) $@
  44. -./$@
  45. -@ echo " "
  46. mallocbug: mallocbug.c Makefile $(TOPDIR)libc.a
  47. -@ echo "-------"
  48. -@ echo " "
  49. -@ echo "Compiling vs uC-Libc: "
  50. -@ echo " "
  51. $(CC) $(XCFLAGS) -c $< -o $@.o
  52. $(CC) $(XLDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
  53. $(STRIPTOOL) -x -R .note -R .comment $@
  54. -ldd $@
  55. ls $(LSFLAGS) $@
  56. -./$@
  57. -@ echo " "
  58. mallocbug_glibc: mallocbug.c Makefile $(TOPDIR)libc.a
  59. -@ echo "-------"
  60. -@ echo " "
  61. -@ echo "Compiling vs GNU libc: "
  62. -@ echo " "
  63. $(CC) $(YCFLAGS) -c $< -o $@.o
  64. $(CC) $(YLDFLAGS) --static $@.o -o $@
  65. $(STRIPTOOL) -x -R .note -R .comment $@
  66. -ldd $@
  67. ls $(LSFLAGS) $@
  68. -./$@
  69. -@ echo " "
  70. teststrtol_source:
  71. -@ echo "-------"
  72. -@ echo "teststrtol.c source: "
  73. -@ echo " "
  74. -@ cat teststrtol.c
  75. -@ echo " "
  76. teststrtol: teststrtol.c Makefile $(TOPDIR)libc.a
  77. -@ echo "-------"
  78. -@ echo " "
  79. -@ echo "Compiling vs uC-Libc: "
  80. -@ echo " "
  81. $(CC) $(XCFLAGS) -c $< -o $@.o
  82. $(CC) $(XLDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
  83. $(STRIPTOOL) -x -R .note -R .comment $@
  84. -ldd $@
  85. ls -sh $@
  86. -./$@ > $@.out
  87. -@ echo " "
  88. teststrtol_glibc: teststrtol.c Makefile $(TOPDIR)libc.a
  89. -@ echo "-------"
  90. -@ echo " "
  91. -@ echo "Compiling vs GNU libc: "
  92. -@ echo " "
  93. $(CC) $(YCFLAGS) -c $< -o $@.o
  94. $(CC) $(YLDFLAGS) --static $@.o -o $@
  95. $(STRIPTOOL) -x -R .note -R .comment $@
  96. -ldd $@
  97. ls -sh $@
  98. -./$@ > $@.out
  99. -@ echo " "
  100. teststrtol_diff: teststrtol_glibc teststrtol
  101. -@ echo "-------"
  102. -@ echo " "
  103. -@ echo "Diffing output: "
  104. -@ echo " "
  105. -diff -u teststrtol_glibc.out teststrtol.out
  106. -@ echo " "
  107. clean:
  108. rm -f *.[oa] *~ core $(TARGETS) teststrtol_glibc.out teststrtol.out