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 | # the casa environment AIPSPATH has to be defined
|
---|
12 | CASAROOT := $(word 1, $(CASAPATH))
|
---|
13 | CASAARCH := $(word 2, $(CASAPATH))
|
---|
14 |
|
---|
15 | COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
|
---|
16 | CORELIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CORELIB eval_vars) && echo $$CORELIB)
|
---|
17 | WCSLIBLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIBD eval_vars) && echo $$WCSLIBLIBD)
|
---|
18 | WCSLIBLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIB eval_vars) && echo $$WCSLIBLIB)
|
---|
19 | PYTHONLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIBD eval_vars) && echo $$PYTHONLIBD)
|
---|
20 | PYTHONINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONINCD eval_vars) && echo $$PYTHONINCD)
|
---|
21 | PYTHONLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIB eval_vars) && echo $$PYTHONLIB)
|
---|
22 | BOOSTROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=BOOSTROOT eval_vars) && echo $$BOOSTROOT)
|
---|
23 |
|
---|
24 | CASAINC := -I$(CASAROOT)/code/include -I$(COREINCD) -I$(CASAROOT)/$(CASAARCH)/include
|
---|
25 | CASALIB := $(CASAROOT)/$(CASAARCH)/lib
|
---|
26 | USELIB := lib64
|
---|
27 |
|
---|
28 | # the compiler
|
---|
29 | ifndef CXX
|
---|
30 | CXX := g++
|
---|
31 | endif
|
---|
32 |
|
---|
33 | # compiler flags
|
---|
34 | CXXFLAGS := -fPIC -O3 -g
|
---|
35 | CXXFLAGS += -ansi -Wno-long-long -Wall
|
---|
36 | CXXOPTS := -DAIPS_64B
|
---|
37 |
|
---|
38 | # darwin specific flags
|
---|
39 | ifeq "$(CASAARCH)" "darwin"
|
---|
40 | CXXFLAGS +=-DAIPS_DARWIN
|
---|
41 | CXXFLAGS += -Wno-long-double
|
---|
42 | endif
|
---|
43 |
|
---|
44 | # cfitsio
|
---|
45 | CFITSIOROOT := /usr
|
---|
46 | CFITSIOINC := -I$(CFITSIOROOT)/include/cfitsio
|
---|
47 | CFITSIOLIB := -lcfitsio
|
---|
48 |
|
---|
49 | #rpfits
|
---|
50 | RPFITSROOT := /usr
|
---|
51 | RPFITSLIB := -lrpfits
|
---|
52 |
|
---|
53 | G2CROOT := /usr
|
---|
54 | G2CLIB := -lgfortran
|
---|
55 |
|
---|
56 | # This assumes all casa libs are static only (*.a)
|
---|
57 | # if not than there might by symbol resolution errors.
|
---|
58 | CASAPPLIB := -L$(CASALIB) -latnf $(CORELIB) \
|
---|
59 | /usr/lib64/libwcs.so \
|
---|
60 | $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
|
---|
61 | # -L$(WCSLIBLIBD) $(WCSLIBLIB) \
|
---|
62 |
|
---|
63 | # darwin specific CASA flags
|
---|
64 | ifeq "$(CASAARCH)" "darwin"
|
---|
65 | CASAPPLIB += -framework vecLib
|
---|
66 | else
|
---|
67 | CASAPPLIB += -llapack -lblas
|
---|
68 | endif
|
---|
69 |
|
---|
70 | # python
|
---|
71 | PYTHONINC := $(addprefix -I,$(PYTHONINCD))
|
---|
72 | PYTHONLIB := -L$(PYTHONLIBD) $(PYTHONLIB)
|
---|
73 |
|
---|
74 | # use python universal build
|
---|
75 | ifeq "$(CASAARCH)" "darwin"
|
---|
76 | PYVERSION := 2.5
|
---|
77 | PYTHONROOT := /Library/Frameworks/Python.framework/Versions/$(PYVERSION)
|
---|
78 | PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
|
---|
79 | PYTHONLIB := -L$(PYTHONROOT)/lib -framework Python
|
---|
80 | endif
|
---|
81 |
|
---|
82 | # the linker
|
---|
83 | LD := $(CXX)
|
---|
84 |
|
---|
85 | # has to be build with same g++ version as casa
|
---|
86 | BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
|
---|
87 | BOOSTINC := -I$(BOOSTROOT)/include/boost -I$(BOOSTROOT)/include
|
---|
88 |
|
---|
89 | LDFLAGS := -shared -Wl$(TARGET) -s -Xlinker -rpath -Xlinker $(BOOSTROOT)/lib:$(PYTHONROOT)/lib:$(CASALIB)
|
---|
90 | ifeq "$(CASAARCH)" "darwin"
|
---|
91 | LDFLAGS := -bundle
|
---|
92 | endif
|
---|
93 |
|
---|
94 |
|
---|
95 | # DO NOT MODIFY AFTER THIS
|
---|
96 | INCDIRS := -I. $(CASAINC) $(CFITSIOINC) $(BOOSTINC) $(PYTHONINC)
|
---|
97 | LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
|
---|
98 |
|
---|
99 | CCOBJECTS := MathUtils.o \
|
---|
100 | RowAccumulator.o \
|
---|
101 | Logger.o \
|
---|
102 | LineCatalog.o \
|
---|
103 | STAttr.o \
|
---|
104 | STHeader.o \
|
---|
105 | STFiller.o \
|
---|
106 | STMath.o \
|
---|
107 | STSubTable.o \
|
---|
108 | STMolecules.o \
|
---|
109 | STTcal.o \
|
---|
110 | STFocus.o \
|
---|
111 | STWeather.o \
|
---|
112 | STFrequencies.o \
|
---|
113 | STHistory.o \
|
---|
114 | STSelector.o \
|
---|
115 | STLineFinder.o \
|
---|
116 | STFitter.o \
|
---|
117 | STFitEntry.o \
|
---|
118 | STFit.o \
|
---|
119 | STPol.o \
|
---|
120 | STPolLinear.o \
|
---|
121 | STPolCircular.o \
|
---|
122 | STPolStokes.o \
|
---|
123 | STWriter.o \
|
---|
124 | STAsciiWriter.o \
|
---|
125 | STFITSImageWriter.o \
|
---|
126 | Scantable.o \
|
---|
127 | Templates.o
|
---|
128 | PYOBJECTS := python_Scantable.o \
|
---|
129 | python_STFiller.o \
|
---|
130 | python_STSelector.o \
|
---|
131 | python_STMath.o \
|
---|
132 | python_Fitter.o \
|
---|
133 | python_Logger.o \
|
---|
134 | python_STLineFinder.o \
|
---|
135 | python_STFitEntry.o \
|
---|
136 | python_STWriter.o \
|
---|
137 | python_LineCatalog.o \
|
---|
138 | python_SrcType.o \
|
---|
139 | python_asap.o
|
---|
140 |
|
---|
141 | OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
|
---|
142 |
|
---|
143 | HEADERS := MathUtils.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 |
|
---|
177 | STATICCCLIB := libasap.a
|
---|
178 | MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
|
---|
179 |
|
---|
180 | .SUFFIXES: .c .o .cpp .cc .cxx .C
|
---|
181 |
|
---|
182 | .cpp.o:
|
---|
183 | -@ echo
|
---|
184 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
185 |
|
---|
186 | .cc.o:
|
---|
187 | -@ echo
|
---|
188 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
189 |
|
---|
190 | .cxx.o:
|
---|
191 | -@ echo
|
---|
192 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
193 |
|
---|
194 | .C.o:
|
---|
195 | -@ echo
|
---|
196 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
197 |
|
---|
198 |
|
---|
199 | .PHONY : all clean objects realclean relink
|
---|
200 |
|
---|
201 | all : $(TARGET)
|
---|
202 |
|
---|
203 | relink : cleanso $(TARGET)
|
---|
204 |
|
---|
205 | objects : $(OBJECTS)
|
---|
206 |
|
---|
207 | $(TARGET) : $(OBJECTS)
|
---|
208 | -@ echo
|
---|
209 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
210 |
|
---|
211 | $(OBJECTS) : $(HEADERS)
|
---|
212 |
|
---|
213 | staticlib: $(MEMBERS)
|
---|
214 |
|
---|
215 | clean :
|
---|
216 | -rm -f $(OBJECTS)
|
---|
217 |
|
---|
218 | cleanso :
|
---|
219 | -rm -f $(TARGET)
|
---|
220 |
|
---|
221 | realclean : clean cleanso
|
---|
222 |
|
---|
223 | test: objects tasap2.o
|
---|
224 | -@ echo
|
---|
225 | $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
|
---|