Makefile (1195B)
1 # 2 HTML:=$(patsubst %.md,%.html,$(wildcard *.md)) 3 MULTIMARKDOWN:=$(or $(shell which multimarkdown 2> /dev/null),$(wildcard ~/bin/multimarkdown)) 4 5 ifeq ($(MULTIMARKDOWN),) 6 all: 7 @echo multimarkdown not found 8 else 9 all: $(HTML) 10 @echo SUCCESS 11 endif 12 13 %.html: %.md Makefile history.log.txt 14 $(MULTIMARKDOWN) $< -o $@ 15 ifeq ("$(REFRESH)","1") 16 sed -i "/meta charset/a <meta http-equiv=\"refresh\" content=\"1\">" $@ 17 endif 18 19 %.pdf: %.md Makefile history.log.txt 20 $(MULTIMARKDOWN) -b -t odf $< -o $@ 21 22 history.log.txt: Makefile 23 echo "Последние 3 изменения " > $@ 24 echo "" >> $@ 25 export PP=`pwd`; [ -f ../config ] && cd ..; git log --max-count=3 --stat --name-only >> $${PP}/$@ 26 sed -i 's/\([a-zA-Z].*\)\.md$$/[\1](\1)/;/commit\|Author/d' $@ 27 # sed -i 's/\([a-zA-Z].*\)\.md$$/[\1](\1)/;/commit\|Author\|Date/a\ ' $@ 28 29 clean: 30 rm -rf *.html history.log.txt 31 32 -include config.make 33 34 ifneq ("$(RSYNC_URL)","") 35 RSYNC_CMD = rsync -avP --delete --del *.html *.css *.png *.img $(RSYNC_URL) 36 endif 37 38 live: 39 inotifywait -m -e modify --exclude "./sed*" . | \ 40 while read a b c; do \ 41 case "$$b$$c" in \ 42 MODIFY*.md) make REFRESH=1; $(RSYNC_CMD);; \ 43 esac \ 44 done ; true 45 46 47