Makefile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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=hello_source hello hello_glibc
  13. all: $(TARGETS)
  14. hello_source:
  15. -@ rm -f $(TARGETS)
  16. -@ echo "-------"
  17. -@ echo "hello.c source: "
  18. -@ echo " "
  19. -@ cat hello.c
  20. -@ echo " "
  21. hello: hello.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. $(STRIPTOOL) -x -R .note -R .comment $@
  29. -ldd $@
  30. ls $(LSFLAGS) $@
  31. -./$@
  32. -@ echo " "
  33. hello_glibc: hello.c Makefile $(TOPDIR)libc.a
  34. -@ echo "-------"
  35. -@ echo " "
  36. -@ echo "Compiling vs GNU libc: "
  37. -@ echo " "
  38. $(CC) $(YCFLAGS) -c $< -o $@.o
  39. $(CC) $(YLDFLAGS) --static $@.o -o $@
  40. $(STRIPTOOL) -x -R .note -R .comment $@
  41. -ldd $@
  42. ls $(LSFLAGS) $@
  43. -./$@
  44. -@ echo " "
  45. clean:
  46. rm -f *.[oa] *~ core $(TARGETS)