forked from marti-vidal-i/PolConvert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.am
136 lines (121 loc) · 4.56 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#
# Makefile for PolConvert within DiFX tree
#
.NOTPARALLEL:
if HAVE_IT_ALL
PolConvertSources = \
CalTable.cpp CalTable.h \
DataIO.cpp DataIO.h \
DataIOFITS.cpp DataIOFITS.h \
DataIOSWIN.cpp DataIOSWIN.h \
Weighter.cpp Weighter.h \
_PolConvert.cpp _getAntInfo.cpp _PolGainSolve.cpp \
_XPCal.cpp _XPCalMF.cpp \
polconvert.xml setup.py task_polconvert.py
PostPolScripts = PP/runpolconvert.py PP/README.POLCONVERT \
PP/Estimate_DPFU.py PP/DPFU_scanner.py
ScriptCopies = runpolconvert.py README.POLCONVERT \
Estimate_DPFU.py DPFU_scanner.py
# BUILT_SOURCES doesn't help here.
BuiltSources = $(PolConvertSources) $(PostPolScripts)
bin_SCRIPTS = PP/prepolconvert.py PP/drivepolconvert.py \
PP/checkpolconvert.py PP/comparepolconvert.py \
PP/singlepolsolve.py
pkgdata_DATA = _PolConvert.so _getAntInfo.so _PolGainSolve.so \
_XPCal.so _XPCalMF.so \
PP/runpolconvert.py task_polconvert.py polconvert.xml \
PP/README.POLCONVERT PP/Estimate_DPFU.py PP/DPFU_scanner.py \
drivepclib.py solvepclib.py
# need to get the install first, then the local data install task
install-data-am: install-pkgdataDATA install-data-local
#
# One of casapy2 or casapy3 will be /bin/false based
# on seaching for python or python3 in $DIFXCASAPATH
#
# @BUILDMYTASKS@ &c are provided by configure to handle the two
# cases. The python2 method works through 5.8. The python3 method
# was broken in 6.1 and possibly fixed in 6.2. Tested in 6.4.
#
# The configure script for python2 will have set @BMTASKXML@ so that
# the chain of commands stops after one invocation.
#
# The standalone rewrite is not yet supported here.
#
if HAVE_CASA6
# the command invokes a script that uses buildmytasks in ...share/polconvert
bpt=$(srcdir)/PP/buildpy3tasks.sh
else
# the command below reduces to executing buildmytasks in ...share/polconvert
bpt=
endif
install-data-local: install-pkgdataDATA $(bpt)
@echo first statement -- run buildmytasks
-cd $(pkgdatadir) ;\
export PATH=@DIFXCASAPATH@${PATH_SEPARATOR}${PATH} ;\
cslp=@DIFXCASALIBPATH@${PATH_SEPARATOR}${LD_LIBRARY_PATH} ;\
export CASALD_LIBRARY_PATH=$$cslp ;\
$(bpt) @BUILDMYTASKS@ @BMTASKXML@ @BMTASKMOD@
-[ -f $(pkgdatadir)/polconvert_cli.py ] && \
echo cleaning up some weird casacore validation issue && \
sh -c "cd $(pkgdatadir) ; mv polconvert_cli.py polconvert_cli.py.bak ;\
sed '/casac.casac.utils...verify/s/casac/#casac/' \
polconvert_cli.py.bak > polconvert_cli.py"
#
# massive Kluge here to share code between scripts
#
drivepclib.py: $(srcdir)/PP/drivepolconvert.py
sed -e '/if __name__ == .__main__./,/eof/d' \
-e '/import solvepclib/s/^\#.*import/import/' \
-e '/def createCasaInput(/s/create/xxx_create/' \
-e '/if createCasaInput/s/create/spc.create/' \
-e '/enter.here/s/^.*/\# eof/' $< > $@
#sed -e '/if __name__ == .__main__./,/eof/d'
solvepclib.py: $(srcdir)/PP/singlepolsolve.py
sed -e '/if __name__ == .__main__./,9999d' \
-e '/enter.here/s/^.*/\# eof/' $< > $@
# brutal, but hey..
uninstall-hook:
rm -rf $(pkgdatadir)
# things created in pkgdata by buildmytasks
bmt = polconvert.py polconvert_cli.py mytasks.py *.pyc
uninstall-local:
cd $(pkgdatadir) ; rm -f $(bmt)
check-local:
-ls -l $(bindir)/*polconvert* $(pkgdatadir)
# no work for in-place builds, otherwise import the sources
copy.them:
[ $(abs_builddir) = $(abs_srcdir) ] || {\
for s in $(PolConvertSources); do cp -p $(srcdir)/$$s . ; done ;\
touch copy.them ;\
}
$(BuiltSources): copy.them
# python does an inplace build in the directory
# note that all .so files are build with this
build.sos: copy.them
export PATH=@DIFXCASAPATH@${PATH_SEPARATOR}${PATH} ;\
export LD_LIBRARY_PATH=@DIFXCASALIBPATH@${PATH_SEPARATOR}${LD_LIBRARY_PATH} ;\
[ -n "${DIFXCASAVENV}" ] && source ${DIFXCASAVENV} ;\
@CASAPYTHON@ setup.py build_ext --inplace
ls _*.so > build.sos
# Py3 generates complex .so names that we perhaps do not need to follow.
_PolConvert.so: build.sos
[ -f $@ ] || { pcso=`grep _PolConvert $<` ; cp -p $$pcso $@ ; }
_XPCal.so: build.sos
[ -f $@ ] || { pcso=`grep '_XPCal[^M]' $<` ; cp -p $$pcso $@ ; }
_XPCalMF.so: build.sos
[ -f $@ ] || { pcso=`grep _XPCalMF $<` ; cp -p $$pcso $@ ; }
_PolGainSolve.so: build.sos
[ -f $@ ] || { pcso=`grep _PolGainSolve $<` ; cp -p $$pcso $@ ; }
_getAntInfo.so: build.sos
[ -f $@ ] || { pcso=`grep _getAntInfo $<` ; cp -p $$pcso $@ ; }
# use copy.them to distinguish build and source dirs
clean-local:
rm -rf build *.so *.pyc
rm -rf polconvert.py polconvert_cli.py mytasks.py
rm -f $(ScriptCopies)
-[ -f copy.them ] && rm -f $(PolConvertSources) && rm -f copy.them
rm -f build.sos drivepclib.py solvepclib.py
endif
#
# eof
#