-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.am
113 lines (89 loc) · 2.16 KB
/
Makefile.am
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
## Process this file with automake to produce Makefile.in
dist_doc_DATA = LICENSE AUTHORS INSTALL
dist_pkgdata_DATA = example.conf
if MSWIN
MAYBE_MSWIN = src/mswin
else
MAYBE_UNIX = src
if X
MAYBE_X = img
endif
endif
SUBDIRS = $(MAYBE_MSWIN) $(MAYBE_UNIX) $(MAYBE_X)
DIST_SUBDIRS = $(SUBDIRS)
ZB_TARBALL = $$(uname)-$$(uname -m).tar.gz
D2U = dos2unix
all-local:
anew: clean all
test-setup:
mkdir -p test/{ACAD,BAT0,BAT1}
touch test/ACAD/online
touch test/BAT0/capacity
touch test/BAT1/capacity
touch test/BAT0/type
touch test/BAT1/type
touch test/ACAD/type
echo 1 > 'test/ACAD/online'
echo 100 > 'test/BAT0/capacity'
echo 100 > 'test/BAT1/capactiy'
echo 'Battery' > 'test/BAT0/type'
echo 'Battery' > 'test/BAT1/type'
echo 'Mains' > 'test/ACAD/type'
test-clean:
$(RM) -r test
test-onac: test-clean test-setup
echo 1 > 'test/ACAD/online'
$(RM) -r 'test/'{BAT0,BAT1} || $(ERM) -r 'test/'{BAT0,BAT1} || true
test-noac: test-clean test-setup
echo 0 > 'test/ACAD/online'
test-lowbat: test-clean test-setup
echo 10 > 'test/BAT0/capacity'
echo 10 > 'test/BAT1/capacity'
test-empty: test-setup
echo 0 > 'test/BAT0/capacity'
echo 0 > 'test/BAT0/capacity'
test-nosup:
$(RM) -r test
test-depth: test-clean
mkdir -p "test"; \
cd "test"; \
for ((idx = 0; idx < 256; ++idx)); do \
mkdir -p "BAT$$idx"; \
cd "BAT$$idx"; \
done; \
echo 50 > "capacity"; \
echo 'Battery' > "type"
test-breadth: test-clean test-setup
cd "test"; \
for ((idx = 0; idx < 256; ++idx)); do \
mkdir -p "BAT$$idx"; \
echo 50 > "BAT$$idx/capacity"; \
echo 'Battery' > "BAT$$idx/type"; \
done
clean-local:
$(RM) -r inst/usr
$(RM) *.tar.gz
release: clean
$(MAKE) DESTDIR="$$PWD/inst" install
cd inst; \
$(RM) $(ZB_TARBALL) ;\
tar czf $(ZB_TARBALL) usr
refresh-check:
cd $(UNIX_DIR); \
$(MAKE) $@
check-all:
cd $(UNIX_DIR); \
$(MAKE) $@
iso:
$(MAKE) dist
genisoimage -o zb.iso *.tar.gz
mv zb.iso ..
dos2unix:
$(D2U) $(wildcard src/*)
$(D2U) $(wildcard src/mswin/*)
install-blank:
printf '#include <stdlib.h>\nint main(int argc, char **argv) { return EXIT_SUCCESS; }' > blank.c
$(CC) -o src/zbatt blank.c
$(CC) -o src/zbatc blank.c
cd $(UNIX_DIR); \
$(MAKE) install