Makefile 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # In order to build a copy of Oddmuse with all the version numbers, use:
  2. # make build. This creates modified copies of the files in the build
  3. # subdirectory.
  4. VERSION_NO=$(shell git describe --tags)
  5. TRANSLATIONS=$(wildcard modules/translations/[a-z]*-utf8.pl$)
  6. MODULES=$(wildcard modules/*.pl)
  7. BUILD=build/wiki.pl $(foreach file, $(notdir $(MODULES)) $(notdir $(TRANSLATIONS)), build/$(file))
  8. # PREPARE/BUILD: this creates copies of wiki.pl and all the modules
  9. # and translations in the build subdirectory. These copies all contain
  10. # a reference to the revision they were created from (git describe
  11. # --tags).
  12. prepare: build $(BUILD)
  13. build:
  14. mkdir -p build
  15. clean:
  16. rm -rf build
  17. prove t/setup.pl
  18. release:
  19. perl stuff/release ~/oddmuse.org
  20. build/wiki.pl: wiki.pl
  21. perl -lne "s/(\\\$$q->a\(\{-href=>'http:\/\/www.oddmuse.org\/'\}, 'Oddmuse'\))/\\\$$q->a({-href=>'http:\/\/git.savannah.gnu.org\/cgit\/oddmuse.git\/tag\/?id=$(VERSION_NO)'}, 'wiki.pl') . ' ($(VERSION_NO)), see ' . \$$1/; print" < $< > $@
  22. build/%-utf8.pl: modules/translations/%-utf8.pl
  23. perl -lne "s/(AddModuleDescription\('[^']+', '[^']+')\)/\$$1, 'translations\/', '$(VERSION_NO)')/; print" < $< > $@
  24. build/national-%.pl: modules/translations/national-%.pl
  25. perl -lne "s/(AddModuleDescription\('[^']+', '[^']+')\)/\$$1, 'translations\/', '$(VERSION_NO)')/; print" < $< > $@
  26. build/month-names-%.pl: modules/translations/month-names-%.pl
  27. perl -lne "s/(AddModuleDescription\('[^']+', '[^']+')\)/\$$1, 'translations\/', '$(VERSION_NO)')/; print" < $< > $@
  28. # from: http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/namespaces.pl
  29. # to: http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/namespaces.pl?id=2.1-11-gd4f1e27
  30. build/%.pl: modules/%.pl
  31. perl -lne "s/(AddModuleDescription\('[^']+', '[^']+')\)/\$$1, undef, '$(VERSION_NO)')/; print" < $< > $@
  32. modules/translations/new-utf8.pl: wiki.pl $(MODULES)
  33. cp $@ $@-old
  34. perl stuff/oddtrans -l $@-old wiki.pl $(MODULES) > $@
  35. rm -f $@-old
  36. translations: $(TRANSLATIONS)
  37. for f in $^; do \
  38. echo updating $$f...; \
  39. perl stuff/oddtrans -l $$f wiki.pl $(MODULES) > $$f-new && mv $$f-new $$f; \
  40. done
  41. # Running four jobs in parallel, but clean up data directories without
  42. # race conditions!
  43. jobs ?= 4
  44. test:
  45. prove t/setup.pl
  46. prove --jobs=$(jobs) --state=slow,save t