alexkarle.com

Source for alexkarle.com
git clone git://git.alexkarle.com/alexkarle.com.git
Log | Files | Refs | README | LICENSE

Makefile (1751B) [raw]


      1 # alexkarle.com makefile
      2 DESTDIR = /var/www/htdocs
      3 CFLAGS = -g -O2 -Wall -Wpedantic -Wextra
      4 
      5 # Variables used to determine what to build (and clean)
      6 HTML != echo www/*.txt www/blog/*.txt | sed 's@\([^\.]*\)\.txt@\1.html@g'
      7 SETS != find www/jam-tuesday -name '[0-9][0-9][0-9][0-9]-*'
      8 NOTES != find gopher/notes/all
      9 PHLOG != find gopher/phlog
     10 
     11 BUILT = $(HTML) \
     12 	gopher/notes/index.gph \
     13 	gopher/phlog/atom.xml \
     14 	www/atom.xml
     15 
     16 # Top level targets
     17 .PHONY: build
     18 build: $(BUILT)
     19 
     20 .PHONY: jams
     21 jams: gopher/jam-tuesday/stats www/jam-tuesday/index.html
     22 
     23 .PHONY: install
     24 install: build
     25 	pax -rw www $(DESTDIR)
     26 	pax -rw gopher $(DESTDIR)
     27 	install -m 444 $(SETS) $(DESTDIR)/gopher/jam-tuesday
     28 	install -m 444 LICENSE $(DESTDIR)/gopher
     29 	install -m 444 www/blog/*.txt www/atom.xml $(DESTDIR)/gopher/blog
     30 	install -m 444 gopher/bin/* $(DESTDIR)/gopher/code
     31 	for d in jam-tuesday code; do \
     32 		(cat gopher/$$d/index.gph; \
     33 		 gopher/bin/dirlist $(DESTDIR)/gopher/$$d)\
     34 		 > $(DESTDIR)/gopher/$$d/index.gph; \
     35 	done
     36 	(cat gopher/blog/index.gph; gopher/bin/blogidx.sh) > $(DESTDIR)/gopher/blog/index.gph
     37 	gzip -k -f $(DESTDIR)/www/*.html $(DESTDIR)/www/*/*.html
     38 
     39 .PHONY: clean
     40 clean:
     41 	rm -f $(BUILT)
     42 
     43 # Individual files to build
     44 gopher/jam-tuesday/stats: $(SETS) bin/jam-stats.sh
     45 	(date; echo; ./bin/jam-stats.sh -f) > $@
     46 
     47 www/jam-tuesday/index.html: $(SETS) bin/jam-index.sh bin/jam-stats.sh
     48 	./bin/jam-index.sh > $@
     49 
     50 www/atom.xml: $(HTML) bin/genatom.sh
     51 	./bin/genatom.sh > $@
     52 
     53 gopher/notes/index.gph: $(NOTES)
     54 	(cd gopher/notes && ../bin/notetag) > $@
     55 
     56 gopher/phlog/atom.xml: $(PHLOG) gopher/bin/gophatom.sh
     57 	./gopher/bin/gophatom.sh > $@
     58 
     59 # Inference rules (*.txt -> *.html)
     60 $(HTML): Makefile bin/genpage
     61 
     62 .SUFFIXES: .txt .html
     63 .txt.html:
     64 	./bin/genpage $< > $@