Makefile 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. export
  2. ifneq ($(shell uname -s),Linux)
  3. $(shell echo "Please execute this script under Linux")
  4. exit
  5. endif
  6. # The version-release used for package
  7. export PKG_VSN := $(shell git describe --tags --always)
  8. ifneq ($(shell cat /etc/*-release |grep -o -i centos),)
  9. ID := centos
  10. VERSION_ID := $(shell rpm --eval '%{centos_ver}')
  11. else
  12. ID := $(shell sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g' | sed 's/"//g' )
  13. VERSION_ID := $(shell sed -n '/^VERSION_ID=/p' /etc/os-release | sed -r 's/VERSION_ID=(.*)/\1/g' | sed 's/"//g')
  14. endif
  15. SYSTEM := $(shell echo $(ID)$(VERSION_ID) | sed -r "s/([a-zA-Z]*)-.*/\1/g")
  16. ##
  17. ## Support RPM and Debian based linux systems
  18. ##
  19. ifeq ($(ID),ubuntu)
  20. PKGERDIR := deb
  21. else ifeq ($(ID),debian)
  22. PKGERDIR := deb
  23. else ifeq ($(ID),raspbian)
  24. PKGERDIR := deb
  25. else
  26. PKGERDIR := rpm
  27. endif
  28. .PHONY: all
  29. all: clean
  30. $(if $(PKGERDIR),,$(error "Operating system '$(OS)' not supported"))
  31. cd $(PKGERDIR) && $(MAKE)
  32. clean:
  33. rm -rf package
  34. make -C rpm clean
  35. make -C deb clean
  36. .PHONY: deb
  37. deb:
  38. make -C deb
  39. .PHONY: rpm
  40. rpm:
  41. make -C rpm