2011-08-15 17:53:57 +00:00
|
|
|
|
|
|
|
ifeq ($(VERSION), "")
|
|
|
|
@echo "Use gmake"
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2012-01-24 17:43:46 +00:00
|
|
|
DOCPKGDIR = ./docs/pkg
|
|
|
|
HAVE_GJSLINT := $(shell which gjslint >/dev/null && echo yes || echo no)
|
|
|
|
LINT = ./node_modules/.javascriptlint/build/install/jsl --conf ./tools/jsl.conf
|
|
|
|
NAME=ldapjs
|
|
|
|
RESTDOWN_VERSION=1.2.13
|
2011-08-15 17:53:57 +00:00
|
|
|
SRC := $(shell pwd)
|
|
|
|
TAR = tar
|
|
|
|
UNAME := $(shell uname)
|
|
|
|
ifeq ($(UNAME), SunOS)
|
|
|
|
TAR = gtar
|
|
|
|
endif
|
|
|
|
NPM := npm_config_tar=$(TAR) npm
|
|
|
|
|
2011-08-24 19:38:23 +00:00
|
|
|
RESTDOWN = ./node_modules/.restdown/bin/restdown \
|
|
|
|
-b ./docs/branding \
|
|
|
|
-m ${DOCPKGDIR} \
|
|
|
|
-D mediaroot=media
|
|
|
|
|
2012-01-24 16:56:30 +00:00
|
|
|
.PHONY: dep lint test doc clean all install
|
2011-08-15 17:53:57 +00:00
|
|
|
|
|
|
|
all:: test doc
|
|
|
|
|
|
|
|
node_modules/.ldapjs.npm.installed:
|
2011-12-21 18:19:04 +00:00
|
|
|
$(NPM) install
|
2011-08-15 17:53:57 +00:00
|
|
|
if [[ ! -d node_modules/.restdown ]]; then \
|
|
|
|
git clone git://github.com/trentm/restdown.git node_modules/.restdown; \
|
|
|
|
else \
|
|
|
|
(cd node_modules/.restdown && git fetch origin); \
|
|
|
|
fi
|
2012-01-24 17:43:46 +00:00
|
|
|
|
|
|
|
if [[ ! -d node_modules/.javascriptlint ]]; then \
|
|
|
|
git clone https://github.com/davepacheco/javascriptlint node_modules/.javascriptlint; \
|
|
|
|
else \
|
|
|
|
(cd node_modules/.javascriptlint && git fetch origin); \
|
|
|
|
fi
|
|
|
|
|
2011-08-15 17:53:57 +00:00
|
|
|
@(cd ./node_modules/.restdown && git checkout $(RESTDOWN_VERSION))
|
2012-01-24 17:43:46 +00:00
|
|
|
@(cd ./node_modules/.javascriptlint && $(MAKE) install)
|
2011-08-15 17:53:57 +00:00
|
|
|
@touch ./node_modules/.ldapjs.npm.installed
|
|
|
|
|
|
|
|
dep: ./node_modules/.ldapjs.npm.installed
|
2012-01-24 16:56:30 +00:00
|
|
|
install: dep
|
2011-08-15 17:53:57 +00:00
|
|
|
|
|
|
|
gjslint:
|
|
|
|
gjslint --nojsdoc -r lib -r tst
|
|
|
|
|
|
|
|
ifeq ($(HAVE_GJSLINT), yes)
|
2012-01-24 17:43:46 +00:00
|
|
|
lint: install gjslint
|
|
|
|
${LINT} --recurse lib/*.js
|
2011-08-15 17:53:57 +00:00
|
|
|
else
|
2012-01-24 17:43:46 +00:00
|
|
|
lint: install
|
2011-08-15 17:53:57 +00:00
|
|
|
@echo "* * *"
|
|
|
|
@echo "* Warning: Cannot lint with gjslint. Install it from:"
|
|
|
|
@echo "* http://code.google.com/closure/utilities/docs/linter_howto.html"
|
|
|
|
@echo "* * *"
|
2012-01-24 17:43:46 +00:00
|
|
|
${LINT} --recurse lib/*.js
|
2011-08-15 17:53:57 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
doc: dep
|
|
|
|
@rm -rf ${DOCPKGDIR}
|
|
|
|
@mkdir -p ${DOCPKGDIR}
|
2011-08-24 19:38:23 +00:00
|
|
|
${RESTDOWN} ./docs/client.md
|
|
|
|
${RESTDOWN} ./docs/dn.md
|
|
|
|
${RESTDOWN} ./docs/errors.md
|
|
|
|
${RESTDOWN} ./docs/examples.md
|
|
|
|
${RESTDOWN} ./docs/filters.md
|
|
|
|
${RESTDOWN} ./docs/guide.md
|
|
|
|
${RESTDOWN} ./docs/index.md
|
|
|
|
${RESTDOWN} ./docs/server.md
|
2011-08-15 17:53:57 +00:00
|
|
|
rm docs/*.json
|
|
|
|
mv docs/*.html ${DOCPKGDIR}
|
|
|
|
(cd ${DOCPKGDIR} && $(TAR) -czf ${SRC}/${NAME}-docs-`git log -1 --pretty='format:%h'`.tar.gz *)
|
|
|
|
|
|
|
|
|
|
|
|
test: dep lint
|
|
|
|
$(NPM) test
|
|
|
|
|
|
|
|
clean:
|
2012-02-15 05:32:10 +00:00
|
|
|
@rm -fr ${DOCPKGDIR} *.log *.tar.gz
|