source: branches/alma/src/Makefile@ 1557

Last change on this file since 1557 was 1520, checked in by Takeshi Nakazato, 16 years ago

restore Makefile

File size: 5.8 KB
Line 
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'.
9TARGET := /tmp/_asap.so
10
11# the casa environment AIPSPATH has to be defined
12CASAROOT := $(word 1, $(CASAPATH))
13CASAARCH := $(word 2, $(CASAPATH))
14CASAINC := -I$(CASAROOT)/code/include -I$(CASAROOT)/$(CASAARCH)/include/casacore -I$(CASAROOT)/$(CASAARCH)/include
15CASALIB := $(CASAROOT)/$(CASAARCH)/lib
16
17
18# the compiler
19ifndef CXX
20 CXX := g++
21endif
22
23# compiler flags
24CXXFLAGS := -fPIC -O3 -g
25CXXFLAGS += -ansi -Wno-long-long -Wall
26#CXXOPTS := -DAIPS_NO_TEMPLATE_SRC
27
28# darwin specific flags
29ifeq "$(CASAARCH)" "darwin"
30 CXXFLAGS +=-DAIPS_DARWIN
31 CXXFLAGS += -Wno-long-double
32endif
33
34# cfitsio
35CFITSIOROOT := /usr
36CFITSIOINC := -I$(CFITSIOROOT)/include/cfitsio
37#CFITSIOLIB := -L$(CFITSIOROOT)/lib -lcfitsio
38CFITSIOLIB := -lcfitsio
39
40#rpfits
41RPFITSROOT := /usr
42#RPFITSLIB := $(RPFITSROOT)/lib/librpfits.a
43RPFITSLIB := -lrpfits
44
45G2CROOT := /usr
46G2CARCH := $(G2CROOT)/lib/gcc/i386-apple-darwin8.7.1/4.2.0/libgcc.a
47G2CARCH := $(G2CROOT)/lib/gcc/powerpc-apple-darwin8.7.0/4.2.0/libgcc.a
48G2CARCH := $(G2CROOT)/lib/gcc/i386-redhat-linux/4.1.0/libgcc.a
49#G2CLIB := $(G2CROOT)/lib/libgfortran.a
50G2CLIB := -lg2c
51
52# This assumes all casa libs are static only (*.a)
53# if not than there might by symbol resolution errors.
54CASAPPLIB := -L$(CASALIB) \
55 -latnf -lcasa_images -lcasa_ms -lcasa_components -lcasa_coordinates \
56 -lcasa_lattices -lcasa_fits -lcasa_measures -lcasa_measures_f \
57 -lcasa_tables -lcasa_scimath -lcasa_scimath_f -lcasa_casa \
58 $(CASALIB)/libwcs.a \
59 $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
60
61# darwin specific CASA flags
62ifeq "$(CASAARCH)" "darwin"
63 CASAPPLIB += -framework vecLib
64else
65 CASAPPLIB += -llapack -lblas
66endif
67
68# python
69PYVERSION := 2.5
70PYTHONROOT := /usr/lib/casapy
71PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
72PYTHONLIB := -L$(PYTHONROOT)/lib -lpython$(PYVERSION)
73
74# use python universal build
75ifeq "$(CASAARCH)" "darwin"
76 PYVERSION := 2.5
77 PYTHONROOT := /Library/Frameworks/Python.framework/Versions/$(PYVERSION)
78 PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
79 PYTHONLIB := -L$(PYTHONROOT)/lib -framework Python
80endif
81
82# the linker
83LD := $(CXX)
84
85# has to be build with same g++ version as casa
86#BOOSTROOT := /home/casa/boost
87BOOSTROOT := /usr/lib/casapy
88#BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python-gcc34
89BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
90#BOOSTINC := -I$(BOOSTROOT)/include/boost-1_35
91BOOSTINC := -I$(BOOSTROOT)/include/boost
92
93LDFLAGS := -shared -Wl$(TARGET) -s -Xlinker -rpath -Xlinker $(BOOSTROOT)/lib:$(PYTHONROOT)/lib:$(CASALIB)
94ifeq "$(CASAARCH)" "darwin"
95 LDFLAGS := -bundle
96endif
97
98
99# DO NOT MODIFY AFTER THIS
100INCDIRS := -I. $(CASAINC) $(CFITSIOINC) $(BOOSTINC) $(PYTHONINC)
101LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
102
103CCOBJECTS := MathUtils.o \
104 RowAccumulator.o \
105 Logger.o \
106 LineCatalog.o \
107 STAttr.o \
108 STHeader.o \
109 STFiller.o \
110 STMath.o \
111 STSubTable.o \
112 STMolecules.o \
113 STTcal.o \
114 STFocus.o \
115 STWeather.o \
116 STFrequencies.o \
117 STHistory.o \
118 STSelector.o \
119 STLineFinder.o \
120 STFitter.o \
121 STFitEntry.o \
122 STFit.o \
123 STPol.o \
124 STPolLinear.o \
125 STPolCircular.o \
126 STPolStokes.o \
127 STWriter.o \
128 STAsciiWriter.o \
129 Scantable.o \
130 Templates.o
131PYOBJECTS := python_Scantable.o \
132 python_STFiller.o \
133 python_STSelector.o \
134 python_STMath.o \
135 python_Fitter.o \
136 python_Logger.o \
137 python_STLineFinder.o \
138 python_STFitEntry.o \
139 python_STWriter.o \
140 python_LineCatalog.o \
141 python_asap.o
142
143OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
144
145HEADERS := MathUtils.h \
146 Logger.h \
147 STAttr.h \
148 STHeader.h \
149 Scantable.h \
150 STFiller.h \
151 STMath.h \
152 RowAccumulator.h \
153 STSubTable.h \
154 STMolecules.h \
155 STTcal.h \
156 STFocus.h \
157 STWeather.h \
158 STHistory.h \
159 STFrequencies.h \
160 STDefs.h \
161 STWriter.h \
162 STSelector.h \
163 STFitter.h \
164 STFit.h \
165 STFitEntry.h \
166 STLineFinder.h \
167 Factory.h \
168 FactoryBase.h \
169 STPol.h \
170 STPolStokes.h \
171 STPolCircular.h \
172 STPolLinear.h \
173 STWriter.h \
174 STAsciiWriter.h
175
176STATICCCLIB := libasap.a
177MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
178
179.SUFFIXES: .c .o .cpp .cc .cxx .C
180
181.cpp.o:
182 -@ echo
183 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
184
185.cc.o:
186 -@ echo
187 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
188
189.cxx.o:
190 -@ echo
191 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
192
193.C.o:
194 -@ echo
195 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
196
197
198.PHONY : all clean objects realclean relink
199
200all : $(TARGET)
201
202relink : cleanso $(TARGET)
203
204objects : $(OBJECTS)
205
206$(TARGET) : $(OBJECTS)
207 -@ echo
208 $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
209
210$(OBJECTS) : $(HEADERS)
211
212staticlib: $(MEMBERS)
213
214clean :
215 -rm -f $(OBJECTS)
216
217cleanso :
218 -rm -f $(TARGET)
219
220realclean : clean cleanso
221
222test: objects tasap2.o
223 -@ echo
224 $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
Note: See TracBrowser for help on using the repository browser.