source: branches/newfiller/src/Makefile@ 2396

Last change on this file since 2396 was 1812, checked in by Takeshi Nakazato, 14 years ago

Makefile is updated to be able to compile codes using make.
Fixed a few things in NROFiller class.

File size: 7.0 KB
RevLine 
[1455]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'.
[1520]9TARGET := /tmp/_asap.so
[1446]10
11# the casa environment AIPSPATH has to be defined
[1455]12CASAROOT := $(word 1, $(CASAPATH))
13CASAARCH := $(word 2, $(CASAPATH))
[1608]14
15COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
16CORELIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CORELIB eval_vars) && echo $$CORELIB)
17WCSLIBLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIBD eval_vars) && echo $$WCSLIBLIBD)
18WCSLIBLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIB eval_vars) && echo $$WCSLIBLIB)
[1762]19PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
[1608]20PYTHONLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIBD eval_vars) && echo $$PYTHONLIBD)
21PYTHONINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONINCD eval_vars) && echo $$PYTHONINCD)
22PYTHONLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIB eval_vars) && echo $$PYTHONLIB)
[1762]23#PYTHONVER := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONVER eval_vars) && echo $$PYTHONVER)
[1608]24BOOSTROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=BOOSTROOT eval_vars) && echo $$BOOSTROOT)
[1762]25RPFITSLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=RPFITSLIBD eval_vars) && echo $$RPFITSLIBD)
[1608]26
27CASAINC := -I$(CASAROOT)/code/include -I$(COREINCD) -I$(CASAROOT)/$(CASAARCH)/include
[1446]28CASALIB := $(CASAROOT)/$(CASAARCH)/lib
[1762]29#USELIB := lib64
30USELIB := lib
[1446]31
32# the compiler
33ifndef CXX
34 CXX := g++
35endif
36
37# compiler flags
38CXXFLAGS := -fPIC -O3 -g
39CXXFLAGS += -ansi -Wno-long-long -Wall
[1762]40#CXXOPTS := -DAIPS_64B
[1446]41
42# darwin specific flags
43ifeq "$(CASAARCH)" "darwin"
[1762]44 #CXXFLAGS +=-DAIPS_DARWIN -arch i386 #For 10.6
[1446]45 CXXFLAGS +=-DAIPS_DARWIN
[1762]46 #CXXFLAGS += -Wno-long-double
[1446]47endif
48
49# cfitsio
50CFITSIOROOT := /usr
51CFITSIOINC := -I$(CFITSIOROOT)/include/cfitsio
52CFITSIOLIB := -lcfitsio
53
54#rpfits
55RPFITSROOT := /usr
56RPFITSLIB := -lrpfits
57
58G2CROOT := /usr
[1608]59G2CLIB := -lgfortran
[1446]60
61# This assumes all casa libs are static only (*.a)
62# if not than there might by symbol resolution errors.
[1608]63CASAPPLIB := -L$(CASALIB) -latnf $(CORELIB) \
[1704]64 -L$(WCSLIBLIBD) $(WCSLIBLIB) \
[1762]65 -L$(RPFITSLIBD) $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
[1446]66
67# darwin specific CASA flags
68ifeq "$(CASAARCH)" "darwin"
69 CASAPPLIB += -framework vecLib
70else
71 CASAPPLIB += -llapack -lblas
72endif
73
74# python
[1608]75PYTHONINC := $(addprefix -I,$(PYTHONINCD))
76PYTHONLIB := -L$(PYTHONLIBD) $(PYTHONLIB)
[1446]77
78# use python universal build
[1762]79#ifeq "$(CASAARCH)" "darwin"
80# PYVERSION := 2.5
81# PYTHONROOT := /Library/Frameworks/Python.framework/Versions/$(PYVERSION)
82# PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
83# PYTHONLIB := -L$(PYTHONROOT)/lib -framework Python
84#endif
[1446]85
86# the linker
87LD := $(CXX)
88
89# has to be build with same g++ version as casa
90BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
[1608]91BOOSTINC := -I$(BOOSTROOT)/include/boost -I$(BOOSTROOT)/include
[1446]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 \
[1603]129 STFITSImageWriter.o \
[1757]130 STAtmosphere.o \
[1446]131 Scantable.o \
[1792]132 FillerBase.o \
133 NROFiller.o \
[1812]134 PKSFiller.o \
135 AsapLogSink.o \
[1446]136 Templates.o
[1812]137
[1446]138PYOBJECTS := python_Scantable.o \
139 python_STFiller.o \
140 python_STSelector.o \
141 python_STMath.o \
142 python_Fitter.o \
143 python_Logger.o \
144 python_STLineFinder.o \
145 python_STFitEntry.o \
146 python_STWriter.o \
147 python_LineCatalog.o \
[1693]148 python_SrcType.o \
[1757]149 python_STAtmosphere.o \
150 python_STCoordinate.o \
[1792]151 python_Filler.o \
[1812]152 python_LogSink.o \
[1446]153 python_asap.o
154
155OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
156
157HEADERS := MathUtils.h \
[1812]158 LineCatalog.h \
[1700]159 Lorentzian1D.h \
160 Lorentzian1DParam.h \
[1446]161 Logger.h \
162 STAttr.h \
163 STHeader.h \
164 Scantable.h \
165 STFiller.h \
166 STMath.h \
167 RowAccumulator.h \
168 STSubTable.h \
169 STMolecules.h \
170 STTcal.h \
171 STFocus.h \
172 STWeather.h \
173 STHistory.h \
174 STFrequencies.h \
175 STDefs.h \
176 STWriter.h \
177 STSelector.h \
178 STFitter.h \
179 STFit.h \
180 STFitEntry.h \
181 STLineFinder.h \
182 Factory.h \
183 FactoryBase.h \
184 STPol.h \
185 STPolStokes.h \
186 STPolCircular.h \
187 STPolLinear.h \
188 STWriter.h \
[1603]189 STAsciiWriter.h \
[1757]190 STFITSImageWriter.h \
191 IndexedCompare.h \
192 STAtmosphere.h \
[1812]193 STCoordinate.h \
194 FillerBase.h \
195 NROFiller.h \
196 PKSFiller.h \
197 AsapLogSink.h
[1446]198
199STATICCCLIB := libasap.a
200MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
201
202.SUFFIXES: .c .o .cpp .cc .cxx .C
203
204.cpp.o:
205 -@ echo
206 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
207
208.cc.o:
209 -@ echo
210 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
211
212.cxx.o:
213 -@ echo
214 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
215
216.C.o:
217 -@ echo
218 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
219
220
221.PHONY : all clean objects realclean relink
222
223all : $(TARGET)
224
225relink : cleanso $(TARGET)
226
227objects : $(OBJECTS)
228
229$(TARGET) : $(OBJECTS)
230 -@ echo
231 $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
232
233$(OBJECTS) : $(HEADERS)
234
235staticlib: $(MEMBERS)
236
237clean :
238 -rm -f $(OBJECTS)
239
240cleanso :
241 -rm -f $(TARGET)
242
243realclean : clean cleanso
244
245test: objects tasap2.o
246 -@ echo
247 $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
Note: See TracBrowser for help on using the repository browser.