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.

33 lines
1.1KB

  1. XSL_STYLESHEET := xhtml2xml.xsl
  2. # For a correct generation of the link, use full path from this directory
  3. FILES := ../news/*/*.xhtml ../projects/*/*.xhtml
  4. # Trying to keep things readable
  5. ACTUAL_PREREQUISITE = ../$$(echo $* | sed -e 's,___,/,g').xhtml
  6. FIND_XHTML = ../$$(echo $$FILE | sed -e 's,___,/,g').xhtml
  7. TRANSFORM = xsltproc --stringparam link $$(echo $$FILE | sed -e 's,\.\.,,' | sed -e 's,..\.xhtml,html,') $(XSL_STYLESHEET) $$FILE > $@
  8. # Select files
  9. sources := $(shell grep -l "<html newsdate" $(FILES))
  10. all_xmls := $(notdir $(basename $(wildcard ./generated_xml/*.xml)))
  11. # Create targets
  12. first_step = $(subst /,___, $(subst ../,, $(sources)))
  13. too_xml := $(addprefix ./generated_xml/, $(first_step:.xhtml=.xml))
  14. .PHONY: all
  15. all: $(too_xml) remove_artifacts
  16. generated_xml/%.xml: $(sources)
  17. for FILE in $?; do if [ "$$FILE" = "$(ACTUAL_PREREQUISITE)" ]; then $(TRANSFORM); else touch $@ ; fi; done
  18. # Remove xml files for files thas are no longer in CVS
  19. .PHONY: remove_artifacts
  20. remove_artifacts:
  21. for FILE in $(all_xmls); do if [ ! -f $(FIND_XHTML) ]; then rm generated_xml/$$FILE.xml ; fi ; done