Source files of fsfe.org, pdfreaders.org, freeyourandroid.org, ilovefs.org, drm.info, and test.fsfe.org. Contribute: https://fsfe.org/contribute/web/ https://fsfe.org
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.
 
 
 
 
 
 

145 lines
5.7 KiB

  1. # -----------------------------------------------------------------------------
  2. # Makefile for FSFE website build, phase 1
  3. # -----------------------------------------------------------------------------
  4. # This Makefile is executed in the root of the source directory tree, and
  5. # creates some .xml and xhtml files as well as some symlinks, all of which
  6. # serve as input files in phase 2. The whole phase 1 runs within the source
  7. # directory tree and does not touch the target directory tree at all.
  8. # -----------------------------------------------------------------------------
  9. .PHONY: all .FORCE
  10. .FORCE:
  11. # This will be overwritten in the command line running this Makefile.
  12. build_env = development
  13. # -----------------------------------------------------------------------------
  14. # Update CSS files
  15. # -----------------------------------------------------------------------------
  16. # This step recompiles the less files into the final CSS files to be
  17. # distributed to the web server.
  18. ifneq ($(build_env),development)
  19. all: look/fsfe.min.css look/valentine.min.css
  20. look/%.min.css: $(shell find "look" -name '*.less')
  21. echo "* Compiling $@"
  22. lessc "look/$*.less" -x "$@"
  23. endif
  24. # -----------------------------------------------------------------------------
  25. # Update XSL stylesheets
  26. # -----------------------------------------------------------------------------
  27. # This step updates (actually: just touches) all XSL files which depend on
  28. # another XSL file that has changed since the last build run. The phase 2
  29. # Makefile then only has to consider the directly used stylesheet as a
  30. # prerequisite for building each file and doesn't have to worry about other
  31. # stylesheets imported into that one.
  32. # This must run before the "dive into subdirectories" step, because in the news
  33. # and events directories, the XSL files, if updated, will be copied for the
  34. # per-year archives.
  35. .PHONY: stylesheets
  36. all: stylesheets
  37. stylesheets: $(SUBDIRS)
  38. tools/update_stylesheets.sh
  39. # -----------------------------------------------------------------------------
  40. # Dive into subdirectories
  41. # -----------------------------------------------------------------------------
  42. SUBDIRS := $(shell find */* -name "Makefile" | xargs dirname)
  43. all: $(SUBDIRS)
  44. $(SUBDIRS): .FORCE
  45. echo "* Preparing subdirectory $@"
  46. $(MAKE) --silent --directory=$@
  47. # -----------------------------------------------------------------------------
  48. # Create XML symlinks
  49. # -----------------------------------------------------------------------------
  50. # After this step, the following symlinks will exist:
  51. # * global/data/texts/.texts.<lang>.xml for each language
  52. # * ./fundraising.<lang>.xml for each language
  53. # Each of these symlinks will point to the corresponding file without a dot at
  54. # the beginning of the filename, if present, and to the English version
  55. # otherwise. This symlinks make sure that phase 2 can easily use the right file
  56. # for each language, also as a prerequisite in the Makefile.
  57. LANGUAGES := $(shell ls -xw0 global/languages)
  58. TEXTS_LINKS := $(foreach lang,$(LANGUAGES),global/data/texts/.texts.$(lang).xml)
  59. all: $(TEXTS_LINKS)
  60. global/data/texts/.texts.%.xml: .FORCE
  61. if [ -f global/data/texts/texts.$*.xml ]; then \
  62. ln -sf texts.$*.xml $@; \
  63. else \
  64. ln -sf texts.en.xml $@; \
  65. fi
  66. FUNDRAISING_LINKS := $(foreach lang,$(LANGUAGES),.fundraising.$(lang).xml)
  67. all: $(FUNDRAISING_LINKS)
  68. .fundraising.%.xml: .FORCE
  69. if [ -f fundraising.$*.xml ]; then \
  70. ln -sf fundraising.$*.xml $@; \
  71. else \
  72. ln -sf fundraising.en.xml $@; \
  73. fi
  74. # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  75. # The following steps are handled in an external script, because the list of
  76. # files to generate is not known when the Makefile starts - some new tags might
  77. # be introduced when generating the .xml files in the news/* subdirectories.
  78. # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  79. # -----------------------------------------------------------------------------
  80. # Create XSL symlinks
  81. # -----------------------------------------------------------------------------
  82. # After this step, each directory with source files for HTML pages contains a
  83. # symlink named .default.xsl and pointing to the default.xsl "responsible" for
  84. # this directory. These symlinks make it easier for the phase 2 Makefile to
  85. # determine which XSL script should be used to build a HTML page from a source
  86. # file.
  87. .PHONY: default_xsl
  88. all: default_xsl
  89. default_xsl:
  90. tools/update_defaultxsls.sh
  91. # -----------------------------------------------------------------------------
  92. # Update local menus
  93. # -----------------------------------------------------------------------------
  94. # After this step, all .localmenu.??.xml files will be up to date.
  95. .PHONY: localmenus
  96. all: localmenus
  97. localmenus: $(SUBDIRS)
  98. tools/update_localmenus.sh
  99. # -----------------------------------------------------------------------------
  100. # Update XML filelists
  101. # -----------------------------------------------------------------------------
  102. # After this step, the following files will be up to date:
  103. # * tags/tagged-<tags>.en.xhtml for each tag used. Apart from being
  104. # automatically created, these are regular source files for HTML pages, and
  105. # in phase 2 are built into pages listing all news items and events for a
  106. # tag.
  107. # * tags/.tags.??.xml with a list of the tags useed.
  108. # * <dir>/.<base>.xmllist for each <dir>/<base>.sources as well as for each
  109. # tags/tagged-<tags>.en.xhtml. These files are used in phase 2 to include the
  110. # correct XML files when generating the HTML pages. It is taken care that
  111. # these files are only updated whenever their content actually changes, so
  112. # they can serve as a prerequisite in the phase 2 Makefile.
  113. .PHONY: xmllists
  114. all: xmllists
  115. xmllists: $(SUBDIRS)
  116. tools/update_xmllists.sh