-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
89 lines (76 loc) · 2.51 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
82
83
84
85
86
87
88
89
BUILD=build/html
BSTY=$(BUILD)/styles
AUGEAS_REPO=../augeas
ND_DOCSDIR=$(AUGEAS_REPO)/doc/naturaldocs
BUILD_REFS=build/html/docs/references
BUILD_REFS_CACHE=build_cache/html/docs/references
LENS_DIR=$(AUGEAS_REPO)/lenses
RELEASES=$(shell cd ../augeas && git tag | sed -n 's/release-\(.*\)/\1/p')
STOCK_LENSES_RELEASES=$(foreach release,$(RELEASES),pages/stock_lenses/$(release)/index.txt)
ND_RELEASES=$(foreach release,$(RELEASES),$(BUILD_REFS)/$(release))
all: pages/stock_lenses.txt $(STOCK_LENSES_RELEASES) \
rest2web $(BSTY)/default.css $(BSTY)/favicon.ico \
$(BSTY)/augeas.css $(BSTY)/generic.css \
$(BSTY)/default-debug.css $(BSTY)/debug.css \
$(BSTY)/et_logo.png $(BSTY)/augeas-logo.png \
$(BSTY)/footer_corner.png $(BSTY)/footer_pattern.png \
$(BUILD)/docs/augeas.odp $(BUILD)/docs/augeas.pdf \
$(BUILD)/docs/augeas-ols-2008.odp $(BUILD)/docs/augeas-ols-2008.pdf \
naturaldocs $(ND_RELEASES)
pages/stock_lenses.txt:
ruby list_lenses.rb -f rst -l $(LENS_DIR) > $@
pages/stock_lenses/%/index.txt:
mkdir -p pages/stock_lenses/$*
cd ../augeas && \
git checkout -f release-$* && \
ruby $(CURDIR)/list_lenses.rb -f rst -l $(LENS_DIR) \
-r '../../' -v '$*' > \
$(CURDIR)/$@
git add $@
naturaldocs:
cd ../augeas && git checkout -f master
(if test -d $(ND_DOCSDIR); then \
$(MAKE) -C $(ND_DOCSDIR); \
fi; \
rm -rf $(BUILD_REFS); \
mkdir -p $(BUILD_REFS); \
rsync -a $(BUILD_REFS_CACHE)/ $(BUILD_REFS); \
cp -pr $(ND_DOCSDIR)/output/* $(BUILD_REFS))
$(BUILD_REFS)/%:
cd ../augeas && git checkout -f release-$*
if ! test -d $@; then \
if [ x${test} = x0* ]; then \
(if test -d $(ND_DOCSDIR); then \
$(MAKE) -C $(ND_DOCSDIR); \
fi; \
mkdir -p $@; \
cp -pr $(ND_DOCSDIR)/output/* $@; \
mkdir -p $(BUILD_REFS_CACHE)/$*; \
rsync -a $@/ $(BUILD_REFS_CACHE)/$*; \
git add $(BUILD_REFS_CACHE)/$*); \
fi; \
fi
rest2web:
PYTHONPATH=$$PWD r2w
$(BUILD)/styles/%: pages/styles/%
mkdir -p $(BUILD)/styles
cp -a $< $@
$(BUILD)/docs/%.odp: pages/docs/%.odp
@mkdir -p $(shell dirname $@)
cp -up $< $@
$(BUILD)/docs/%.pdf: pages/docs/%.pdf
@mkdir -p $(shell dirname $@)
cp -up $< $@
sync:
git checkout gh-pages
rsync -av build/html/ .
git status
# Add new doc
find . -not -path './build/html/*' -type f \
-regex '.*\.\(html\|js\|css\)' \
-exec git add {} \;
git commit -a && git checkout master
clean:
rm -f pages/stock_lenses.txt
rm -rf $(BUILD)
.PHONY: rest2web sync clean naturaldocs