-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
67 lines (52 loc) · 1.69 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
SRCS=feedlish.less feedlish-night.less
THEMES_DIR=$(abspath ..)
LESSC_INCLUDE=--include-path=$(THEMES_DIR)
DSTS =$(SRCS:.less=.css)
DEPS =$(SRCS:.less=.dep)
SHELL:=/usr/bin/bash
TTRSS_VERSION=$(shell git -C $(THEMES_DIR) --no-pager log --date="format:%y.%m" --pretty="v%cd-%h" --abbrev=7 -n1 $(shell git -C $(THEMES_DIR) merge-base HEAD origin))
all: ttrss-version $(DSTS) stats
ttrss-version:
@echo "tt-rss version $(TTRSS_VERSION)"
stats:
#
# Watch out for Combinatorial Explosion
# http://lesscss.org/features/#parent-selectors-feature-combinatorial-explosion
#
@ echo ; \
echo File sizes compared to default theme: ; \
{ \
def=`stat -c %s $(THEMES_DIR)/../themes/light.css`; \
for f in $(DSTS) ; do \
my=`stat -c %s $$f` ; \
echo $$f $$my/$$def $$(( 100 * $$my / $$def ))% ; \
done ; \
} | column -t ; \
echo
clean:
rm -f $(DSTS)
rm -f $(DEPS)
commit: clean
@echo -e "\n---- Backup custom.less ----"
[ ! -f custom.less.patch ] || patch < custom.less.patch
git diff -p @ -- custom.less | tee custom.less.patch
git co @ -- custom.less
git status -sb
@echo -e "\n---- Rebuild ----"
$(MAKE) all
@echo -e "\n---- Restore custom.less ----"
patch < custom.less.patch && rm custom.less.patch
@echo -e "\n---- Commit ----"
git add $(DSTS)
git commit -m "(build css, ttrss at $(TTRSS_VERSION))"
uncommit:
git reset --soft @~
.PHONY: all clean commit uncommit ttrss-version
%.dep: %.less Makefile
lessc $*.less $*.css $(LESSC_INCLUDE) -M > $*.dep.tmp
@sed 's,\($*\.css\)[ :]*,\1 $*.dep : ,g' < $*.dep.tmp > $*.dep
@rm $*.dep.tmp
%.css: %.less %.dep Makefile
lessc $*.less $*.css $(LESSC_INCLUDE)
# FIXME: make clean triggers %.dep because of include !?
-include $(DEPS)