source: trunk/src/Makefile@ 1849

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

test commit

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