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) $(BOOSTINC) $(PYTHONINC) $(CFITSIOINC)
|
---|
78 | LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
|
---|
79 |
|
---|
80 | CCOBJECTS := MathUtils.o \
|
---|
81 | MathUtils2.o \
|
---|
82 | SDLog.o \
|
---|
83 | STAttr.o \
|
---|
84 | SDContainer.o \
|
---|
85 | Scantable.o \
|
---|
86 | STFiller.o \
|
---|
87 | STTemplates.o \
|
---|
88 | STMath.o \
|
---|
89 | STSubTable.o \
|
---|
90 | STMolecules.o \
|
---|
91 | STTcal.o \
|
---|
92 | STFocus.o \
|
---|
93 | STWeather.o \
|
---|
94 | STFrequencies.o \
|
---|
95 | STHistory.o \
|
---|
96 | STWriter.o \
|
---|
97 | RowAccumulator.o \
|
---|
98 | STSelector.o \
|
---|
99 | SDFitter.o
|
---|
100 | PYOBJECTS := python_Scantable.o \
|
---|
101 | python_STFiller.o \
|
---|
102 | python_STSelector.o \
|
---|
103 | python_STMath.o \
|
---|
104 | python_SDFitter.o \
|
---|
105 | python_SDLog.o \
|
---|
106 | python_asap.o
|
---|
107 |
|
---|
108 | OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
|
---|
109 |
|
---|
110 | HEADERS := MathUtils.h \
|
---|
111 | SDLog.h \
|
---|
112 | STAttr.h \
|
---|
113 | SDContainer.h \
|
---|
114 | Scantable.h \
|
---|
115 | STFiller.h \
|
---|
116 | STMath.h \
|
---|
117 | RowAccumulator.h \
|
---|
118 | STSubTable.h \
|
---|
119 | STMolecules.h \
|
---|
120 | STTcal.h \
|
---|
121 | STFocus.h \
|
---|
122 | STWeather.h \
|
---|
123 | STHistory.h \
|
---|
124 | STFrequencies.h \
|
---|
125 | STDefs.h \
|
---|
126 | STWriter.h \
|
---|
127 | STSelector.h
|
---|
128 |
|
---|
129 | STATICCCLIB := libasap.a
|
---|
130 | MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
|
---|
131 |
|
---|
132 | .SUFFIXES: .c .o .cpp .cc .cxx .C
|
---|
133 |
|
---|
134 | .cpp.o:
|
---|
135 | -@ echo
|
---|
136 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
137 |
|
---|
138 | .cc.o:
|
---|
139 | -@ echo
|
---|
140 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
141 |
|
---|
142 | .cxx.o:
|
---|
143 | -@ echo
|
---|
144 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
145 |
|
---|
146 | .C.o:
|
---|
147 | -@ echo
|
---|
148 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
149 |
|
---|
150 |
|
---|
151 | .PHONY : all clean objects realclean relink
|
---|
152 |
|
---|
153 | all : $(TARGET)
|
---|
154 |
|
---|
155 | relink : cleanso $(TARGET)
|
---|
156 |
|
---|
157 | objects : $(OBJECTS)
|
---|
158 |
|
---|
159 | $(TARGET) : $(OBJECTS)
|
---|
160 | -@ echo
|
---|
161 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
162 |
|
---|
163 | $(OBJECTS) : $(HEADERS)
|
---|
164 |
|
---|
165 | staticlib: $(MEMBERS)
|
---|
166 |
|
---|
167 | clean :
|
---|
168 | -rm -f $(OBJECTS)
|
---|
169 |
|
---|
170 | cleanso :
|
---|
171 | -rm -f $(TARGET)
|
---|
172 |
|
---|
173 | realclean : clean cleanso
|
---|
174 |
|
---|
175 | test: objects tasap2.o
|
---|
176 | -@ echo
|
---|
177 | $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
|
---|