<commit_before>#-  GNU Makefile

#-  Makefile ~~
#
#   To-do:
#   -   When deploying to CouchDB, run cleanup/compaction routines also.
#
#                                                       ~~ (c) SRW, 26 Mar 2012

include $(PWD)/tools/macros.make

CAT         :=  $(call contingent, gcat cat)
CD          :=  $(call contingent, cd)
CONVERT     :=  $(call contingent, convert)                     #-  ImageMagick
CP          :=  $(call contingent, gcp cp) -rf
CURL        :=  $(call contingent, curl)
GIT         :=  $(call contingent, git)
LS          :=  $(call contingent, gls ls) 2>/dev/null
MKDIR       :=  $(call contingent, gmkdir mkdir)
PDFCROP     :=  $(call contingent, pdfcrop)                     #-  TeX Live
PDFLATEX    :=  $(call contingent, pdflatex) -no-shell-escape   #-  TeX Live
QRENCODE    :=  $(call contingent, qrencode) --8bit --level=H
RM          :=  $(call contingent, grm rm) -rf
SED         :=  $(call contingent, gsed sed)
SORT        :=  $(call contingent, gsort sort)
XARGS       :=  $(call contingent, xargs)

APPS    :=  $(shell $(LS) templates)

.PHONY: all clean clobber distclean help reset
.SILENT: ;

'': help;

all: $(APPS)

clean: reset

clobber: clean
	@   $(RM) apps/ build/ share/

distclean: clobber
	@   $(RM) .d8_history deps/ .v8_history

help:
	@   printf '%s\n' 'Usage: $(MAKE) [options] [target] ...'       ;   \
            printf '%s\n' '  where "high-level" targets include'        ;   \
            $(SED) -n 's/^.PHONY:\([^$$]*\)$$/\1/p' $(MAKEFILE_LIST) |      \
                $(XARGS) printf '    %s\n' $(APPS) | $(SORT)

reset:
	@   $(call contingent, clear)

###

.NOTPARALLEL: $(APPS)
.PHONY: $(APPS)

$(APPS): | apps/ share/
	@   $(CP) templates/$@ apps/$@                                  ;   \
            $(CD) apps/$@                                               ;   \
            $(MAKE)

###

apps build deps share:
	@   if [ ! -d $@ ]; then $(MKDIR) $@; fi

build/q.png: build/q.tex | build/
	@   $(CD) build                                                 ;   \
            $(PDFLATEX) q.tex                                           ;   \
            $(PDFCROP) q.pdf q.pdf                                      ;   \
            $(CONVERT) \
                -density 8192 \
                -resize 1024x1024 \
                -gravity center \
                -extent 1024x1024 \
                -transparent white \
                -transparent-color '#929292' \
                -quality 100 \
                    q.pdf q.png

build/q.tex: src/q.tex | build/
	@   $(CP) $< $@

chrome-hosted-app: \
    share/favicon.ico \
    share/icon-128.png

chrome-packaged-app: \
    share/favicon.ico \
    share/icon-128.png

couchdb-app: \
    deps/jslint.js \
    deps/json2.js \
    deps/quanah.js \
    share/favicon.ico \
    share/launch-image-iphone.png \
    share/launch-image-iphone4.png \
    share/main.js \
    share/touch-icon-ipad.png \
    share/touch-icon-ipad3.png \
    share/touch-icon-iphone.png \
    share/touch-icon-iphone4.png

deps/node-sqlite3: | deps/
	@   REPO="https://github.com/developmentseed/node-sqlite3.git"  ;   \
            if [ ! -d $@ ]; then                                            \
                $(GIT) clone $${REPO} $@                                ;   \
            else                                                            \
                $(CD) $@                                                ;   \
                $(GIT) pull                                             ;   \
            fi

deps/jslint.js: | deps/
	@   CROCKHUB="https://raw.github.com/douglascrockford"          ;   \
            $(CURL) -o $@ $${CROCKHUB}/JSLint/master/jslint.js

deps/json2.js: | deps/
	@   CROCKHUB="https://raw.github.com/douglascrockford"          ;   \
            $(CURL) -o $@ $${CROCKHUB}/JSON-js/master/json2.js

deps/quanah.js: | deps/
	@   SEANHUB="https://raw.github.com/wilkinson"                 ;   \
            $(CURL) -o $@ $${SEANHUB}/quanah/master/src/quanah.js

facebook-app: \
    share/facebook-16x16.png \
    share/facebook-75x75.png

nodejs-client: \
    deps/node-sqlite3 \
    share/main.js

share/bitbucket.jpg: build/q.png | share/
	@   $(CONVERT) \
                -background white -alpha remove -alpha off \
                -density 96 \
                -resize 31x31 \
                -gravity center \
                -extent 35x35 \
                -quality 100 \
                    $< $@

share/dropbox-16.png: build/q.png | share/
	@   $(CONVERT) \
                -background none \
                -density 96 \
                -resize 14x14 \
                -gravity center \
                -extent 16x16 \<commit_msg>SQLite3 is not _currently_ a prerequisite for "nodejs-client"<commit_after>#-  GNU Makefile

#-  Makefile ~~
#
#   To-do:
#   -   When deploying to CouchDB, run cleanup/compaction routines also.
#
#                                                       ~~ (c) SRW, 03 Apr 2012

include $(PWD)/tools/macros.make

CAT         :=  $(call contingent, gcat cat)
CD          :=  $(call contingent, cd)
CONVERT     :=  $(call contingent, convert)                     #-  ImageMagick
CP          :=  $(call contingent, gcp cp) -rf
CURL        :=  $(call contingent, curl)
GIT         :=  $(call contingent, git)
LS          :=  $(call contingent, gls ls) 2>/dev/null
MKDIR       :=  $(call contingent, gmkdir mkdir)
PDFCROP     :=  $(call contingent, pdfcrop)                     #-  TeX Live
PDFLATEX    :=  $(call contingent, pdflatex) -no-shell-escape   #-  TeX Live
QRENCODE    :=  $(call contingent, qrencode) --8bit --level=H
RM          :=  $(call contingent, grm rm) -rf
SED         :=  $(call contingent, gsed sed)
SORT        :=  $(call contingent, gsort sort)
XARGS       :=  $(call contingent, xargs)

APPS    :=  $(shell $(LS) templates)

.PHONY: all clean clobber distclean help reset
.SILENT: ;

'': help;

all: $(APPS)

clean: reset

clobber: clean
	@   $(RM) apps/ build/ share/

distclean: clobber
	@   $(RM) .d8_history deps/ .v8_history

help:
	@   printf '%s\n' 'Usage: $(MAKE) [options] [target] ...'       ;   \
            printf '%s\n' '  where "high-level" targets include'        ;   \
            $(SED) -n 's/^.PHONY:\([^$$]*\)$$/\1/p' $(MAKEFILE_LIST) |      \
                $(XARGS) printf '    %s\n' $(APPS) | $(SORT)

reset:
	@   $(call contingent, clear)

###

.NOTPARALLEL: $(APPS)
.PHONY: $(APPS)

$(APPS): | apps/ share/
	@   $(CP) templates/$@ apps/$@                                  ;   \
            $(CD) apps/$@                                               ;   \
            $(MAKE)

###

apps build deps share:
	@   if [ ! -d $@ ]; then $(MKDIR) $@; fi

build/q.png: build/q.tex | build/
	@   $(CD) build                                                 ;   \
            $(PDFLATEX) q.tex                                           ;   \
            $(PDFCROP) q.pdf q.pdf                                      ;   \
            $(CONVERT) \
                -density 8192 \
                -resize 1024x1024 \
                -gravity center \
                -extent 1024x1024 \
                -transparent white \
                -transparent-color '#929292' \
                -quality 100 \
                    q.pdf q.png

build/q.tex: src/q.tex | build/
	@   $(CP) $< $@

chrome-hosted-app: \
    share/favicon.ico \
    share/icon-128.png

chrome-packaged-app: \
    share/favicon.ico \
    share/icon-128.png

couchdb-app: \
    deps/jslint.js \
    deps/json2.js \
    deps/quanah.js \
    share/favicon.ico \
    share/launch-image-iphone.png \
    share/launch-image-iphone4.png \
    share/main.js \
    share/touch-icon-ipad.png \
    share/touch-icon-ipad3.png \
    share/touch-icon-iphone.png \
    share/touch-icon-iphone4.png

deps/node-sqlite3: | deps/
	@   REPO="https://github.com/developmentseed/node-sqlite3.git"  ;   \
            if [ ! -d $@ ]; then                                            \
                $(GIT) clone $${REPO} $@                                ;   \
            else                                                            \
                $(CD) $@                                                ;   \
                $(GIT) pull                                             ;   \
            fi

deps/jslint.js: | deps/
	@   CROCKHUB="https://raw.github.com/douglascrockford"          ;   \
            $(CURL) -o $@ $${CROCKHUB}/JSLint/master/jslint.js

deps/json2.js: | deps/
	@   CROCKHUB="https://raw.github.com/douglascrockford"          ;   \
            $(CURL) -o $@ $${CROCKHUB}/JSON-js/master/json2.js

deps/quanah.js: | deps/
	@   SEANHUB="https://raw.github.com/wilkinson"                 ;   \
            $(CURL) -o $@ $${SEANHUB}/quanah/master/src/quanah.js

facebook-app: \
    share/facebook-16x16.png \
    share/facebook-75x75.png

nodejs-client: \
    share/main.js

share/bitbucket.jpg: build/q.png | share/
	@   $(CONVERT) \
                -background white -alpha remove -alpha off \
                -density 96 \
                -resize 31x31 \
                -gravity center \
                -extent 35x35 \
                -quality 100 \
                    $< $@

share/dropbox-16.png: build/q.png | share/
	@   $(CONVERT) \
                -background none \
                -density 96 \
                -resize 14x14 \
                -gravity center \
                -extent 16x16 \
{'fraction_non_alphanumeric': 0.14270500532481364, 'fraction_numerical': 0.018743343982960597, 'mean_word_length': 1.1819237918215613, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 38, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2285208', 'n_tokens_mistral': 3304, 'n_tokens_neox': 3018, 'n_words': 598}