This repository has been archived by the owner on Aug 23, 2022. It is now read-only.
forked from alxshelepenok/gatsby-starter-lumen
-
Notifications
You must be signed in to change notification settings - Fork 1
/
GNUmakefile
67 lines (51 loc) · 2.19 KB
/
GNUmakefile
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
#*************************
# VARIABLES
#*************************
FIND= find
SRCDIR ?=./pub/
EXTRACTDIR= $(SRCDIR)/extract
DOCDIR ?=$(SRCDIR)
POD6DOC=./bin/pod6json
POD6JS=node ./bin/pod6js
POD6EXTRACT=node ./bin/extract-notes.js
DSTDIR ?=./pub.all
# ****************************************************************
# * some things we can figure out here, so we shouldn't
# * have to mess with the settings all the time
# ****************************************************************
# the sourcefiles
PODFILES = $(shell ${FIND} ${DOCDIR} -iname '*.pod6' -or -iname '*.pod6' 2>/dev/null)
SRCFILES = $(PODFILES)
#JS_TARGETS = $(addsuffix .config.js, $(basename $(notdir $(SRCFILES))))
JS_TARGETS = $(addsuffix .config.json, $(SRCFILES))
COMPONETS_TARGETS = $(addsuffix .js, $(basename $(notdir $(SRCFILES))))
$(JS_TARGETS): SRC = $(basename $(basename $@))
$(JS_TARGETS): SRC_PATH = $(dir $@)
$(JS_TARGETS): DST_PATH = $(addprefix ./pub.all/, $(subst /,-,$@))
$(JS_TARGETS): DST_JSPATH = $(addprefix ./pub.all/, $(addsuffix .js, $(subst /,-,$(basename $(basename $@)))))
#$(JS_TARGETS): ORIG = $(filter %/${BASE}.pod,${SRCFILES})
TEST_TARGETS = $(addsuffix .config.json1, $(SRCFILES))
$(TEST_TARGETS): SRC = $(basename $(basename $@))
$(TEST_TARGETS): SRC_PATH = $(dir $@)
$(TEST_TARGETS): DST_PATH = $(addprefix ./pub.all/, $(subst /,-,$@))
$(TEST_TARGETS): DST_JSPATH = $(addprefix ./pub.all/, $(addsuffix .js, $(subst /,-,$(basename $(basename $@)))))
.PHONY: clea
all: $(JS_TARGETS)
$(JS_TARGETS):
@echo TARGET BASE: ${SRC_PATH} // ${DST_PATH} $@ ${SRC} ${DST_JSPATH}
$(POD6JS) --doctype json --jsreact=${DST_JSPATH} --images_prefix ${SRC_PATH} < ${SRC} >${DST_PATH}
extract-items.done: $(EXTRACTDIR)
@echo EXTARCT PUBLISHED ITEMS into $(EXTRACTDIR)
echo $(SRCFILES) | xargs -P 1 -n 1 sh -c '$(POD6EXTRACT) -f $$0'
touch $@
$(EXTRACTDIR):
-@mkdir -p $@ > /dev/null 2>&1
book_preface.xml:
@echo TARGET BASE: ${BASE} ${ORIG}
$(POD6DOC) -doctype preface ${ORIG} > $@
test: $(TEST_TARGETS)
$(TEST_TARGETS):
@echo test ${SRC}
$(POD6DOC) --doctype js --images_prefix ${SRC_PATH} < ${SRC} >/dev/null
clean:
$(RM) -rf $(DSTDIR)/*.bak $(DSTDIR)/*.js $(DSTDIR)/*.xml $(DSTDIR)/*.json extract-items.done $(EXTRACTDIR)