rules 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #! /usr/bin/make -f
  2. #
  3. # debian/rules
  4. # Part of Debian ‘jquery-throttle-debounce’ package.
  5. #
  6. # Copyright © 2008–2016 Ben Finney <ben+debian@benfinney.id.au>
  7. #
  8. # This is free software; you may copy, modify, and/or distribute this
  9. # work under the terms of the GNU General Public License as published
  10. # by the Free Software Foundation; version 3 of that License or later.
  11. # No warranty expressed or implied.
  12. # See the file '/usr/share/common-licenses/GPL-3' for details.
  13. JAVASCRIPT_NAMES = \
  14. jquery.ba-throttle-debounce
  15. SOURCE_DIR = $(CURDIR)
  16. JAVASCRIPT_SUFFIX = .js
  17. COMPILED_JAVASCRIPT_SUFFIX = .min${JAVASCRIPT_SUFFIX}
  18. javascript_files = $(addsuffix ${JAVASCRIPT_SUFFIX},${javascript_names})
  19. compiled_javascript_files = $(addsuffix ${COMPILED_JAVASCRIPT_SUFFIX},\
  20. ${JAVASCRIPT_NAMES})
  21. compiled_javascript_paths = $(addprefix ${SOURCE_DIR}/,\
  22. ${compiled_javascript_files})
  23. GENERATED_FILES += ${compiled_javascript_files}
  24. MINIFY = uglifyjs
  25. %:
  26. dh $@
  27. .PHONY: get-packaged-orig-source
  28. get-packaged-orig-source:
  29. $(uscan-download-source) --download-current-version
  30. # Policy §4.9 strongly recommends the ‘get-orig-source’ target:
  31. # “This target is optional, but providing it if possible is a good idea.”
  32. #
  33. # This target is an anomaly: per Policy §4.9, it fetches the *latest*
  34. # upstream source, regardless of this package's version. To fetch the
  35. # upstream source corresponding to this package's *declared* version
  36. # in ‘debian/changelog’, use ‘get-packaged-orig-source’ instead.
  37. .PHONY: get-orig-source
  38. get-orig-source:
  39. $(uscan-download-source)
  40. get-orig-source get-packaged-orig-source: http_proxy =
  41. get-orig-source get-packaged-orig-source: makefile_dir = $(abspath $(dir $(firstword ${MAKEFILE_LIST})))
  42. get-orig-source get-packaged-orig-source: package_dir = $(abspath $(dir ${makefile_dir}))
  43. define uscan-download-source
  44. uscan --noconf --verbose \
  45. --force-download \
  46. --rename \
  47. --destdir=$(CURDIR) \
  48. --check-dirname-level=0 ${package_dir}
  49. endef # uscan-download-source
  50. .PHONY: override_dh_auto_build
  51. override_dh_auto_build: minify-javascript
  52. .PHONY: minify-javascript
  53. minify-javascript: ${compiled_javascript_paths}
  54. %${COMPILED_JAVASCRIPT_SUFFIX}: %${JAVASCRIPT_SUFFIX}
  55. $(MINIFY) -o "$@" "$<"
  56. .PHONY: override_dh_clean
  57. override_dh_clean:
  58. dh_clean
  59. $(RM) -r ${GENERATED_FILES}
  60. # Local variables:
  61. # coding: utf-8
  62. # mode: makefile
  63. # End:
  64. # vim: fileencoding=utf-8 filetype=make :