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 |
|
---|
15 | COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
|
---|
16 | CORELIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CORELIB eval_vars) && echo $$CORELIB)
|
---|
17 | WCSLIBLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIBD eval_vars) && echo $$WCSLIBLIBD)
|
---|
18 | WCSLIBLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIB eval_vars) && echo $$WCSLIBLIB)
|
---|
19 | PYTHONLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIBD eval_vars) && echo $$PYTHONLIBD)
|
---|
20 | PYTHONINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONINCD eval_vars) && echo $$PYTHONINCD)
|
---|
21 | PYTHONLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIB eval_vars) && echo $$PYTHONLIB)
|
---|
22 | BOOSTROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=BOOSTROOT eval_vars) && echo $$BOOSTROOT)
|
---|
23 |
|
---|
24 | CASAINC := -I$(CASAROOT)/code/include -I$(COREINCD) -I$(CASAROOT)/$(CASAARCH)/include
|
---|
25 | CASALIB := $(CASAROOT)/$(CASAARCH)/lib
|
---|
26 | USELIB := lib
|
---|
27 |
|
---|
28 | # the compiler
|
---|
29 | ifndef CXX
|
---|
30 | CXX := g++
|
---|
31 | endif
|
---|
32 |
|
---|
33 | # compiler flags
|
---|
34 | CXXFLAGS := -fPIC -O3 -g
|
---|
35 | CXXFLAGS += -ansi -Wno-long-long -Wall
|
---|
36 |
|
---|
37 | # darwin specific flags
|
---|
38 | ifeq "$(CASAARCH)" "darwin"
|
---|
39 | CXXFLAGS +=-DAIPS_DARWIN
|
---|
40 | CXXFLAGS += -Wno-long-double
|
---|
41 | endif
|
---|
42 |
|
---|
43 | # cfitsio
|
---|
44 | CFITSIOROOT := /usr
|
---|
45 | CFITSIOINC := -I$(CFITSIOROOT)/include/cfitsio
|
---|
46 | CFITSIOLIB := -lcfitsio
|
---|
47 |
|
---|
48 | #rpfits
|
---|
49 | RPFITSROOT := /usr
|
---|
50 | RPFITSLIB := -lrpfits
|
---|
51 |
|
---|
52 | G2CROOT := /usr
|
---|
53 | G2CLIB := -lgfortran
|
---|
54 |
|
---|
55 | # This assumes all casa libs are static only (*.a)
|
---|
56 | # if not than there might by symbol resolution errors.
|
---|
57 | CASAPPLIB := -L$(CASALIB) -latnf $(CORELIB) \
|
---|
58 | -L$(WCSLIBLIBD) $(WCSLIBLIB) \
|
---|
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 | PYTHONINC := $(addprefix -I,$(PYTHONINCD))
|
---|
70 | PYTHONLIB := -L$(PYTHONLIBD) $(PYTHONLIB)
|
---|
71 |
|
---|
72 | # use python universal build
|
---|
73 | ifeq "$(CASAARCH)" "darwin"
|
---|
74 | PYVERSION := 2.5
|
---|
75 | PYTHONROOT := /Library/Frameworks/Python.framework/Versions/$(PYVERSION)
|
---|
76 | PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
|
---|
77 | PYTHONLIB := -L$(PYTHONROOT)/lib -framework Python
|
---|
78 | endif
|
---|
79 |
|
---|
80 | # the linker
|
---|
81 | LD := $(CXX)
|
---|
82 |
|
---|
83 | # has to be build with same g++ version as casa
|
---|
84 | BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
|
---|
85 | BOOSTINC := -I$(BOOSTROOT)/include/boost -I$(BOOSTROOT)/include
|
---|
86 |
|
---|
87 | LDFLAGS := -shared -Wl$(TARGET) -s -Xlinker -rpath -Xlinker $(BOOSTROOT)/lib:$(PYTHONROOT)/lib:$(CASALIB)
|
---|
88 | ifeq "$(CASAARCH)" "darwin"
|
---|
89 | LDFLAGS := -bundle
|
---|
90 | endif
|
---|
91 |
|
---|
92 |
|
---|
93 | # DO NOT MODIFY AFTER THIS
|
---|
94 | INCDIRS := -I. $(CASAINC) $(CFITSIOINC) $(BOOSTINC) $(PYTHONINC)
|
---|
95 | LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
|
---|
96 |
|
---|
97 | CCOBJECTS := MathUtils.o \
|
---|
98 | RowAccumulator.o \
|
---|
99 | Logger.o \
|
---|
100 | LineCatalog.o \
|
---|
101 | STAttr.o \
|
---|
102 | STHeader.o \
|
---|
103 | STFiller.o \
|
---|
104 | STMath.o \
|
---|
105 | STSubTable.o \
|
---|
106 | STMolecules.o \
|
---|
107 | STTcal.o \
|
---|
108 | STFocus.o \
|
---|
109 | STWeather.o \
|
---|
110 | STFrequencies.o \
|
---|
111 | STHistory.o \
|
---|
112 | STSelector.o \
|
---|
113 | STLineFinder.o \
|
---|
114 | STFitter.o \
|
---|
115 | STFitEntry.o \
|
---|
116 | STFit.o \
|
---|
117 | STPol.o \
|
---|
118 | STPolLinear.o \
|
---|
119 | STPolCircular.o \
|
---|
120 | STPolStokes.o \
|
---|
121 | STWriter.o \
|
---|
122 | STAsciiWriter.o \
|
---|
123 | STFITSImageWriter.o \
|
---|
124 | Scantable.o \
|
---|
125 | Templates.o
|
---|
126 | PYOBJECTS := python_Scantable.o \
|
---|
127 | python_STFiller.o \
|
---|
128 | python_STSelector.o \
|
---|
129 | python_STMath.o \
|
---|
130 | python_Fitter.o \
|
---|
131 | python_Logger.o \
|
---|
132 | python_STLineFinder.o \
|
---|
133 | python_STFitEntry.o \
|
---|
134 | python_STWriter.o \
|
---|
135 | python_LineCatalog.o \
|
---|
136 | python_asap.o
|
---|
137 |
|
---|
138 | OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
|
---|
139 |
|
---|
140 | HEADERS := MathUtils.h \
|
---|
141 | Logger.h \
|
---|
142 | STAttr.h \
|
---|
143 | STHeader.h \
|
---|
144 | Scantable.h \
|
---|
145 | STFiller.h \
|
---|
146 | STMath.h \
|
---|
147 | RowAccumulator.h \
|
---|
148 | STSubTable.h \
|
---|
149 | STMolecules.h \
|
---|
150 | STTcal.h \
|
---|
151 | STFocus.h \
|
---|
152 | STWeather.h \
|
---|
153 | STHistory.h \
|
---|
154 | STFrequencies.h \
|
---|
155 | STDefs.h \
|
---|
156 | STWriter.h \
|
---|
157 | STSelector.h \
|
---|
158 | STFitter.h \
|
---|
159 | STFit.h \
|
---|
160 | STFitEntry.h \
|
---|
161 | STLineFinder.h \
|
---|
162 | Factory.h \
|
---|
163 | FactoryBase.h \
|
---|
164 | STPol.h \
|
---|
165 | STPolStokes.h \
|
---|
166 | STPolCircular.h \
|
---|
167 | STPolLinear.h \
|
---|
168 | STWriter.h \
|
---|
169 | STAsciiWriter.h \
|
---|
170 | STFITSImageWriter.h
|
---|
171 |
|
---|
172 | STATICCCLIB := libasap.a
|
---|
173 | MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
|
---|
174 |
|
---|
175 | .SUFFIXES: .c .o .cpp .cc .cxx .C
|
---|
176 |
|
---|
177 | .cpp.o:
|
---|
178 | -@ echo
|
---|
179 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
180 |
|
---|
181 | .cc.o:
|
---|
182 | -@ echo
|
---|
183 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
184 |
|
---|
185 | .cxx.o:
|
---|
186 | -@ echo
|
---|
187 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
188 |
|
---|
189 | .C.o:
|
---|
190 | -@ echo
|
---|
191 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
192 |
|
---|
193 |
|
---|
194 | .PHONY : all clean objects realclean relink
|
---|
195 |
|
---|
196 | all : $(TARGET)
|
---|
197 |
|
---|
198 | relink : cleanso $(TARGET)
|
---|
199 |
|
---|
200 | objects : $(OBJECTS)
|
---|
201 |
|
---|
202 | $(TARGET) : $(OBJECTS)
|
---|
203 | -@ echo
|
---|
204 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
205 |
|
---|
206 | $(OBJECTS) : $(HEADERS)
|
---|
207 |
|
---|
208 | staticlib: $(MEMBERS)
|
---|
209 |
|
---|
210 | clean :
|
---|
211 | -rm -f $(OBJECTS)
|
---|
212 |
|
---|
213 | cleanso :
|
---|
214 | -rm -f $(TARGET)
|
---|
215 |
|
---|
216 | realclean : clean cleanso
|
---|
217 |
|
---|
218 | test: objects tasap2.o
|
---|
219 | -@ echo
|
---|
220 | $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
|
---|