Source files of fsfe.org, pdfreaders.org, freeyourandroid.org, ilovefs.org, drm.info, and test.fsfe.org. Contribute: https://fsfe.org/contribute/web/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. .PHONY: all .FORCE
  2. .FORCE:
  3. all:
  4. # -----------------------------------------------------------------------------
  5. # Dive into subdirectories
  6. # -----------------------------------------------------------------------------
  7. SUBDIRS := $(shell find */* -name "Makefile" | xargs dirname)
  8. $(SUBDIRS): .FORCE
  9. $(MAKE) -j -k -C $@ || true
  10. all: $(SUBDIRS)
  11. # -----------------------------------------------------------------------------
  12. # Handle local menus
  13. # -----------------------------------------------------------------------------
  14. MENUSOURCES := $(shell find -name '*.xhtml' |xargs grep -l '<localmenu.*</localmenu>' )
  15. localmenuinfo.en.xml: ./tools/buildmenu.xsl $(MENUSOURCES)
  16. { printf '<localmenuset>'; \
  17. grep -E '<localmenu.*</localmenu>' $^ \
  18. | sed -r 's;(.*/)?(.+)\.([a-z][a-z])\.xhtml:(.+);\
  19. <menuitem language="\3"><dir>/\1</dir><link>\2.html</link>\4</menuitem>;'; \
  20. printf '</localmenuset>'; \
  21. } | xsltproc -o $@ $< -
  22. all: localmenuinfo.en.xml
  23. # -----------------------------------------------------------------------------
  24. # Timestamp files for regular jobs and XML inclusion in various places
  25. # -----------------------------------------------------------------------------
  26. YEAR := <?xml version="1.0" encoding="utf-8"?><dateset><date year="$(shell date +%Y)" /></dateset>
  27. MONTH := <?xml version="1.0" encoding="utf-8"?><dateset><date month="$(shell date +%Y-%m)" /></dateset>
  28. DAY := <?xml version="1.0" encoding="utf-8"?><dateset><date day="$(shell date +%Y-%m-%d)" /></dateset>
  29. d_day.en.xml: $(if $(findstring $(DAY),$(shell cat d_day.en.xml)),,.FORCE)
  30. printf %s\\n '$(DAY)' >$@
  31. d_month.en.xml: $(if $(findstring $(MONTH),$(shell cat d_month.en.xml)),,.FORCE)
  32. printf %s\\n '$(MONTH)' >$@
  33. d_year.en.xml: $(if $(findstring $(YEAR),$(shell cat d_year.en.xml)),,.FORCE)
  34. printf %s\\n '$(YEAR)' >$@
  35. all: d_year.en.xml d_month.en.xml d_day.en.xml
  36. # -----------------------------------------------------------------------------
  37. # Update .sources files
  38. # -----------------------------------------------------------------------------
  39. # use shell globbing to work around faulty globbing in gnu make
  40. SOURCEDIRS = $(shell sed -rn 's;^(.*/)[^/]*:(\[\]|global)$$;\1;gp' $@ \
  41. | while read glob; do \
  42. printf '%s\n' $$glob; \
  43. done \
  44. )
  45. SOURCEREQS = $(shell ./build/source_globber.sh sourceglobs $@ |sed -r 's;$$;.??.xml;g')
  46. all: $(shell find ./ -name '*.sources')
  47. # -----------------------------------------------------------------------------
  48. # generate tag maps
  49. # -----------------------------------------------------------------------------
  50. TAGMAP := $(shell find $(PWD) -name '*.xml' \
  51. | xargs ./build/source_globber.sh map_tags \
  52. )
  53. TAGNAMES := $(shell printf %s '$(TAGMAP)' \
  54. | cut -d" " -f2- \
  55. | tr ' ' '\n' \
  56. | grep -vE '[\$%/:()]' \
  57. | sort -u \
  58. )
  59. MAPNAMES := $(shell printf 'tools/tagmaps/%s.map ' $(TAGNAMES))
  60. INDEXNAMES := $(shell printf 'tags/tagged-%s.en.xhtml ' $(TAGNAMES))
  61. INDEXSOURCES := $(shell printf 'tags/tagged-%s.sources ' $(TAGNAMES))
  62. all: $(INDEXNAMES)
  63. tags/tagged-%.en.xhtml: tags/tagged.en.xhtml
  64. cp $< $@
  65. all: $(INDEXSOURCES)
  66. tags/tagged-%.sources:
  67. printf '%s:[$*]\n' 'news/*/news' news/generated_xml/ news/nl/nl 'events/*/event' >$@
  68. printf 'd_day:[]' >>$@
  69. MAPREQS = $(shell printf %s '$(TAGMAP)' \
  70. | sed -r 's;[^ ]+\...\.xml;\n&;g' \
  71. | grep ' $*' \
  72. | cut -d' ' -f1 \
  73. )
  74. all: $(MAPNAMES)
  75. # -----------------------------------------------------------------------------
  76. # Second Expansion rules
  77. # -----------------------------------------------------------------------------
  78. .SECONDEXPANSION:
  79. %.sources: $$(SOURCEDIRS) $$(SOURCEREQS) | $(MAPNAMES) $(INDEXSOURCES)
  80. touch $@
  81. tools/tagmaps/%.map: $$(MAPREQS) | $(SUBDIRS)
  82. printf '%s\n' $^ > $@