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 | CASAINC := -I$(CASAROOT)/code/include -I$(CASAROOT)/$(CASAARCH)/include/casacore -I$(CASAROOT)/$(CASAARCH)/include
|
---|
15 | CASALIB := $(CASAROOT)/$(CASAARCH)/lib
|
---|
16 |
|
---|
17 |
|
---|
18 | # the compiler
|
---|
19 | ifndef CXX
|
---|
20 | CXX := g++
|
---|
21 | endif
|
---|
22 |
|
---|
23 | # compiler flags
|
---|
24 | CXXFLAGS := -fPIC -O3 -g
|
---|
25 | CXXFLAGS += -ansi -Wno-long-long -Wall
|
---|
26 | #CXXOPTS := -DAIPS_NO_TEMPLATE_SRC
|
---|
27 |
|
---|
28 | # darwin specific flags
|
---|
29 | ifeq "$(CASAARCH)" "darwin"
|
---|
30 | CXXFLAGS +=-DAIPS_DARWIN
|
---|
31 | CXXFLAGS += -Wno-long-double
|
---|
32 | endif
|
---|
33 |
|
---|
34 | # cfitsio
|
---|
35 | CFITSIOROOT := /usr
|
---|
36 | CFITSIOINC := -I$(CFITSIOROOT)/include/cfitsio
|
---|
37 | #CFITSIOLIB := -L$(CFITSIOROOT)/lib -lcfitsio
|
---|
38 | CFITSIOLIB := -lcfitsio
|
---|
39 |
|
---|
40 | #rpfits
|
---|
41 | RPFITSROOT := /usr
|
---|
42 | #RPFITSLIB := $(RPFITSROOT)/lib/librpfits.a
|
---|
43 | RPFITSLIB := -lrpfits
|
---|
44 |
|
---|
45 | #wcs
|
---|
46 | WCSLIB := -lwcs
|
---|
47 |
|
---|
48 | G2CROOT := /usr
|
---|
49 | #G2CARCH := $(G2CROOT)/lib/gcc/i386-apple-darwin8.7.1/4.2.0/libgcc.a
|
---|
50 | #G2CARCH := $(G2CROOT)/lib/gcc/powerpc-apple-darwin8.7.0/4.2.0/libgcc.a
|
---|
51 | G2CARCH := $(G2CROOT)/lib/gcc/i386-redhat-linux/4.1.2/libgcc.a
|
---|
52 | #G2CLIB := $(G2CROOT)/lib/libgfortran.a
|
---|
53 | G2CLIB := $(G2CARCH)
|
---|
54 | #G2CLIB := -lg2c
|
---|
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) \
|
---|
59 | -latnf -lcasa_images -lcasa_ms -lcasa_components -lcasa_coordinates \
|
---|
60 | -lcasa_lattices -lcasa_fits -lcasa_measures -lcasa_measures_f \
|
---|
61 | -lcasa_tables -lcasa_scimath -lcasa_scimath_f -lcasa_casa \
|
---|
62 | $(WCSLIB) \
|
---|
63 | $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
|
---|
64 |
|
---|
65 | # darwin specific CASA flags
|
---|
66 | ifeq "$(CASAARCH)" "darwin"
|
---|
67 | CASAPPLIB += -framework vecLib
|
---|
68 | else
|
---|
69 | CASAPPLIB += -llapack -lblas
|
---|
70 | endif
|
---|
71 |
|
---|
72 | # python
|
---|
73 | PYVERSION := 2.5
|
---|
74 | PYTHONROOT := /usr/lib/casapy
|
---|
75 | PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
|
---|
76 | PYTHONLIB := -L$(PYTHONROOT)/lib -lpython$(PYVERSION)
|
---|
77 |
|
---|
78 | # use python universal build
|
---|
79 | ifeq "$(CASAARCH)" "darwin"
|
---|
80 | PYVERSION := 2.5
|
---|
81 | PYTHONROOT := /Library/Frameworks/Python.framework/Versions/$(PYVERSION)
|
---|
82 | PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
|
---|
83 | PYTHONLIB := -L$(PYTHONROOT)/lib -framework Python
|
---|
84 | endif
|
---|
85 |
|
---|
86 | # the linker
|
---|
87 | LD := $(CXX)
|
---|
88 |
|
---|
89 | # has to be build with same g++ version as casa
|
---|
90 | #BOOSTROOT := /home/casa/boost
|
---|
91 | BOOSTROOT := /usr/lib/casapy
|
---|
92 | #BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python-gcc34
|
---|
93 | BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
|
---|
94 | #BOOSTINC := -I$(BOOSTROOT)/include/boost-1_35
|
---|
95 | BOOSTINC := -I$(BOOSTROOT)/include/boost
|
---|
96 |
|
---|
97 | LDFLAGS := -shared -Wl$(TARGET) -s -Xlinker -rpath -Xlinker $(BOOSTROOT)/lib:$(PYTHONROOT)/lib:$(CASALIB)
|
---|
98 | ifeq "$(CASAARCH)" "darwin"
|
---|
99 | LDFLAGS := -bundle
|
---|
100 | endif
|
---|
101 |
|
---|
102 |
|
---|
103 | # DO NOT MODIFY AFTER THIS
|
---|
104 | INCDIRS := -I. $(CASAINC) $(CFITSIOINC) $(BOOSTINC) $(PYTHONINC)
|
---|
105 | LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
|
---|
106 |
|
---|
107 | CCOBJECTS := MathUtils.o \
|
---|
108 | RowAccumulator.o \
|
---|
109 | Logger.o \
|
---|
110 | LineCatalog.o \
|
---|
111 | STAttr.o \
|
---|
112 | STHeader.o \
|
---|
113 | STFiller.o \
|
---|
114 | STMath.o \
|
---|
115 | STSubTable.o \
|
---|
116 | STMolecules.o \
|
---|
117 | STTcal.o \
|
---|
118 | STFocus.o \
|
---|
119 | STWeather.o \
|
---|
120 | STFrequencies.o \
|
---|
121 | STHistory.o \
|
---|
122 | STSelector.o \
|
---|
123 | STLineFinder.o \
|
---|
124 | STFitter.o \
|
---|
125 | STFitEntry.o \
|
---|
126 | STFit.o \
|
---|
127 | STPol.o \
|
---|
128 | STPolLinear.o \
|
---|
129 | STPolCircular.o \
|
---|
130 | STPolStokes.o \
|
---|
131 | STWriter.o \
|
---|
132 | STAsciiWriter.o \
|
---|
133 | STFITSImageWriter.o \
|
---|
134 | Scantable.o \
|
---|
135 | Templates.o
|
---|
136 | PYOBJECTS := python_Scantable.o \
|
---|
137 | python_STFiller.o \
|
---|
138 | python_STSelector.o \
|
---|
139 | python_STMath.o \
|
---|
140 | python_Fitter.o \
|
---|
141 | python_Logger.o \
|
---|
142 | python_STLineFinder.o \
|
---|
143 | python_STFitEntry.o \
|
---|
144 | python_STWriter.o \
|
---|
145 | python_LineCatalog.o \
|
---|
146 | python_asap.o
|
---|
147 |
|
---|
148 | OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
|
---|
149 |
|
---|
150 | HEADERS := MathUtils.h \
|
---|
151 | Logger.h \
|
---|
152 | STAttr.h \
|
---|
153 | STHeader.h \
|
---|
154 | Scantable.h \
|
---|
155 | STFiller.h \
|
---|
156 | STMath.h \
|
---|
157 | RowAccumulator.h \
|
---|
158 | STSubTable.h \
|
---|
159 | STMolecules.h \
|
---|
160 | STTcal.h \
|
---|
161 | STFocus.h \
|
---|
162 | STWeather.h \
|
---|
163 | STHistory.h \
|
---|
164 | STFrequencies.h \
|
---|
165 | STDefs.h \
|
---|
166 | STWriter.h \
|
---|
167 | STSelector.h \
|
---|
168 | STFitter.h \
|
---|
169 | STFit.h \
|
---|
170 | STFitEntry.h \
|
---|
171 | STLineFinder.h \
|
---|
172 | Factory.h \
|
---|
173 | FactoryBase.h \
|
---|
174 | STPol.h \
|
---|
175 | STPolStokes.h \
|
---|
176 | STPolCircular.h \
|
---|
177 | STPolLinear.h \
|
---|
178 | STWriter.h \
|
---|
179 | STAsciiWriter.h \
|
---|
180 | STFITSImageWriter.h
|
---|
181 |
|
---|
182 | STATICCCLIB := libasap.a
|
---|
183 | MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
|
---|
184 |
|
---|
185 | .SUFFIXES: .c .o .cpp .cc .cxx .C
|
---|
186 |
|
---|
187 | .cpp.o:
|
---|
188 | -@ echo
|
---|
189 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
190 |
|
---|
191 | .cc.o:
|
---|
192 | -@ echo
|
---|
193 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
194 |
|
---|
195 | .cxx.o:
|
---|
196 | -@ echo
|
---|
197 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
198 |
|
---|
199 | .C.o:
|
---|
200 | -@ echo
|
---|
201 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
202 |
|
---|
203 |
|
---|
204 | .PHONY : all clean objects realclean relink
|
---|
205 |
|
---|
206 | all : $(TARGET)
|
---|
207 |
|
---|
208 | relink : cleanso $(TARGET)
|
---|
209 |
|
---|
210 | objects : $(OBJECTS)
|
---|
211 |
|
---|
212 | $(TARGET) : $(OBJECTS)
|
---|
213 | -@ echo
|
---|
214 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
215 |
|
---|
216 | $(OBJECTS) : $(HEADERS)
|
---|
217 |
|
---|
218 | staticlib: $(MEMBERS)
|
---|
219 |
|
---|
220 | clean :
|
---|
221 | -rm -f $(OBJECTS)
|
---|
222 |
|
---|
223 | cleanso :
|
---|
224 | -rm -f $(TARGET)
|
---|
225 |
|
---|
226 | realclean : clean cleanso
|
---|
227 |
|
---|
228 | test: objects tasap2.o
|
---|
229 | -@ echo
|
---|
230 | $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
|
---|