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