Makefile 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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
  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=string string_glibc
  18. TARGETS+=testcopy testcopy_glibc
  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. -./$@
  28. -@ echo " "
  29. string_glibc: string.c Makefile $(TOPDIR)libc.a
  30. -@ echo "-------"
  31. -@ echo " "
  32. -@ echo "Compiling vs GNU libc: "
  33. -@ echo " "
  34. $(CC) $(YCFLAGS) -c $< -o $@.o
  35. $(CC) $(YLDFLAGS) --static $@.o -o $@
  36. -./$@
  37. -@ echo " "
  38. testcopy: testcopy.c Makefile $(TOPDIR)libc.a
  39. -@ echo "-------"
  40. -@ echo " "
  41. -@ echo "Compiling vs uCLibc: "
  42. -@ echo " "
  43. $(CC) $(XCFLAGS) -c $< -o $@.o
  44. $(CC) $(XLDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
  45. -./$@ > testcopy.out
  46. -@ echo " "
  47. testcopy_glibc: testcopy.c Makefile $(TOPDIR)libc.a
  48. -@ echo "-------"
  49. -@ echo " "
  50. -@ echo "Compiling vs GNU libc: "
  51. -@ echo " "
  52. $(CC) $(YCFLAGS) -c $< -o $@.o
  53. $(CC) $(YLDFLAGS) --static $@.o -o $@
  54. -./$@ > testcopy.gnu.out
  55. -@ echo " "
  56. testcopy_diff: testcopy testcopy_glibc
  57. -@ echo "-------"
  58. -@ echo " "
  59. -@ echo "Diffing output: "
  60. -@ echo " "
  61. -diff -u testcopy.gnu.out testcopy.out
  62. -@ echo " "
  63. clean:
  64. rm -f *.[oa] *~ core $(TARGETS)