Makefile 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # -*- coding: utf-8; tab-width: 4 -*-
  2. # vim: ts=4 noet ai
  3. # Part of Rainbow Persona
  4. # Copyright © 2016 Desktopd Project
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as
  8. # published by the Free Software Foundation, either version 3 of the
  9. # License, or (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. # Basic options
  19. addon_ext = .xpi
  20. git_command = git
  21. net_access_delay = 5
  22. # Silent rules resembling Automake
  23. default_verbosity = 0
  24. V_at = $(v_at_$(V))
  25. v_at_ = $(v_at_$(default_verbosity))
  26. v_at_0 = @
  27. v_at_1 =
  28. V_XPI = $(v_xpi_$(V))
  29. v_xpi_ = $(v_xpi_$(default_verbosity))
  30. v_xpi_0 = @echo ' XPI ' $@;
  31. v_xpi_1 =
  32. # Important paths
  33. builds_dir = ./builds
  34. src_dir = ./src
  35. version_info_path = ./version_info
  36. git_submodule_jpm_sh = ./tools/jpm.sh
  37. addon_path = $(builds_dir)/latest
  38. all: addon
  39. .PHONY: all addon git-submodule git-submodule-check deps deps-check \
  40. $(addon_path) clean distclean
  41. addon: deps-check $(addon_path)
  42. $(addon_path):
  43. $(V_at)$(V_XPI)( \
  44. [ "$(V_at)" ] && export JPM_SILENT=1 ;\
  45. buildDir=$(builds_dir)/`date +%s` ;\
  46. rmdir $(builds_dir)/* >/dev/null 2>&1 ;\
  47. mkdir -p "$$buildDir" ;\
  48. addonName=`$(git_submodule_jpm_sh)/bin/jpm-build.sh printPkgName 3>&1 > "$$buildDir/build.zip"` ;\
  49. mv "$$buildDir/build.zip" "$$buildDir/$$addonName$(addon_ext)" ;\
  50. cd $(builds_dir)/ ;\
  51. rm -f ./latest ;\
  52. ln -fs "`basename "$$buildDir"`" ./latest ;\
  53. )
  54. deps: git-submodule
  55. deps-check: git-submodule-check
  56. git-submodule-check:
  57. @[ -d $(git_submodule_jpm_sh)/bin ] || { echo "Run 'make deps' first!" ; false ;}
  58. git-submodule:
  59. @echo "Git will access online repositories!!!"
  60. @echo "Interrupt within $(net_access_delay) seconds if you are not ready..."
  61. sleep $(net_access_delay)
  62. @echo "Now invoking Git!"
  63. $(git_command) submodule update --init --recursive