This repository has been archived by the owner on Sep 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
81 lines (60 loc) · 2.11 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh
PACKAGE = nodelint
NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node)
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
DATADIR ?= $(PREFIX)/share
MANDIR ?= $(PREFIX)/share/man
LIBDIR ?= $(PREFIX)/lib
ETCDIR = /etc
PACKAGEDATADIR ?= $(DATADIR)/$(PACKAGE)
BUILDDIR = dist
$(shell if [ ! -d $(BUILDDIR) ]; then mkdir $(BUILDDIR); fi)
DOCS = $(shell find doc -name '*.md' \
|sed 's|.md|.1|g' \
|sed 's|doc/|man1/|g' \
)
all: build doc
build: stamp-build
stamp-build: dependencies jslint/jslint.js nodelint config.js
touch stamp-build;
cp $^ $(BUILDDIR);
perl -pi -e 's{^\s*SCRIPT_DIRECTORY =.*?\n}{}ms' $(BUILDDIR)/nodelint
perl -pi -e 's{path\.join\(SCRIPT_DIRECTORY, '\''config.js'\''\)}{"$(ETCDIR)/nodelint.conf"}' $(BUILDDIR)/nodelint
perl -pi -e 's{path\.join\(SCRIPT_DIRECTORY, '\''jslint/jslint\.js'\''\)}{"$(PACKAGEDATADIR)/jslint.js"}' $(BUILDDIR)/nodelint
install: build doc
install --directory $(PACKAGEDATADIR)
install --mode 0644 $(BUILDDIR)/jslint.js $(PACKAGEDATADIR)/jslint.js
install --mode 0644 $(BUILDDIR)/config.js $(ETCDIR)/nodelint.conf
install --mode 0755 $(BUILDDIR)/nodelint $(BINDIR)/nodelint
install --directory $(MANDIR)/man1/
cp -a man1/nodelint.1 $(MANDIR)/man1/
uninstall:
rm -rf $(PACKAGEDATADIR)/jslint.js $(ETCDIR)/nodelint.conf $(BINDIR)/nodelint
rm -rf $(MANDIR)/man1/nodelint.1
clean:
rm -rf $(BUILDDIR) stamp-build
dependencies: stamp-dependencies
stamp-dependencies:
touch stamp-dependencies;
npm install
git submodule update --init --recursive
devdependencies: dependencies stamp-devdependencies
stamp-devdependencies:
touch stamp-devdependencies;
touch stamp-dependencies;
npm install --dev
test: devdependencies
./node_modules/.bin/nodeunit ./test/test-*.js
lint: devdependencies
./nodelint ./nodelint ./config.js ./lib/ ./test/
lint-package-json: devdependencies
./nodelint ./package.json
doc: devdependencies man1 $(DOCS)
@true
man1:
@if ! test -d man1 ; then mkdir -p man1 ; fi
# use `npm install ronn` for this to work.
man1/%.1: doc/%.md
./node_modules/.bin/ronn --roff $< > $@
.PHONY: test install uninstall build all