-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
206 lines (156 loc) · 4.05 KB
/
Makefile
File metadata and controls
206 lines (156 loc) · 4.05 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# dmclient Makefile
# Copyright (C) 2018 Alex Mair. All rights reserved.
# This file is part of dmclient.
#
# dmclient is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2 of the License.
#
# dmclient is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with dmclient. If not, see <http://www.gnu.org/licenses/>.
#
MAKEFLAGS += -Rr --no-print-directory
PHONY=
.SUFFIXES:
all:
Makefile: ;
ifeq ("$(origin V)", "command line")
VERBOSE=$(V)
endif
ifndef VERBOSE
VERBOSE=0
endif
ifeq ($(VERBOSE),1)
craptools_hack=
quiet=
Q=
else
craptools_hack=>/dev/null
quiet=quiet_
Q=@
endif
# Recipe configuration
PYTHON=python3.6
RM=rm -f
PYUIC=pyuic5
PYUICFLAGS=
PYRC=pyrcc5
PYRCFLAGS=
SPHINX=sphinx
# Cmds and variables.
#
cmd_pyuic = \
$(PYUIC) $(PYUICFLAGS) -o $@ $< ; \
sed -e 's/import icons_rc//' -i -- "$@"
quiet_cmd_pyuic = PYUIC $@
cmd_pyrc = $(PYRC) $(PYRCFLAGS) -o $@ $<
quiet_cmd_pyrc = PYRC $@
cmd_pkg_archive= \
set -e ; \
cd $< ; \
find . -name '.*' -delete ;\
export COPYFILE_DISABLE=1 ;\
tar cjf $(notdir $@) * ; \
mv $(notdir $@) ..
quiet_cmd_pkg_archive=PACKAGE $@
# This is dumb.
cmd_gendocs = \
sphinx-apidoc -o doc/src . ui/widgets ;\
mkdir doc/html 2>/dev/null ;\
sphinx-build -b html doc/ doc/html
quiet_cmd_gendocs=GENDOCS doc/
# Input files
#
# FIXME: hack
ui_files_:=$(shell find resources/qt -name '*.ui' | sed -e 's/resources\/qt/ui\/widgets/')
ui_dirs=$(filter-out ui/widgets/,$(sort $(dir $(ui_files_))))
ui_dirinit=$(addsuffix /__init__.py,$(ui_dirs))
ui_files=$(ui_files_:.ui=.py)
test_archives=resources/test/protege/testcampaign.dmc \
resources/test/protege/testlibrary.dml \
resources/test/badmeta.dmc
# Primary targets.
#
PHONY+=help
help:
@echo dmclient\'s Makefile supports the following:
@echo " all"
@echo " docs"
@echo " qrc"
@echo " tests"
@echo " testarchives"
@echo " ui"
@echo " clean"
@echo " clean-docs"
@echo " clean-pycache"
@echo " clean-resources"
@echo " clean-ui"
PHONY+=all
all: testarchives qrc ui
PHONY+=docs
docs: FORCE
$(Q)$(RM) -r doc/src doc/html # FIXME
$(call if_dep_changed,gendocs)
PHONY+=qrc
qrc: ui/widgets/icons_rc.py
ui/widgets/icons_rc.py: resources/icons.qrc
PHONY+=tests
tests:
py.test
PHONY+=testarchives
testarchives: $(test_archives)
PHONY+=ui
ui: $(ui_files)
$(ui_files): $(ui_dirinit)
$(ui_dirinit): $(ui_dirs)
PHONY+=clean $(sub_clean)
sub_clean = clean-docs clean-pycache clean-resources clean-ui clean-app
clean: $(sub_clean)
clean-docs:
$(RM) -r doc/html doc/src
clean-pycache:
find . -name __pycache__ | xargs $(RM) -r
clean-resources: clean-testarchives
$(RM) ui/widgets/icons_rc.py
clean-testarchives:
$(RM) $(test_archives)
clean-ui:
find ui/widgets \( -not -wholename ui/widgets -and -not -wholename ui/widgets/__init__.py \) -delete
clean-app:
$(RM) -r build
PHONY: app
app:
$(PYTHON) setup.py py2app
# General targets
#
ui/widgets/%.py: resources/qt/%.ui
$(call if_dep_changed,pyuic)
ui/widgets/%_rc.py: resources/%.qrc
$(call if_dep_changed,pyrc)
# Hack
%/__init__.py: ;
# FIXME: cmd?
ui/widgets/%/:
mkdir $@ ; \
touch $@/__init__.py
# FIXME these should not be FORCE.
%.dmc: % FORCE
$(call if_dep_changed,pkg_archive)
%.dml: % FORCE
$(call if_dep_changed,pkg_archive)
# "Internal" magic and guts.
#
echo_cmd = $(if $($(quiet)cmd_$(1)), \
echo " $($(quiet)cmd_$(1))";)
prereqs=$(filter-out $(PHONY),$?)
if_dep_changed=$(if $(strip $(prereqs)), \
@set -e; \
$(echo_cmd) $(cmd_$(1)))
.PHONY: $(PHONY)
.PHONY: FORCE
FORCE: ;