1 | TARGET := /tmp/_asap.so
|
---|
2 |
|
---|
3 | # the casa environment AIPSPATH has to be defined
|
---|
4 | CASAROOT := $(word 1, $(AIPSPATH))
|
---|
5 | CASAARCH := $(word 2, $(AIPSPATH))
|
---|
6 | CASAINC := -I$(CASAROOT)/code/include -I$(CASAROOT)/code/casa
|
---|
7 | CASALIB := $(CASAROOT)/$(CASAARCH)/lib
|
---|
8 |
|
---|
9 |
|
---|
10 | # the compiler
|
---|
11 | ifndef CXX
|
---|
12 | CXX := g++
|
---|
13 | endif
|
---|
14 |
|
---|
15 | # compiler flags
|
---|
16 | CXXFLAGS := -fPIC -O3 -g
|
---|
17 | CXXFLAGS += -ansi -Wno-long-long -Wall
|
---|
18 | CXXOPTS := -DAIPS_NO_TEMPLATE_SRC
|
---|
19 |
|
---|
20 | # darwin specific flags
|
---|
21 | ifeq "$(CASAARCH)" "darwin"
|
---|
22 | CXXFLAGS +=-DAIPS_DARWIN
|
---|
23 | CXXFLAGS += -Wno-long-double
|
---|
24 | endif
|
---|
25 |
|
---|
26 | # cfitsio
|
---|
27 | CFITSIOROOT := /usr
|
---|
28 | CFITSIOINC := -I$(CFITSIOROOT)/include/cfitsio
|
---|
29 | #CFITSIOLIB := -L$(CFITSIOROOT)/lib -lcfitsio
|
---|
30 | CFITSIOLIB := -lcfitsio
|
---|
31 |
|
---|
32 | #rpfits
|
---|
33 | RPFITSROOT := /usr
|
---|
34 | #RPFITSLIB := $(RPFITSROOT)/lib/librpfits.a
|
---|
35 | RPFITSLIB := -lrpfits
|
---|
36 |
|
---|
37 | G2CROOT := /usr
|
---|
38 | G2CARCH := $(G2CROOT)/lib/gcc/i386-apple-darwin8.7.1/4.2.0/libgcc.a
|
---|
39 | G2CARCH := $(G2CROOT)/lib/gcc/powerpc-apple-darwin8.7.0/4.2.0/libgcc.a
|
---|
40 | #G2CLIB := $(G2CROOT)/lib/libgfortran.a
|
---|
41 | G2CLIB := -lg2c
|
---|
42 |
|
---|
43 | # This assumes all casa libs are static only (*.a)
|
---|
44 | # if not than there might by symbol resolution errors.
|
---|
45 | CASAPPLIB := -L$(CASALIB) \
|
---|
46 | -latnf -limages -lms -lcomponents -lcoordinates \
|
---|
47 | -llattices -lfits -lmeasures -lmeasures_f \
|
---|
48 | -ltables -lscimath -lscimath_f -lcasa \
|
---|
49 | $(CASALIB)/libwcs.a \
|
---|
50 | $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
|
---|
51 |
|
---|
52 | # darwin specific CASA flags
|
---|
53 | ifeq "$(CASAARCH)" "darwin"
|
---|
54 | CASAPPLIB += -framework vecLib
|
---|
55 | else
|
---|
56 | CASAPPLIB += -llapack -lblas
|
---|
57 | endif
|
---|
58 |
|
---|
59 | # python
|
---|
60 | PYVERSION := 2.5
|
---|
61 | PYTHONROOT := /usr/lib/casapy
|
---|
62 | PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
|
---|
63 | PYTHONLIB := -L$(PYTHONROOT)/lib -lpython$(PYVERSION)
|
---|
64 |
|
---|
65 | # use python universal build
|
---|
66 | ifeq "$(CASAARCH)" "darwin"
|
---|
67 | PYVERSION := 2.5
|
---|
68 | PYTHONROOT := /Library/Frameworks/Python.framework/Versions/$(PYVERSION)
|
---|
69 | PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
|
---|
70 | PYTHONLIB := -L$(PYTHONROOT)/lib -framework Python
|
---|
71 | endif
|
---|
72 |
|
---|
73 | # the linker
|
---|
74 | LD := $(CXX)
|
---|
75 |
|
---|
76 | # has to be build with same g++ version as casa
|
---|
77 | #BOOSTROOT := /home/casa/boost
|
---|
78 | BOOSTROOT := /usr/lib/casapy
|
---|
79 | #BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python-gcc34
|
---|
80 | BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
|
---|
81 | #BOOSTINC := -I$(BOOSTROOT)/include/boost-1_35
|
---|
82 | BOOSTINC := -I$(BOOSTROOT)/include/boost
|
---|
83 |
|
---|
84 | LDFLAGS := -shared -Wl$(TARGET) -s -Xlinker -rpath -Xlinker $(BOOSTROOT)/lib:$(PYTHONROOT)/lib:$(CASALIB)
|
---|
85 | ifeq "$(CASAARCH)" "darwin"
|
---|
86 | LDFLAGS := -bundle
|
---|
87 | endif
|
---|
88 |
|
---|
89 |
|
---|
90 | # DO NOT MODIFY AFTER THIS
|
---|
91 | INCDIRS := -I. $(CASAINC) $(CFITSIOINC) $(BOOSTINC) $(PYTHONINC)
|
---|
92 | LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
|
---|
93 |
|
---|
94 | CCOBJECTS := MathUtils.o \
|
---|
95 | RowAccumulator.o \
|
---|
96 | Logger.o \
|
---|
97 | LineCatalog.o \
|
---|
98 | STAttr.o \
|
---|
99 | STHeader.o \
|
---|
100 | STFiller.o \
|
---|
101 | STMath.o \
|
---|
102 | STSubTable.o \
|
---|
103 | STMolecules.o \
|
---|
104 | STTcal.o \
|
---|
105 | STFocus.o \
|
---|
106 | STWeather.o \
|
---|
107 | STFrequencies.o \
|
---|
108 | STHistory.o \
|
---|
109 | STSelector.o \
|
---|
110 | STLineFinder.o \
|
---|
111 | STFitter.o \
|
---|
112 | STFitEntry.o \
|
---|
113 | STFit.o \
|
---|
114 | STPol.o \
|
---|
115 | STPolLinear.o \
|
---|
116 | STPolCircular.o \
|
---|
117 | STPolStokes.o \
|
---|
118 | STWriter.o \
|
---|
119 | STAsciiWriter.o \
|
---|
120 | Scantable.o \
|
---|
121 | Templates.o
|
---|
122 | PYOBJECTS := 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_asap.o
|
---|
133 |
|
---|
134 | OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
|
---|
135 |
|
---|
136 | HEADERS := MathUtils.h \
|
---|
137 | Logger.h \
|
---|
138 | STAttr.h \
|
---|
139 | STHeader.h \
|
---|
140 | Scantable.h \
|
---|
141 | STFiller.h \
|
---|
142 | STMath.h \
|
---|
143 | RowAccumulator.h \
|
---|
144 | STSubTable.h \
|
---|
145 | STMolecules.h \
|
---|
146 | STTcal.h \
|
---|
147 | STFocus.h \
|
---|
148 | STWeather.h \
|
---|
149 | STHistory.h \
|
---|
150 | STFrequencies.h \
|
---|
151 | STDefs.h \
|
---|
152 | STWriter.h \
|
---|
153 | STSelector.h \
|
---|
154 | STFitter.h \
|
---|
155 | STFit.h \
|
---|
156 | STFitEntry.h \
|
---|
157 | STLineFinder.h \
|
---|
158 | Factory.h \
|
---|
159 | FactoryBase.h \
|
---|
160 | STPol.h \
|
---|
161 | STPolStokes.h \
|
---|
162 | STPolCircular.h \
|
---|
163 | STPolLinear.h \
|
---|
164 | STWriter.h \
|
---|
165 | STAsciiWriter.h
|
---|
166 |
|
---|
167 | STATICCCLIB := libasap.a
|
---|
168 | MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
|
---|
169 |
|
---|
170 | .SUFFIXES: .c .o .cpp .cc .cxx .C
|
---|
171 |
|
---|
172 | .cpp.o:
|
---|
173 | -@ echo
|
---|
174 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
175 |
|
---|
176 | .cc.o:
|
---|
177 | -@ echo
|
---|
178 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
179 |
|
---|
180 | .cxx.o:
|
---|
181 | -@ echo
|
---|
182 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
183 |
|
---|
184 | .C.o:
|
---|
185 | -@ echo
|
---|
186 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
187 |
|
---|
188 |
|
---|
189 | .PHONY : all clean objects realclean relink
|
---|
190 |
|
---|
191 | all : $(TARGET)
|
---|
192 |
|
---|
193 | relink : cleanso $(TARGET)
|
---|
194 |
|
---|
195 | objects : $(OBJECTS)
|
---|
196 |
|
---|
197 | $(TARGET) : $(OBJECTS)
|
---|
198 | -@ echo
|
---|
199 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
200 |
|
---|
201 | $(OBJECTS) : $(HEADERS)
|
---|
202 |
|
---|
203 | staticlib: $(MEMBERS)
|
---|
204 |
|
---|
205 | clean :
|
---|
206 | -rm -f $(OBJECTS)
|
---|
207 |
|
---|
208 | cleanso :
|
---|
209 | -rm -f $(TARGET)
|
---|
210 |
|
---|
211 | realclean : clean cleanso
|
---|
212 |
|
---|
213 | test: objects tasap2.o
|
---|
214 | -@ echo
|
---|
215 | $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
|
---|