1 | TARGET := /tmp/_asap.so
|
---|
2 |
|
---|
3 |
|
---|
4 | # the casa environment AIPSPATH has to be defined
|
---|
5 | CASAROOT := $(word 1, $(AIPSPATH))
|
---|
6 | CASAARCH := $(word 2, $(AIPSPATH))
|
---|
7 | CASAINC := -I$(CASAROOT)/code/include -I$(CASAROOT)/code/casa
|
---|
8 | CASALIB := $(CASAROOT)/$(CASAARCH)/lib
|
---|
9 |
|
---|
10 |
|
---|
11 | # the compiler
|
---|
12 | ifndef CXX
|
---|
13 | CXX := g++
|
---|
14 | endif
|
---|
15 |
|
---|
16 | # compiler flags
|
---|
17 | CXXFLAGS := -O3 -fPIC
|
---|
18 | CXXFLAGS += -ansi -pedantic -Wno-long-long
|
---|
19 | CXXOPTS := -DAIPS_NO_TEMPLATE_SRC
|
---|
20 |
|
---|
21 | # darwin specific flags
|
---|
22 | ifeq "$(CASAARCH)" "darwin"
|
---|
23 | CXXFLAGS := -O2 -DAIPS_DARWIN
|
---|
24 | CXXFLAGS += -ansi -pedantic -Wno-long-long -Wno-long-double
|
---|
25 | endif
|
---|
26 |
|
---|
27 |
|
---|
28 | # cfitsio
|
---|
29 | CFITSIOROOT := /usr/local
|
---|
30 | # If aips++ is build with LFS you need to have
|
---|
31 | # libcfitsio with lfs support
|
---|
32 | CFITSIOINC := -I$(CFITSIOROOT)/include
|
---|
33 | CFITSIOLIB := $(CFITSIOROOT)/lib/libcfitsio_lfs.a
|
---|
34 | #CFITSIOLIB := -L$(CFITSIOROOT) -lcfitsio
|
---|
35 |
|
---|
36 | #rpfits
|
---|
37 | RPFITSROOT := /usr/local
|
---|
38 | RPFITSLIB := $(RPFITSROOT)/lib/librpfits.a
|
---|
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) -lg2c -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 := -dynamiclib -single_module
|
---|
63 | endif
|
---|
64 |
|
---|
65 | # python only 2.3 has been tested
|
---|
66 | PYVERSION := 2.3
|
---|
67 | PYTHONROOT := /usr
|
---|
68 | PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
|
---|
69 | PYTHONLIB := -L$(PYTHONROOT)/lib -lpython$(PYVERSION)
|
---|
70 |
|
---|
71 | # has to be build with same g++ version as casa
|
---|
72 | BOOSTROOT := /usr
|
---|
73 | BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
|
---|
74 | BOOSTINC := -I$(BOOSTROOT)/include/boost
|
---|
75 |
|
---|
76 |
|
---|
77 | # DO NOT MODIFY AFTER THIS
|
---|
78 | INCDIRS := -I. $(CASAINC) $(BOOSTINC) $(PYTHONINC) $(CFITSIOINC)
|
---|
79 | LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
|
---|
80 |
|
---|
81 | CCOBJECTS := MathUtils.o \
|
---|
82 | MathUtils2.o \
|
---|
83 | SDLog.o \
|
---|
84 | SDAttr.o \
|
---|
85 | SDContainer.o \
|
---|
86 | SDFitTable.o \
|
---|
87 | SDPol.o \
|
---|
88 | SDPol2.o \
|
---|
89 | SDMemTable.o \
|
---|
90 | SDReader.o \
|
---|
91 | SDWriter.o \
|
---|
92 | SDMath.o \
|
---|
93 | SDFitter.o \
|
---|
94 | SDTemplates.o \
|
---|
95 | SDMathWrapper.o \
|
---|
96 | SDFITSImageWriter.o \
|
---|
97 | SDAsciiWriter.o \
|
---|
98 | SDLineFinder.o
|
---|
99 | PYOBJECTS := python_SDMemTable.o \
|
---|
100 | python_SDReader.o \
|
---|
101 | python_SDWriter.o \
|
---|
102 | python_SDMath.o \
|
---|
103 | python_SDFitter.o \
|
---|
104 | python_SDFitTable.o \
|
---|
105 | python_SDLineFinder.o \
|
---|
106 | python_SDLog.o \
|
---|
107 | python_SD.o
|
---|
108 |
|
---|
109 | OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
|
---|
110 |
|
---|
111 | HEADERS := SDDefs.h \
|
---|
112 | SDAttr.h \
|
---|
113 | SDContainer.h \
|
---|
114 | SDFitTable.h \
|
---|
115 | SDMemTable.h \
|
---|
116 | SDPol.h \
|
---|
117 | SDReader.h \
|
---|
118 | SDWriter.h \
|
---|
119 | SDMath.h \
|
---|
120 | SDFitter.h \
|
---|
121 | SDMemTableWrapper.h \
|
---|
122 | SDMathWrapper.h \
|
---|
123 | SDReaderWrapper.h \
|
---|
124 | SDWriterWrapper.h \
|
---|
125 | SDFITSImageWriter.h \
|
---|
126 | SDAsciiWriter.h \
|
---|
127 | SDLineFinder.h \
|
---|
128 | SDLog.h \
|
---|
129 | python_SD.h
|
---|
130 |
|
---|
131 | STATICCCLIB := libasap.a
|
---|
132 | MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
|
---|
133 |
|
---|
134 | .SUFFIXES: .c .o .cpp .cc .cxx .C
|
---|
135 |
|
---|
136 | .cpp.o:
|
---|
137 | -@ echo
|
---|
138 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
139 |
|
---|
140 | .cc.o:
|
---|
141 | -@ echo
|
---|
142 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
143 |
|
---|
144 | .cxx.o:
|
---|
145 | -@ echo
|
---|
146 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
147 |
|
---|
148 | .C.o:
|
---|
149 | -@ echo
|
---|
150 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
151 |
|
---|
152 |
|
---|
153 | .PHONY : all clean objects realclean relink
|
---|
154 |
|
---|
155 | all : $(TARGET)
|
---|
156 |
|
---|
157 | relink : cleanso $(TARGET)
|
---|
158 |
|
---|
159 | objects : $(OBJECTS)
|
---|
160 |
|
---|
161 | $(TARGET) : $(OBJECTS)
|
---|
162 | -@ echo
|
---|
163 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
164 |
|
---|
165 | $(OBJECTS) : $(HEADERS)
|
---|
166 |
|
---|
167 | staticlib: $(MEMBERS)
|
---|
168 |
|
---|
169 | clean :
|
---|
170 | -rm -f $(OBJECTS)
|
---|
171 |
|
---|
172 | cleanso :
|
---|
173 | -rm -f $(TARGET)
|
---|
174 |
|
---|
175 | realclean : clean cleanso
|
---|