source: trunk/src/Makefile@ 1952

Last change on this file since 1952 was 1951, checked in by Takeshi Nakazato, 14 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Updated Makefile such that libatnf.so and _asap.so depend on
casacore libraries so that those libraries are rebuilt if
casacore is updated.


File size: 8.1 KB
Line 
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'.
9TARGET := /tmp/_asap.so
10
11ifndef ASAPROOT
12 ASAPROOT := $(abspath ..)
13endif
14ATNFD := external-alma
15
16# the casa environment AIPSPATH has to be defined
17CASAROOT := $(word 1, $(CASAPATH))
18CASAARCH := $(word 2, $(CASAPATH))
19
20CXXFLAGS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CXXFLAGS eval_vars) && echo $$CXXFLAGS)
21CXXOPTS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COPTFLAGS eval_vars) && echo $$COPTFLAGS)
22LDFLAGS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=LD_FLAGS eval_vars) && echo $$LD_FLAGS)
23
24COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
25CORELIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CORELIB eval_vars) && echo $$CORELIB)
26WCSLIBLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIBD eval_vars) && echo $$WCSLIBLIBD)
27WCSLIBLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIB eval_vars) && echo $$WCSLIBLIB)
28PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
29PYTHONLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIBD eval_vars) && echo $$PYTHONLIBD)
30PYTHONINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONINCD eval_vars) && echo $$PYTHONINCD)
31PYTHONLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIB eval_vars) && echo $$PYTHONLIB)
32BOOSTROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=BOOSTROOT eval_vars) && echo $$BOOSTROOT)
33RPFITSLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=RPFITSLIBD eval_vars) && echo $$RPFITSLIBD)
34CFITSIOLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CFITSIOLIBD eval_vars) && echo $$CFITSIOLIBD)
35CFITSIOINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CFITSIOINCD eval_vars) && echo $$CFITSIOINCD)
36
37CASAINC := -I$(CASAROOT)/code/include -I$(COREINCD) -I$(CASAROOT)/$(CASAARCH)/include
38CASALIB := $(CASAROOT)/$(CASAARCH)/lib
39
40# the compiler
41ifndef CXX
42 CXX := g++
43endif
44
45# compiler flags
46CXXFLAGS += -fPIC -DHAVE_LIBPYRAP
47
48PYRAPD := external/libpyrap
49PYRAPLIBD := $(ASAPROOT)/$(PYRAPD)
50PYRAPINCD := $(ASAPROOT)/$(PYRAPD)/pyrap-0.3.2
51PYRAPLIB := -L$(PYRAPLIBD) -lpyrap
52
53
54CFITSIOLIB := -lcfitsio
55
56#rpfits
57RPFITSLIB := -lrpfits
58
59G2CROOT := /usr
60G2CLIB := -lgfortran
61
62# links to external libraries
63CASAPPLIB := -L$(ASAPROOT)/$(ATNFD) -latnf $(CORELIB) $(PYRAPLIB)\
64 -L$(WCSLIBLIBD) $(WCSLIBLIB) \
65 -L$(RPFITSLIBD) $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
66
67# darwin specific CASA flags
68ifeq ($(shell uname), Darwin)
69 CASAPPLIB += -framework vecLib
70else
71 CASAPPLIB += -llapack -lblas
72endif
73
74LD := $(CXX)
75
76# has to be build with same g++ version as casa
77BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
78BOOSTINC := -I$(BOOSTROOT)/include/boost -I$(BOOSTROOT)/include
79
80LDFLAGS += -shared
81
82
83# DO NOT MODIFY AFTER THIS
84INCDIRS := -I. $(CASAINC) -I$(CFITSIOINCD) $(BOOSTINC) $(addprefix -I, $(PYTHONINCD)) -I$(ASAPROOT)/$(ATNFD) -I$(PYRAPINCD)
85LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
86
87CCOBJECTS := 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
122PYOBJECTS := 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
139OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
140
141HEADERS := 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
185ifeq ($(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
202else
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
219endif
220
221STATICCCLIB := libasap.a
222MEMBERS := $(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
245all : $(TARGET)
246
247relink : cleanso $(TARGET)
248
249objects : $(OBJECTS)
250
251$(TARGET) : $(OBJECTS)
252 -@ echo
253 $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
254
255$(OBJECTS) : $(HEADERS) $(CASACORELIB) $(ATNF) $(PYRAP)
256
257staticlib: $(MEMBERS)
258
259clean :
260 -rm -f $(OBJECTS)
261
262cleanso :
263 -rm -f $(TARGET)
264
265realclean : clean cleanso
266
267test: objects tasap2.o
268 -@ echo
269 $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
Note: See TracBrowser for help on using the repository browser.