forked from txolutions/pyspec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
260 lines (223 loc) · 8.88 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
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
#******************************************************************************
#
# %W% %G% CSS
#
# "pyspec" Release %R%
#
# Copyright (c) 2020
# by Certified Scientific Software.
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software ("pyspec") and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# * The software is provided "as is", without warranty of any *
# * kind, express or implied, including but not limited to the *
# * warranties of merchantability, fitness for a particular *
# * purpose and noninfringement. In no event shall the authors *
# * or copyright holders be liable for any claim, damages or *
# * other liability, whether in an action of contract, tort *
# * or otherwise, arising from, out of or in connection with *
# * the software or the use of other dealings in the software. *
#
#******************************************************************************
PY2=
PY3=
ifneq (, $(shell which python3 2>/dev/null))
override PY3="python3"
endif
ifneq (, $(shell which python2 2>/dev/null))
override PY2="python2"
endif
ifndef PY2
ifneq (, $(shell which python 2>/dev/null))
override PY2="python"
endif
endif
OWNER := $(shell grep -s owner= ../install_data | sed 's/owner=//')
SPECD := $(shell grep -s aux= ../install_data | sed 's/aux=//')
ifeq (${strip ${SPECD}}, )
SPECD = /usr/local/lib/spec.d
endif
ifeq (${strip ${OWNER}}, )
OWNER = specadm
endif
ifeq (${strip ${CHOWN}}, )
CHOWN = chown
endif
SHELL = /bin/sh
INSDIR = /usr/local/bin
TAR = tar
PACK = gzip -c
UNPACK = gunzip -c
# removed to be used with --specsrc=
#SPEC_SRC = ../..
DIST_SRC = VERSION.py MANIFEST.in setup.py
SRC = Makefile ${DIST_SRC} versionsave version_template.py
TOOLS = specfile roi_selector
TOOLS_PY = specfile.py roi_selector.py
PY_SRC = css_logger.py utils.py ordereddict.py __init__.py
MODULES = datashm.so
CLIENT_SRC = __init__.py saferef.py SpecArray.py SpecChannel.py \
SpecClientError.py SpecCommand.py SpecConnection.py SpecConnectionsManager.py \
SpecCounter.py SpecEventsDispatcher.py SpecMessage.py SpecMotor.py \
SpecReply.py SpecScan.py SpecServer.py SpecVariable.py SpecWaitObject.py \
spec_shm.py spec_updater.py
EXAMPLES = README example_qt_command.py example_qt_motor.py \
example_qt_status.py example_qt_variable.py example_calc_server.py \
example_sync_session.py
HDW_SRC = __init__.py server.py
GRAPHICS_SRC = __init__.py graphics_rc.py qwt_import.py matplotlib_import.py \
PySide_import.py PyQt4_import.py PyQt5_import.py PySide2_import.py \
PySide6_import.py PyQt6_import.py \
QVariant.py
FILE_SRC = __init__.py spec.py tiff.py
PYDOC_SRC = __init__.py spec_help.tpl SpecHTMLreST.py SpecMANreST.py
DATASHM_SRC = datashm_py.c setup.py README
# DOCS_SRC = installation.rst spec_format.rst
DIRS = docs tools python python/datashm \
python/client python/client/examples python/hardware \
python/graphics python/tools python/file python/doc
# Keep gmake from trying to check out a file from source code control
%: %,v
%: RCS/%,v
%: RCS/%
%: s.%
%: SCCS/s.%
it: prep_dist
install:
@echo "Installing pyspec modules ..."
@for i in ${TOOLS}; do rm -f ${INSDIR}/$$i; \
sed '/^SPECD/s;-.*};-${SPECD}};' tools/$$i >${INSDIR}/$$i; \
( chmod 555 ${INSDIR}/$$i; ${CHOWN} ${OWNER} ${INSDIR}/$$i; ) \
done; \
mkdir -p ${SPECD}/pyspec
@echo " Copying pyspec files ..." ; \
${UNPACK} pyspec_built.tar.gz | (cd ${SPECD}/pyspec && ${TAR} xf - )
@if [ "${CHOWN}" = "chown" ] ; then \
echo " Changing ownership of pyspec files to ${OWNER} ... " ; \
cd ${SPECD}/pyspec ; ${CHOWN} -R ${OWNER} . ; fi
install_it: owner_chk untar
@if [ -f pyspec_built.tar.gz ] ; then make -e install ; fi
prep_datashm:
ifneq (,${PY2})
@echo "Compiling datashm module for ${PY2}"
@cd python/datashm >/dev/null; ${PY2} setup.py build
endif
ifneq (,${PY3})
@echo "Compiling datashm module for ${PY3}"
@cd python/datashm >/dev/null; ${PY3} setup.py build
endif
version:
@echo "Generating VERSION.py python file"
@./versionsave
dist: prep_dist tarball
prep_dist: prep_datashm
-@rm -rf pyspec.tmp
@mkdir pyspec.tmp
@mkdir pyspec.tmp/client
@mkdir pyspec.tmp/client/examples
@mkdir pyspec.tmp/hardware
@mkdir pyspec.tmp/graphics
@mkdir pyspec.tmp/tools
@mkdir pyspec.tmp/file
@mkdir pyspec.tmp/doc
@cp VERSION.py pyspec.tmp/
(cd python >/dev/null; cp ${PY_SRC} ../pyspec.tmp/)
(cd python/client >/dev/null; cp ${CLIENT_SRC} ../../pyspec.tmp/client/)
(cd python/client/examples >/dev/null; cp ${EXAMPLES} ../../../pyspec.tmp/client/examples)
(cd python/hardware >/dev/null; cp ${HDW_SRC} ../../pyspec.tmp/hardware/)
(cd python/graphics >/dev/null; cp ${GRAPHICS_SRC} ../../pyspec.tmp/graphics/)
(cd python/tools >/dev/null; cp ${TOOLS_PY} ../../pyspec.tmp/tools/)
(cd python/file >/dev/null; cp ${FILE_SRC} ../../pyspec.tmp/file/)
(cd python/doc >/dev/null; cp ${PYDOC_SRC} ../../pyspec.tmp/doc/)
ifneq (,${PY2})
@cd python/datashm >/dev/null; ${PY2} setup.py install --install-lib=../../pyspec.tmp
@cd pyspec.tmp && ${PY2} -m compileall .
endif
ifneq (,${PY3})
@cd python/datashm >/dev/null; ${PY3} setup.py install --install-lib=../../pyspec.tmp
@cd pyspec.tmp && ${PY3} -m compileall .
endif
@cd pyspec.tmp >/dev/null; chmod a-w * */*; \
chmod u+w client ; \
chmod u+w client/examples ; \
chmod u+w hardware ; \
chmod u+w graphics ; \
chmod u+w tools ; \
chmod u+w file ; \
chmod u+w doc ; \
chmod -f u+w __pycache__ */__pycache__ || :
@cd pyspec.tmp >/dev/null; ${TAR} cf - . | ${PACK} > ../pyspec_built.tar.gz
owner_chk:
@( file=/tmp/tmp.$$$$ ; cp /dev/null $$file ; \
if ${CHOWN} ${OWNER} $$file ; then rm -f $$file ; exit 0 ; \
else echo "Can't change file ownership to ${OWNER}" ; \
rm -f $$file ; exit 1 ; fi )
untar:
@sh -c "if test -s pyspec_src.tar.gz ; then \
echo \"Uncompressing and detarring pyspec archive ... \" ; \
( ${UNPACK} pyspec_src.tar.gz || echo XX ) | ${TAR} xf - || exit 1 ; \
${CHOWN} -f -R ${OWNER} . ; \
rm -f pyspec_src.tar.gz ; \
fi ; exit 0"
list:
-@rm -f ,list; ( \
for i in ${SRC}; do echo $$i; done; \
for i in ${DATASHM_SRC}; do echo python/datashm/$$i; done; \
for i in ${TOOLS}; do echo tools/$$i; done; \
for i in ${PY_SRC}; do echo python/$$i; done; \
for i in ${TOOLS_PY}; do echo python/tools/$$i; done; \
for i in ${CLIENT_SRC}; do echo python/client/$$i; done; \
for i in ${EXAMPLES}; do echo python/client/examples/$$i; done; \
for i in ${HDW_SRC}; do echo python/hardware/$$i; done; \
for i in ${GRAPHICS_SRC}; do echo python/graphics/$$i; done; \
for i in ${FILE_SRC}; do echo python/file/$$i; done; \
for i in ${PYDOC_SRC}; do echo python/doc/$$i; done; \
) > ,list
# for i in ${DOCS_SRC}; do echo docs/$$i; done; \
distlist:
-@rm -f ,distlist; ( \
for i in ${DIST_SRC}; do echo $$i; done; \
for i in ${MODULES}; do echo python/client/$$i; done; \
for i in ${TOOLS}; do echo tools/$$i; done; \
for i in ${TOOLS_PY}; do echo python/tools/$$i; done; \
for i in ${PY_SRC}; do echo python/$$i; done; \
for i in ${CLIENT_SRC}; do echo python/client/$$i; done; \
for i in ${EXAMPLES}; do echo python/client/examples/$$i; done; \
for i in ${HDW_SRC}; do echo python/hardware/$$i; done; \
for i in ${GRAPHICS_SRC}; do echo python/graphics/$$i; done; \
for i in ${FILE_SRC}; do echo python/file/$$i; done; \
) > ,distlist
tarball:
@rm -f pyspec_src.tar.gz; ${TAR} cf - ${DIST_SRC} `\
for i in ${SRC}; do echo $$i; done; \
for i in ${TOOLS}; do echo tools/$$i; done; \
for i in ${DATASHM_SRC}; do echo python/datashm/$$i; done; \
for i in ${PY_SRC}; do echo python/$$i; done; \
for i in ${CLIENT_SRC}; do echo python/client/$$i; done; \
for i in ${EXAMPLES}; do echo python/client/examples/$$i; done; \
for i in ${HDW_SRC}; do echo python/hardware/$$i; done; \
for i in ${GRAPHICS_SRC}; do echo python/graphics/$$i; done; \
for i in ${TOOLS_PY}; do echo python/tools/$$i; done; \
for i in ${FILE_SRC}; do echo python/file/$$i; done; \
for i in ${PYDOC_SRC}; do echo python/doc/$$i; done; `\
| ${PACK} > pyspec_src.tar.gz
clean:
@rm -rf pyspec.tmp
@rm -f pyspec_src.tar.gz pyspec_built.tar.gz
@rm -f *.o *.bak core
@for i in ${DIRS}; do rm -f $$i/*.o $$i/*.bak ; done
@rm -fr python/datashm/build