Guest User

Untitled

a guest
Jan 22nd, 2018
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. Makefile - Statically build websites using Webmake
  2. # :Author: Arun Suresh
  3. # :Contact: tarunshrivatsav@gmail.com
  4.  
  5. RST_FILES = $(shell find $(SRC_DIR) -name "*.rst")
  6. HTML_FILES = $(RST_FILES:.rst=.html)
  7.  
  8. # This is so we can remove the space in the "relative" function. Make strips
  9. # out whitespace everywhere, so you need to hack to get a literal space in the
  10. # "subst" function.
  11. space :=
  12. space +=
  13.  
  14. # Creates a relative link to $(3) relative to $(1) from $(2)
  15. relative = $(subst $(space),,$(foreach x,$(subst /,\ ,$(patsubst $(2)/%,%,$(dir $(1)))),../))$(notdir $(3))
  16.  
  17. .PHONY: all clean distclean
  18.  
  19. all: $(HTML_FILES)
  20.  
  21. $(HTML_FILES): $(MORE_DEPS)
  22.  
  23. %.html: %.rst
  24. @echo $< "->" $@
  25. @$(WEBMAKE_DIR)/webmake -ts --link-stylesheet \
  26. $(foreach x, $(EXTENSIONS), --extension $(x)) \
  27. $(if $(STYLESHEET),--stylesheet=$(call relative,$<,$(SRC_DIR),$(STYLESHEET))) \
  28. $< $@
  29.  
  30. clean:
  31.  
  32. distclean: clean
  33. -rm $(HTML_FILES)
Add Comment
Please, Sign In to add comment