Makefile 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. check_defined = \
  2. $(foreach 1,$1,$(__check_defined))
  3. __check_defined = \
  4. $(if $(value $1),, \
  5. $(error Undefined $1$(if $(value 2), ($(strip $2)))))
  6. OSRAW=$(shell lsb_release -si)
  7. OS=$(shell echo $(OSRAW) | tr A-Z a-z)
  8. ARCH=$(shell uname -m | sed 's/x86_//;s/i[3-6]86/32/')
  9. OSVERRAW=$(shell lsb_release -sr)
  10. ifeq ($(ARCH),64)
  11. REPOARCH=amd64
  12. endif
  13. ifeq ($(ARCH),32)
  14. REPOARCH=i386
  15. endif
  16. #ifeq ($(OS),ubuntu)
  17. # OSVER=$(shell echo $(OSVERRAW) | sed 's/\.//g')
  18. #else
  19. # OSVER=$(OSVERRAW)
  20. #endif
  21. OSVER=$(OSVERRAW)
  22. all: showvars getbinaries
  23. # $(call check_defined, SOURCES_VERSION)
  24. # tar xvf squid-$(SOURCES_VERSION)-$(ARCH)-bin.tar.xz
  25. echo "ALL FINISHED"
  26. showvars:
  27. echo "SHOWVARS"
  28. @echo $(OSRAW)
  29. @echo $(OS)
  30. @echo $(ARCH)
  31. @echo $(OSVERRAW)
  32. @echo $(OSVER)
  33. getbinaries: showvars
  34. $(call check_defined, SOURCES_VERSION)
  35. wget http://moodle.ngtech.co.il/redwood/redwood-$(SOURCES_VERSION).tar.xz \
  36. -O redwood-$(SOURCES_VERSION).tar.xz
  37. echo "FINISHED getbinaries"
  38. install:
  39. $(call check_defined, SOURCES_VERSION)
  40. $(call check_defined, DESTDIR)
  41. mkdir -p $(DESTDIR)
  42. tar xvf redwood-$(SOURCES_VERSION).tar.xz -C $(DESTDIR)/
  43. mkdir -p $(DESTDIR)/usr/sbin/
  44. ifeq ($(ARCH),64)
  45. cp $(DESTDIR)/bin/redwood_linux_amd64 $(DESTDIR)/usr/sbin/redwood
  46. endif
  47. ifeq ($(ARCH),32)
  48. cp $(DESTDIR)/bin/redwood_linux_386 $(DESTDIR)/usr/sbin/redwood
  49. endif
  50. rm -rf $(DESTDIR)/bin
  51. tar xvf redwood-conf-init.tar.xz -C $(DESTDIR)/
  52. chown -R root:root $(DESTDIR)/
  53. # The next are only if the data was extracted into the current directory.
  54. # rsync -av usr -C $(DESTDIR)/
  55. # rsync -av etc -C $(DESTDIR)/
  56. # rsync -av var -C $(DESTDIR)/
  57. clean:
  58. $(call check_defined, DESTDIR)
  59. $(call check_defined, SOURCES_VERSION)
  60. rm $(DESTDIR)/usr/ -rf
  61. rm $(DESTDIR)/var/ -rf
  62. rm $(DESTDIR)/etc/ -rf
  63. rm redwood-$(SOURCES_VERSION).tar.xz -rf
  64. echo "clean"
  65. distclean:
  66. rm -rf ./debian/redwood/
  67. $(MAKE) clean
  68. echo "distclean"
  69. builddeb:
  70. $(call check_defined, SOURCES_VERSION)
  71. cd debian && bash arch.sh reset && bash redwood-version.sh reset
  72. cd debian && bash arch.sh && bash redwood-version.sh
  73. dpkg-buildpackage -us -uc
  74. cd debian && bash arch.sh reset && bash redwood-version.sh reset
  75. $(MAKE) distclean