source: trunk/src/Makefile@ 1877

Last change on this file since 1877 was 1877, checked in by Kana Sugimoto, 14 years ago

New Development: Yes

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): libatnf

Description:

Added make file in external-alma so that libatnf will be built from the codes there.


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