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