Makefile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. FRESH_NAME=fresh
  2. FRESH_VERSION=1.1.0
  3. DEB_VERSION=-4-ppa1
  4. FRESH_SUFFIX=.tar.gz
  5. FRESH_LIB=$(FRESH_NAME)-$(FRESH_VERSION)
  6. FRESH_LIB_SRC=$(FRESH_LIB)-src
  7. DEB_FRESH_LIB=$(FRESH_NAME)_$(FRESH_VERSION)
  8. FRESH_FILE=$(FRESH_LIB).tar.gz
  9. FRESH_SRC_ARCHIVE=$(FRESH_LIB_SRC)$(FRESH_SUFFIX)
  10. DEF_FRESH_ORIG_ARCHIVE=$(DEB_FRESH_LIB)-4.orig$(FRESH_SUFFIX)
  11. NATIVE_DIST=$(shell lsb_release -cs)
  12. ifeq ($(shell whoami),a)
  13. NAME=Andrei Kopats
  14. EMAIL=hlamer@tut.by
  15. PPA=monkeystudio/ppa
  16. else
  17. NAME=Filipe Azevedo
  18. EMAIL=pasnox@gmail.com
  19. PPA=pasnox/ppa
  20. endif
  21. DEBNAME=$(NAME)
  22. DEBFULLNAME=$(NAME)
  23. DEBEMAIL=$(EMAIL)
  24. DISTS = precise oneiric natty maverick lucid
  25. all: help
  26. #
  27. # Help
  28. #
  29. help:
  30. @echo 'Top level targets:'
  31. @echo ' dput-all Build and put all to launchpad'
  32. @echo ' clean Remove all created files'
  33. @echo
  34. @echo 'For debugging:'
  35. @echo ' not-signed-all Build source packages for all distributions. Not signed'
  36. @echo ' signed-all Build source packages for all distributions. Signed'
  37. @echo ' dput-{distrib} Build and put package for particular distribution to launchpad'
  38. @echo ' native-build Build source and binary package for local PC distribution. Not signed'
  39. @echo ' build-{distrib} Prepare directory with sources and debian files'
  40. @echo ' dput Put source package to PPA'
  41. @echo ' native-build Build .deb package on the current system (no chroot). For testing'
  42. @echo
  43. @echo 'Supported distribs are:' $(DISTS)
  44. #
  45. # Prepare sources
  46. #
  47. $(FRESH_SRC_ARCHIVE):
  48. cd .. && git archive --prefix=$(DEB_FRESH_LIB)/ new-deb-package | gzip -9 > debian/$@
  49. build-%: $(FRESH_SRC_ARCHIVE)
  50. mkdir -p $@
  51. cd $@ && tar -xf ../$(FRESH_SRC_ARCHIVE)
  52. ln -s $(PWD)/$(FRESH_SRC_ARCHIVE) $@/$(DEF_FRESH_ORIG_ARCHIVE)
  53. mkdir $@/$(DEB_FRESH_LIB)/debian
  54. cp -R debian-common/* $@/$(DEB_FRESH_LIB)/debian
  55. if [ -d debian-$* ]; then \
  56. cp -R debian-$*/* $@/$(DEB_FRESH_LIB)/debian; \
  57. fi
  58. sed -i 's/PUT_SERIES_HERE_WITH_SED/$*/g' $@/$(DEB_FRESH_LIB)/debian/changelog
  59. #
  60. # Build source package
  61. #
  62. build-%/$(DEB_FRESH_LIB)$(DEB_VERSION).dsc: build-%
  63. cd build-$*/$(DEB_FRESH_LIB) && debuild -S -uc -us
  64. not-signed-all: $(foreach dist,$(DISTS),build-$(dist) build-$(dist)/$(DEB_FRESH_LIB)$(DEB_VERSION).dsc)
  65. signed-%: build-% build-%/$(DEB_FRESH_LIB)$(DEB_VERSION).dsc
  66. cd build-$* && debsign *.changes
  67. signed-all: $(foreach dist,$(DISTS),build-$(dist) signed-$(dist));
  68. dput-%: signed-%
  69. cd build-$* && dput ppa:$(PPA) $(DEB_FRESH_LIB)*source.changes
  70. dput-all: $(foreach dist,$(DISTS),dput-$(dist));
  71. #
  72. # Build package.
  73. # For testing. Release package is built on launchpad
  74. #
  75. native-build: build-$(NATIVE_DIST)
  76. cd build-$(NATIVE_DIST)/$(DEB_FRESH_LIB) && debuild -uc -us -b
  77. #
  78. # Clean
  79. #
  80. clean:
  81. -rm -rf build-*
  82. -rm $(FRESH_SRC_ARCHIVE)