Makefile 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. # Allow alternative stripping tools to be used...
  13. ifndef $(STRIPTOOL)
  14. STRIPTOOL = strip
  15. endif
  16. STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $@
  17. TARGETS=test_pwd test_pwd_glibc
  18. TARGETS+=test_grp test_grp_glibc
  19. TARGETS+=test_pwd_diff test_grp_diff
  20. all: $(TARGETS)
  21. test_pwd: test_pwd.c Makefile $(TOPDIR)libc.a
  22. -@ echo "-------"
  23. -@ echo " "
  24. -@ echo "Compiling vs uCLibc: "
  25. -@ echo " "
  26. $(CC) $(XCFLAGS) -c $< -o $@.o
  27. $(CC) $(XLDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
  28. -./$@ 2>&1 >test_pwd.out
  29. -@ echo " "
  30. test_pwd_glibc: test_pwd.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. -./$@ 2>&1 >test_pwd_glibc.out
  38. -@ echo " "
  39. test_grp: test_grp.c Makefile $(TOPDIR)libc.a
  40. -@ echo "-------"
  41. -@ echo " "
  42. -@ echo "Compiling vs uCLibc: "
  43. -@ echo " "
  44. $(CC) $(XCFLAGS) -c $< -o $@.o
  45. $(CC) $(XLDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
  46. -./$@ 2>&1 >test_grp.out
  47. -@ echo " "
  48. test_grp_glibc: test_grp.c Makefile $(TOPDIR)libc.a
  49. -@ echo "-------"
  50. -@ echo " "
  51. -@ echo "Compiling vs GNU libc: "
  52. -@ echo " "
  53. $(CC) $(YCFLAGS) -c $< -o $@.o
  54. $(CC) $(YLDFLAGS) --static $@.o -o $@
  55. -./$@ 2>&1 >test_grp_glibc.out
  56. -@ echo " "
  57. test_pwd_diff: test_pwd_glibc test_pwd
  58. -@ echo "-------"
  59. -@ echo " "
  60. -@ echo "Diffing output: "
  61. -@ echo " "
  62. -diff -u test_pwd_glibc.out test_pwd.out
  63. -@ echo " "
  64. test_grp_diff: test_grp_glibc test_grp
  65. -@ echo "-------"
  66. -@ echo " "
  67. -@ echo "Diffing output: "
  68. -@ echo " "
  69. -diff -u test_grp_glibc.out test_grp.out
  70. -@ echo " "
  71. clean:
  72. rm -f *.[oa] *~ core $(TARGETS) *.out