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