github.com/xiaq/elvish@v0.12.0/website/Makefile (about)

     1  PUBLISH_DIR := ./publish
     2  
     3  MDS := $(wildcard src/*.md src/*/*.md)
     4  HTMLS := $(MDS:.md=.html)
     5  
     6  TOOL_SOURCES := $(wildcard *.go)
     7  TOOL_BINARIES := $(TOOL_SOURCES:.go=.tool)
     8  
     9  default: gen
    10  
    11  %.html: %.md $(TOOL_BINARIES) md-to-html
    12  	./md-to-html $< $@
    13  
    14  %.tool: %.go
    15  	go build -o $@ $<
    16  
    17  # Generates the website into the dst directory.
    18  gen: $(HTMLS) maybe-genblog
    19  	genblog src dst
    20  	ln -sf `pwd`/assets dst/
    21  	ln -sf `pwd`/favicons/* dst/
    22  
    23  # Installs genblog only if not found.
    24  maybe-genblog:
    25  	which genblog || make genblog
    26  
    27  # Installs latest genblog.
    28  genblog:
    29  	go get -u github.com/xiaq/genblog
    30  	genblog -print-default-css > assets/genblog.css
    31  
    32  # Copies the generated website into $(PUBLISH_DIR).
    33  publish: gen
    34  	rsync -aLv --delete ./dst/ $(PUBLISH_DIR)/
    35  
    36  clean:
    37  	rm -f $(HTMLS) $(TOOL_BINARIES)
    38  
    39  .PHONY: default gen maybe-genblog genblog publish clean
    40  .SECONDARY: $(TOOL_BINARIES)