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 | G2CROOT := /usr
|
---|
46 | G2CARCH := $(G2CROOT)/lib/gcc/i386-apple-darwin8.7.1/4.2.0/libgcc.a
|
---|
47 | G2CARCH := $(G2CROOT)/lib/gcc/powerpc-apple-darwin8.7.0/4.2.0/libgcc.a
|
---|
48 | G2CARCH := $(G2CROOT)/lib/gcc/i386-redhat-linux/4.1.0/libgcc.a
|
---|
49 | #G2CLIB := $(G2CROOT)/lib/libgfortran.a
|
---|
50 | G2CLIB := -lg2c
|
---|
51 |
|
---|
52 | # This assumes all casa libs are static only (*.a)
|
---|
53 | # if not than there might by symbol resolution errors.
|
---|
54 | CASAPPLIB := -L$(CASALIB) \
|
---|
55 | -latnf -lcasa_images -lcasa_ms -lcasa_components -lcasa_coordinates \
|
---|
56 | -lcasa_lattices -lcasa_fits -lcasa_measures -lcasa_measures_f \
|
---|
57 | -lcasa_tables -lcasa_scimath -lcasa_scimath_f -lcasa_casa \
|
---|
58 | $(CASALIB)/libwcs.a \
|
---|
59 | $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
|
---|
60 |
|
---|
61 | # darwin specific CASA flags
|
---|
62 | ifeq "$(CASAARCH)" "darwin"
|
---|
63 | CASAPPLIB += -framework vecLib
|
---|
64 | else
|
---|
65 | CASAPPLIB += -llapack -lblas
|
---|
66 | endif
|
---|
67 |
|
---|
68 | # python
|
---|
69 | PYVERSION := 2.5
|
---|
70 | PYTHONROOT := /usr/lib/casapy
|
---|
71 | PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
|
---|
72 | PYTHONLIB := -L$(PYTHONROOT)/lib -lpython$(PYVERSION)
|
---|
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 | #BOOSTROOT := /home/casa/boost
|
---|
87 | BOOSTROOT := /usr/lib/casapy
|
---|
88 | #BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python-gcc34
|
---|
89 | BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
|
---|
90 | #BOOSTINC := -I$(BOOSTROOT)/include/boost-1_35
|
---|
91 | BOOSTINC := -I$(BOOSTROOT)/include/boost
|
---|
92 |
|
---|
93 | LDFLAGS := -shared -Wl$(TARGET) -s -Xlinker -rpath -Xlinker $(BOOSTROOT)/lib:$(PYTHONROOT)/lib:$(CASALIB)
|
---|
94 | ifeq "$(CASAARCH)" "darwin"
|
---|
95 | LDFLAGS := -bundle
|
---|
96 | endif
|
---|
97 |
|
---|
98 |
|
---|
99 | # DO NOT MODIFY AFTER THIS
|
---|
100 | INCDIRS := -I. $(CASAINC) $(CFITSIOINC) $(BOOSTINC) $(PYTHONINC)
|
---|
101 | LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
|
---|
102 |
|
---|
103 | CCOBJECTS := MathUtils.o \
|
---|
104 | RowAccumulator.o \
|
---|
105 | Logger.o \
|
---|
106 | LineCatalog.o \
|
---|
107 | STAttr.o \
|
---|
108 | STHeader.o \
|
---|
109 | STFiller.o \
|
---|
110 | STMath.o \
|
---|
111 | STSubTable.o \
|
---|
112 | STMolecules.o \
|
---|
113 | STTcal.o \
|
---|
114 | STFocus.o \
|
---|
115 | STWeather.o \
|
---|
116 | STFrequencies.o \
|
---|
117 | STHistory.o \
|
---|
118 | STSelector.o \
|
---|
119 | STLineFinder.o \
|
---|
120 | STFitter.o \
|
---|
121 | STFitEntry.o \
|
---|
122 | STFit.o \
|
---|
123 | STPol.o \
|
---|
124 | STPolLinear.o \
|
---|
125 | STPolCircular.o \
|
---|
126 | STPolStokes.o \
|
---|
127 | STWriter.o \
|
---|
128 | STAsciiWriter.o \
|
---|
129 | Scantable.o \
|
---|
130 | Templates.o
|
---|
131 | PYOBJECTS := python_Scantable.o \
|
---|
132 | python_STFiller.o \
|
---|
133 | python_STSelector.o \
|
---|
134 | python_STMath.o \
|
---|
135 | python_Fitter.o \
|
---|
136 | python_Logger.o \
|
---|
137 | python_STLineFinder.o \
|
---|
138 | python_STFitEntry.o \
|
---|
139 | python_STWriter.o \
|
---|
140 | python_LineCatalog.o \
|
---|
141 | python_asap.o
|
---|
142 |
|
---|
143 | OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
|
---|
144 |
|
---|
145 | HEADERS := MathUtils.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 |
|
---|
176 | STATICCCLIB := libasap.a
|
---|
177 | MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
|
---|
178 |
|
---|
179 | .SUFFIXES: .c .o .cpp .cc .cxx .C
|
---|
180 |
|
---|
181 | .cpp.o:
|
---|
182 | -@ echo
|
---|
183 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
184 |
|
---|
185 | .cc.o:
|
---|
186 | -@ echo
|
---|
187 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
188 |
|
---|
189 | .cxx.o:
|
---|
190 | -@ echo
|
---|
191 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
192 |
|
---|
193 | .C.o:
|
---|
194 | -@ echo
|
---|
195 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
196 |
|
---|
197 |
|
---|
198 | .PHONY : all clean objects realclean relink
|
---|
199 |
|
---|
200 | all : $(TARGET)
|
---|
201 |
|
---|
202 | relink : cleanso $(TARGET)
|
---|
203 |
|
---|
204 | objects : $(OBJECTS)
|
---|
205 |
|
---|
206 | $(TARGET) : $(OBJECTS)
|
---|
207 | -@ echo
|
---|
208 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
209 |
|
---|
210 | $(OBJECTS) : $(HEADERS)
|
---|
211 |
|
---|
212 | staticlib: $(MEMBERS)
|
---|
213 |
|
---|
214 | clean :
|
---|
215 | -rm -f $(OBJECTS)
|
---|
216 |
|
---|
217 | cleanso :
|
---|
218 | -rm -f $(TARGET)
|
---|
219 |
|
---|
220 | realclean : clean cleanso
|
---|
221 |
|
---|
222 | test: objects tasap2.o
|
---|
223 | -@ echo
|
---|
224 | $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
|
---|