1 | ### Notice:
|
---|
2 | ### This Makefile assumes CASA+CASACore enviroment.
|
---|
3 | ### For who wants to build ASAP with older CASA without CASACore,
|
---|
4 | ### 1. Replace $(CASAPATH) with $(AIPSPATH).
|
---|
5 | ### 2. CASAINC should be
|
---|
6 | ### '-I$(CASAROOT)/code/include -I$(CASAROOT)/code/casa'
|
---|
7 | ### 3. Replase library names in G2CARCH '-lcasa_*' with '-l*'.
|
---|
8 | ### 4. Comment-IN the definition of 'CXXOPTS'.
|
---|
9 | TARGET := /tmp/_asap.so
|
---|
10 |
|
---|
11 | ifndef ASAPROOT
|
---|
12 | ASAPROOT := $(abspath ..)
|
---|
13 | endif
|
---|
14 | ATNFD := external-alma
|
---|
15 |
|
---|
16 | # the casa environment AIPSPATH has to be defined
|
---|
17 | CASAROOT := $(word 1, $(CASAPATH))
|
---|
18 | CASAARCH := $(word 2, $(CASAPATH))
|
---|
19 |
|
---|
20 | CXXFLAGS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CXXFLAGS eval_vars) && echo $$CXXFLAGS)
|
---|
21 | CXXOPTS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COPTFLAGS eval_vars) && echo $$COPTFLAGS)
|
---|
22 | LDFLAGS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=LD_FLAGS eval_vars) && echo $$LD_FLAGS)
|
---|
23 |
|
---|
24 | COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
|
---|
25 | CORELIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CORELIB eval_vars) && echo $$CORELIB)
|
---|
26 | WCSLIBLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIBD eval_vars) && echo $$WCSLIBLIBD)
|
---|
27 | WCSLIBLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIB eval_vars) && echo $$WCSLIBLIB)
|
---|
28 | PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
|
---|
29 | PYTHONLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIBD eval_vars) && echo $$PYTHONLIBD)
|
---|
30 | PYTHONINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONINCD eval_vars) && echo $$PYTHONINCD)
|
---|
31 | PYTHONLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIB eval_vars) && echo $$PYTHONLIB)
|
---|
32 | BOOSTROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=BOOSTROOT eval_vars) && echo $$BOOSTROOT)
|
---|
33 | RPFITSLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=RPFITSLIBD eval_vars) && echo $$RPFITSLIBD)
|
---|
34 | CFITSIOLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CFITSIOLIBD eval_vars) && echo $$CFITSIOLIBD)
|
---|
35 | CFITSIOINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CFITSIOINCD eval_vars) && echo $$CFITSIOINCD)
|
---|
36 |
|
---|
37 | CASAINC := -I$(CASAROOT)/code/include -I$(COREINCD) -I$(CASAROOT)/$(CASAARCH)/include
|
---|
38 | CASALIB := $(CASAROOT)/$(CASAARCH)/lib
|
---|
39 |
|
---|
40 | # the compiler
|
---|
41 | ifndef CXX
|
---|
42 | CXX := g++
|
---|
43 | endif
|
---|
44 |
|
---|
45 | # compiler flags
|
---|
46 | CXXFLAGS += -fPIC -DHAVE_LIBPYRAP
|
---|
47 |
|
---|
48 | PYRAPD := external/libpyrap
|
---|
49 | PYRAPLIBD := $(ASAPROOT)/$(PYRAPD)
|
---|
50 | PYRAPINCD := $(ASAPROOT)/$(PYRAPD)/pyrap-0.3.2
|
---|
51 | PYRAPLIB := -L$(PYRAPLIBD) -lpyrap
|
---|
52 |
|
---|
53 |
|
---|
54 | CFITSIOLIB := -lcfitsio
|
---|
55 |
|
---|
56 | #rpfits
|
---|
57 | RPFITSLIB := -lrpfits
|
---|
58 |
|
---|
59 | G2CROOT := /usr
|
---|
60 | G2CLIB := -lgfortran
|
---|
61 |
|
---|
62 | # links to external libraries
|
---|
63 | CASAPPLIB := -L$(ASAPROOT)/$(ATNFD) -latnf $(CORELIB) $(PYRAPLIB)\
|
---|
64 | -L$(WCSLIBLIBD) $(WCSLIBLIB) \
|
---|
65 | -L$(RPFITSLIBD) $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
|
---|
66 |
|
---|
67 | # darwin specific CASA flags
|
---|
68 | ifeq ($(shell uname), Darwin)
|
---|
69 | CASAPPLIB += -framework vecLib
|
---|
70 | else
|
---|
71 | CASAPPLIB += -llapack -lblas
|
---|
72 | endif
|
---|
73 |
|
---|
74 | LD := $(CXX)
|
---|
75 |
|
---|
76 | # has to be build with same g++ version as casa
|
---|
77 | BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
|
---|
78 | BOOSTINC := -I$(BOOSTROOT)/include/boost -I$(BOOSTROOT)/include
|
---|
79 |
|
---|
80 | LDFLAGS += -shared
|
---|
81 |
|
---|
82 |
|
---|
83 | # DO NOT MODIFY AFTER THIS
|
---|
84 | INCDIRS := -I. $(CASAINC) -I$(CFITSIOINCD) $(BOOSTINC) $(addprefix -I, $(PYTHONINCD)) -I$(ASAPROOT)/$(ATNFD) -I$(PYRAPINCD)
|
---|
85 | LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
|
---|
86 |
|
---|
87 | CCOBJECTS := MathUtils.o \
|
---|
88 | RowAccumulator.o \
|
---|
89 | Logger.o \
|
---|
90 | LineCatalog.o \
|
---|
91 | STAttr.o \
|
---|
92 | STHeader.o \
|
---|
93 | STFiller.o \
|
---|
94 | STMath.o \
|
---|
95 | STSubTable.o \
|
---|
96 | STMolecules.o \
|
---|
97 | STTcal.o \
|
---|
98 | STFocus.o \
|
---|
99 | STWeather.o \
|
---|
100 | STFrequencies.o \
|
---|
101 | STHistory.o \
|
---|
102 | STSelector.o \
|
---|
103 | STLineFinder.o \
|
---|
104 | STFitter.o \
|
---|
105 | STFitEntry.o \
|
---|
106 | STFit.o \
|
---|
107 | STPol.o \
|
---|
108 | STPolLinear.o \
|
---|
109 | STPolCircular.o \
|
---|
110 | STPolStokes.o \
|
---|
111 | STWriter.o \
|
---|
112 | STAsciiWriter.o \
|
---|
113 | STFITSImageWriter.o \
|
---|
114 | STAtmosphere.o \
|
---|
115 | Scantable.o \
|
---|
116 | FillerBase.o \
|
---|
117 | NROFiller.o \
|
---|
118 | PKSFiller.o \
|
---|
119 | AsapLogSink.o \
|
---|
120 | Templates.o
|
---|
121 |
|
---|
122 | PYOBJECTS := python_Scantable.o \
|
---|
123 | python_STFiller.o \
|
---|
124 | python_STSelector.o \
|
---|
125 | python_STMath.o \
|
---|
126 | python_Fitter.o \
|
---|
127 | python_Logger.o \
|
---|
128 | python_STLineFinder.o \
|
---|
129 | python_STFitEntry.o \
|
---|
130 | python_STWriter.o \
|
---|
131 | python_LineCatalog.o \
|
---|
132 | python_SrcType.o \
|
---|
133 | python_STAtmosphere.o \
|
---|
134 | python_STCoordinate.o \
|
---|
135 | python_Filler.o \
|
---|
136 | python_LogSink.o \
|
---|
137 | python_asap.o
|
---|
138 |
|
---|
139 | OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
|
---|
140 |
|
---|
141 | HEADERS := MathUtils.h \
|
---|
142 | LineCatalog.h \
|
---|
143 | Lorentzian1D.h \
|
---|
144 | Lorentzian1DParam.h \
|
---|
145 | Logger.h \
|
---|
146 | STAttr.h \
|
---|
147 | STHeader.h \
|
---|
148 | Scantable.h \
|
---|
149 | STFiller.h \
|
---|
150 | STMath.h \
|
---|
151 | RowAccumulator.h \
|
---|
152 | STSubTable.h \
|
---|
153 | STMolecules.h \
|
---|
154 | STTcal.h \
|
---|
155 | STFocus.h \
|
---|
156 | STWeather.h \
|
---|
157 | STHistory.h \
|
---|
158 | STFrequencies.h \
|
---|
159 | STDefs.h \
|
---|
160 | STWriter.h \
|
---|
161 | STSelector.h \
|
---|
162 | STFitter.h \
|
---|
163 | STFit.h \
|
---|
164 | STFitEntry.h \
|
---|
165 | STLineFinder.h \
|
---|
166 | Factory.h \
|
---|
167 | FactoryBase.h \
|
---|
168 | STPol.h \
|
---|
169 | STPolStokes.h \
|
---|
170 | STPolCircular.h \
|
---|
171 | STPolLinear.h \
|
---|
172 | STWriter.h \
|
---|
173 | STAsciiWriter.h \
|
---|
174 | STFITSImageWriter.h \
|
---|
175 | IndexedCompare.h \
|
---|
176 | STAtmosphere.h \
|
---|
177 | STCoordinate.h \
|
---|
178 | FillerBase.h \
|
---|
179 | NROFiller.h \
|
---|
180 | PKSFiller.h \
|
---|
181 | AsapLogSink.h
|
---|
182 |
|
---|
183 |
|
---|
184 | # external libraries
|
---|
185 | ifeq ($(shell uname), Darwin)
|
---|
186 | ATNF := $(ASAPROOT)/$(ATNFD)/libatnf.dylib
|
---|
187 | PYRAP := $(ASAPROOT)/$(PYRAPD)/libpyrap.dylib
|
---|
188 | CASACORELIB = $(CASALIB)/libcasa_casa.dylib \
|
---|
189 | $(CASALIB)/libcasa_components.dylib \
|
---|
190 | $(CASALIB)/libcasa_coordinates.dylib \
|
---|
191 | $(CASALIB)/libcasa_derivedmscal.dylib \
|
---|
192 | $(CASALIB)/libcasa_fits.dylib \
|
---|
193 | $(CASALIB)/libcasa_images.dylib \
|
---|
194 | $(CASALIB)/libcasa_lattices.dylib \
|
---|
195 | $(CASALIB)/libcasa_measures.dylib \
|
---|
196 | $(CASALIB)/libcasa_mirlib.dylib \
|
---|
197 | $(CASALIB)/libcasa_msfits.dylib \
|
---|
198 | $(CASALIB)/libcasa_ms.dylib \
|
---|
199 | $(CASALIB)/libcasa_scimath_f.dylib \
|
---|
200 | $(CASALIB)/libcasa_scimath.dylib \
|
---|
201 | $(CASALIB)/libcasa_tables.dylib
|
---|
202 | else
|
---|
203 | ATNF := $(ASAPROOT)/$(ATNFD)/libatnf.so
|
---|
204 | PYRAP := $(ASAPROOT)/$(PYRAPD)/libpyrap.so
|
---|
205 | CASACORELIB = $(CASALIB)/libcasa_casa.so \
|
---|
206 | $(CASALIB)/libcasa_components.so \
|
---|
207 | $(CASALIB)/libcasa_coordinates.so \
|
---|
208 | $(CASALIB)/libcasa_derivedmscal.so \
|
---|
209 | $(CASALIB)/libcasa_fits.so \
|
---|
210 | $(CASALIB)/libcasa_images.so \
|
---|
211 | $(CASALIB)/libcasa_lattices.so \
|
---|
212 | $(CASALIB)/libcasa_measures.so \
|
---|
213 | $(CASALIB)/libcasa_mirlib.so \
|
---|
214 | $(CASALIB)/libcasa_msfits.so \
|
---|
215 | $(CASALIB)/libcasa_ms.so \
|
---|
216 | $(CASALIB)/libcasa_scimath_f.so \
|
---|
217 | $(CASALIB)/libcasa_scimath.so \
|
---|
218 | $(CASALIB)/libcasa_tables.so
|
---|
219 | endif
|
---|
220 |
|
---|
221 | STATICCCLIB := libasap.a
|
---|
222 | MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
|
---|
223 |
|
---|
224 | .SUFFIXES: .c .o .cpp .cc .cxx .C
|
---|
225 |
|
---|
226 | .cpp.o:
|
---|
227 | -@ echo
|
---|
228 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
229 |
|
---|
230 | .cc.o:
|
---|
231 | -@ echo
|
---|
232 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
233 |
|
---|
234 | .cxx.o:
|
---|
235 | -@ echo
|
---|
236 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
237 |
|
---|
238 | .C.o:
|
---|
239 | -@ echo
|
---|
240 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
241 |
|
---|
242 |
|
---|
243 | .PHONY : all clean objects realclean relink
|
---|
244 |
|
---|
245 | all : $(TARGET)
|
---|
246 |
|
---|
247 | relink : cleanso $(TARGET)
|
---|
248 |
|
---|
249 | objects : $(OBJECTS)
|
---|
250 |
|
---|
251 | $(TARGET) : $(OBJECTS)
|
---|
252 | -@ echo
|
---|
253 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
254 |
|
---|
255 | $(OBJECTS) : $(HEADERS) $(CASACORELIB) $(ATNF) $(PYRAP)
|
---|
256 |
|
---|
257 | staticlib: $(MEMBERS)
|
---|
258 |
|
---|
259 | clean :
|
---|
260 | -rm -f $(OBJECTS)
|
---|
261 |
|
---|
262 | cleanso :
|
---|
263 | -rm -f $(TARGET)
|
---|
264 |
|
---|
265 | realclean : clean cleanso
|
---|
266 |
|
---|
267 | test: objects tasap2.o
|
---|
268 | -@ echo
|
---|
269 | $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
|
---|