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 | CASACORELIB := $(filter $(CASALIB)/libcasa%, $(CORELIB))
|
---|
40 |
|
---|
41 | # the compiler
|
---|
42 | ifndef CXX
|
---|
43 | CXX := g++
|
---|
44 | endif
|
---|
45 |
|
---|
46 | # compiler flags
|
---|
47 | CXXFLAGS += -fPIC -DHAVE_LIBPYRAP
|
---|
48 |
|
---|
49 | PYRAPD := external/libpyrap
|
---|
50 | PYRAPLIBD := $(ASAPROOT)/$(PYRAPD)
|
---|
51 | PYRAPINCD := $(ASAPROOT)/$(PYRAPD)/pyrap-0.3.2
|
---|
52 | PYRAPLIB := -L$(PYRAPLIBD) -lpyrap
|
---|
53 |
|
---|
54 |
|
---|
55 | CFITSIOLIB := -lcfitsio
|
---|
56 |
|
---|
57 | #rpfits
|
---|
58 | RPFITSLIB := -lrpfits
|
---|
59 |
|
---|
60 | G2CROOT := /usr
|
---|
61 | G2CLIB := -lgfortran
|
---|
62 |
|
---|
63 | # links to external libraries
|
---|
64 | CASAPPLIB := -L$(ASAPROOT)/$(ATNFD) -latnf $(CORELIB) $(PYRAPLIB)\
|
---|
65 | -L$(WCSLIBLIBD) $(WCSLIBLIB) \
|
---|
66 | -L$(RPFITSLIBD) $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
|
---|
67 |
|
---|
68 | # darwin specific CASA flags
|
---|
69 | ifeq ($(shell uname), Darwin)
|
---|
70 | CASAPPLIB += -framework vecLib
|
---|
71 | else
|
---|
72 | CASAPPLIB += -llapack -lblas
|
---|
73 | endif
|
---|
74 |
|
---|
75 | LD := $(CXX)
|
---|
76 |
|
---|
77 | # has to be build with same g++ version as casa
|
---|
78 | BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
|
---|
79 | BOOSTINC := -I$(BOOSTROOT)/include/boost -I$(BOOSTROOT)/include
|
---|
80 |
|
---|
81 | LDFLAGS += -shared
|
---|
82 |
|
---|
83 |
|
---|
84 | # DO NOT MODIFY AFTER THIS
|
---|
85 | INCDIRS := -I. $(CASAINC) -I$(CFITSIOINCD) $(BOOSTINC) $(addprefix -I, $(PYTHONINCD)) -I$(ASAPROOT)/$(ATNFD) -I$(PYRAPINCD)
|
---|
86 | LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
|
---|
87 |
|
---|
88 | CCOBJECTS := MathUtils.o \
|
---|
89 | RowAccumulator.o \
|
---|
90 | Logger.o \
|
---|
91 | LineCatalog.o \
|
---|
92 | STAttr.o \
|
---|
93 | STHeader.o \
|
---|
94 | STFiller.o \
|
---|
95 | STMath.o \
|
---|
96 | STSubTable.o \
|
---|
97 | STMolecules.o \
|
---|
98 | STTcal.o \
|
---|
99 | STFocus.o \
|
---|
100 | STWeather.o \
|
---|
101 | STFrequencies.o \
|
---|
102 | STHistory.o \
|
---|
103 | STSelector.o \
|
---|
104 | STLineFinder.o \
|
---|
105 | STFitter.o \
|
---|
106 | STFitEntry.o \
|
---|
107 | STFit.o \
|
---|
108 | STPol.o \
|
---|
109 | STPolLinear.o \
|
---|
110 | STPolCircular.o \
|
---|
111 | STPolStokes.o \
|
---|
112 | STWriter.o \
|
---|
113 | STAsciiWriter.o \
|
---|
114 | STFITSImageWriter.o \
|
---|
115 | STAtmosphere.o \
|
---|
116 | Scantable.o \
|
---|
117 | FillerBase.o \
|
---|
118 | NROFiller.o \
|
---|
119 | PKSFiller.o \
|
---|
120 | AsapLogSink.o \
|
---|
121 | Templates.o
|
---|
122 |
|
---|
123 | PYOBJECTS := python_Scantable.o \
|
---|
124 | python_STFiller.o \
|
---|
125 | python_STSelector.o \
|
---|
126 | python_STMath.o \
|
---|
127 | python_Fitter.o \
|
---|
128 | python_Logger.o \
|
---|
129 | python_STLineFinder.o \
|
---|
130 | python_STFitEntry.o \
|
---|
131 | python_STWriter.o \
|
---|
132 | python_LineCatalog.o \
|
---|
133 | python_SrcType.o \
|
---|
134 | python_STAtmosphere.o \
|
---|
135 | python_STCoordinate.o \
|
---|
136 | python_Filler.o \
|
---|
137 | python_LogSink.o \
|
---|
138 | python_asap.o
|
---|
139 |
|
---|
140 | OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
|
---|
141 |
|
---|
142 | HEADERS := MathUtils.h \
|
---|
143 | LineCatalog.h \
|
---|
144 | Lorentzian1D.h \
|
---|
145 | Lorentzian1DParam.h \
|
---|
146 | Logger.h \
|
---|
147 | STAttr.h \
|
---|
148 | STHeader.h \
|
---|
149 | Scantable.h \
|
---|
150 | STFiller.h \
|
---|
151 | STMath.h \
|
---|
152 | RowAccumulator.h \
|
---|
153 | STSubTable.h \
|
---|
154 | STMolecules.h \
|
---|
155 | STTcal.h \
|
---|
156 | STFocus.h \
|
---|
157 | STWeather.h \
|
---|
158 | STHistory.h \
|
---|
159 | STFrequencies.h \
|
---|
160 | STDefs.h \
|
---|
161 | STWriter.h \
|
---|
162 | STSelector.h \
|
---|
163 | STFitter.h \
|
---|
164 | STFit.h \
|
---|
165 | STFitEntry.h \
|
---|
166 | STLineFinder.h \
|
---|
167 | Factory.h \
|
---|
168 | FactoryBase.h \
|
---|
169 | STPol.h \
|
---|
170 | STPolStokes.h \
|
---|
171 | STPolCircular.h \
|
---|
172 | STPolLinear.h \
|
---|
173 | STWriter.h \
|
---|
174 | STAsciiWriter.h \
|
---|
175 | STFITSImageWriter.h \
|
---|
176 | IndexedCompare.h \
|
---|
177 | STAtmosphere.h \
|
---|
178 | STCoordinate.h \
|
---|
179 | FillerBase.h \
|
---|
180 | NROFiller.h \
|
---|
181 | PKSFiller.h \
|
---|
182 | AsapLogSink.h
|
---|
183 |
|
---|
184 | # external libraries
|
---|
185 | ifeq ($(shell uname), Darwin)
|
---|
186 | ATNF := $(ASAPROOT)/$(ATNFD)/libatnf.dylib
|
---|
187 | PYRAP := $(ASAPROOT)/$(PYRAPD)/libpyrap.dylib
|
---|
188 | else
|
---|
189 | ATNF := $(ASAPROOT)/$(ATNFD)/libatnf.so
|
---|
190 | PYRAP := $(ASAPROOT)/$(PYRAPD)/libpyrap.so
|
---|
191 | endif
|
---|
192 |
|
---|
193 | STATICCCLIB := libasap.a
|
---|
194 | MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
|
---|
195 |
|
---|
196 | .SUFFIXES: .c .o .cpp .cc .cxx .C
|
---|
197 |
|
---|
198 | .cpp.o:
|
---|
199 | -@ echo
|
---|
200 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
201 |
|
---|
202 | .cc.o:
|
---|
203 | -@ echo
|
---|
204 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
205 |
|
---|
206 | .cxx.o:
|
---|
207 | -@ echo
|
---|
208 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
209 |
|
---|
210 | .C.o:
|
---|
211 | -@ echo
|
---|
212 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
213 |
|
---|
214 |
|
---|
215 | .PHONY : all clean objects realclean relink
|
---|
216 |
|
---|
217 | all : $(TARGET)
|
---|
218 |
|
---|
219 | relink : cleanso $(TARGET)
|
---|
220 |
|
---|
221 | objects : $(OBJECTS)
|
---|
222 |
|
---|
223 | $(TARGET) : $(OBJECTS)
|
---|
224 | -@ echo
|
---|
225 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
226 |
|
---|
227 | $(OBJECTS) : $(HEADERS) $(CASACORELIB) $(ATNF) $(PYRAP)
|
---|
228 |
|
---|
229 | staticlib: $(MEMBERS)
|
---|
230 |
|
---|
231 | clean :
|
---|
232 | -rm -f $(OBJECTS)
|
---|
233 |
|
---|
234 | cleanso :
|
---|
235 | -rm -f $(TARGET)
|
---|
236 |
|
---|
237 | realclean : clean cleanso
|
---|
238 |
|
---|
239 | test: objects tasap2.o
|
---|
240 | -@ echo
|
---|
241 | $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
|
---|