source: trunk/src/Makefile@ 1898

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

New Development: No

JIRA Issue: No (related to asap merge)

Ready for Test: Yes

Interface Changes: No

Test Programs: build asap with make

Put in Release Notes: No

Module(s): asap

Description: Merged Jonas' modification for platform detection.


File size: 6.6 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
11ifndef ASAPROOT
12 ASAPROOT := $(abspath ..)
13endif
14ATNFD := external-alma
15
16# the casa environment AIPSPATH has to be defined
17CASAROOT := $(word 1, $(CASAPATH))
18CASAARCH := $(word 2, $(CASAPATH))
19
20CXXFLAGS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CXXFLAGS eval_vars) && echo $$CXXFLAGS)
21CXXOPTS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COPTFLAGS eval_vars) && echo $$COPTFLAGS)
22LDFLAGS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=LD_FLAGS eval_vars) && echo $$LD_FLAGS)
23
24COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
25CORELIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CORELIB eval_vars) && echo $$CORELIB)
26WCSLIBLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIBD eval_vars) && echo $$WCSLIBLIBD)
27WCSLIBLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIB eval_vars) && echo $$WCSLIBLIB)
28PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
29PYTHONLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIBD eval_vars) && echo $$PYTHONLIBD)
30PYTHONINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONINCD eval_vars) && echo $$PYTHONINCD)
31PYTHONLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIB eval_vars) && echo $$PYTHONLIB)
32BOOSTROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=BOOSTROOT eval_vars) && echo $$BOOSTROOT)
33RPFITSLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=RPFITSLIBD eval_vars) && echo $$RPFITSLIBD)
34CFITSIOLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CFITSIOLIBD eval_vars) && echo $$CFITSIOLIBD)
35CFITSIOINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CFITSIOINCD eval_vars) && echo $$CFITSIOINCD)
36
37CASAINC := -I$(CASAROOT)/code/include -I$(COREINCD) -I$(CASAROOT)/$(CASAARCH)/include
38CASALIB := $(CASAROOT)/$(CASAARCH)/lib
39
40# the compiler
41ifndef CXX
42 CXX := g++
43endif
44
45# compiler flags
46CXXFLAGS += -fPIC
47
48CFITSIOLIB := -lcfitsio
49
50#rpfits
51RPFITSLIB := -lrpfits
52
53G2CROOT := /usr
54G2CLIB := -lgfortran
55
56# links to external libraries
57CASAPPLIB := -L$(ASAPROOT)/$(ATNFD) -latnf $(CORELIB) \
58 -L$(WCSLIBLIBD) $(WCSLIBLIB) \
59 -L$(RPFITSLIBD) $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
60
61# darwin specific CASA flags
62ifeq ($(shell uname), Darwin)
63 CASAPPLIB += -framework vecLib
64else
65 CASAPPLIB += -llapack -lblas
66endif
67
68LD := $(CXX)
69
70# has to be build with same g++ version as casa
71BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
72BOOSTINC := -I$(BOOSTROOT)/include/boost -I$(BOOSTROOT)/include
73
74LDFLAGS += -shared
75
76
77# DO NOT MODIFY AFTER THIS
78INCDIRS := -I. $(CASAINC) -I$(CFITSIOINCD) $(BOOSTINC) -I$(PYTHONINCD) -I$(ASAPROOT)/$(ATNFD)
79LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
80
81CCOBJECTS := MathUtils.o \
82 RowAccumulator.o \
83 Logger.o \
84 LineCatalog.o \
85 STAttr.o \
86 STHeader.o \
87 STFiller.o \
88 STMath.o \
89 STSubTable.o \
90 STMolecules.o \
91 STTcal.o \
92 STFocus.o \
93 STWeather.o \
94 STFrequencies.o \
95 STHistory.o \
96 STSelector.o \
97 STLineFinder.o \
98 STFitter.o \
99 STFitEntry.o \
100 STFit.o \
101 STPol.o \
102 STPolLinear.o \
103 STPolCircular.o \
104 STPolStokes.o \
105 STWriter.o \
106 STAsciiWriter.o \
107 STFITSImageWriter.o \
108 STAtmosphere.o \
109 Scantable.o \
110 FillerBase.o \
111 NROFiller.o \
112 PKSFiller.o \
113 AsapLogSink.o \
114 Templates.o
115
116PYOBJECTS := python_Scantable.o \
117 python_STFiller.o \
118 python_STSelector.o \
119 python_STMath.o \
120 python_Fitter.o \
121 python_Logger.o \
122 python_STLineFinder.o \
123 python_STFitEntry.o \
124 python_STWriter.o \
125 python_LineCatalog.o \
126 python_SrcType.o \
127 python_STAtmosphere.o \
128 python_STCoordinate.o \
129 python_Filler.o \
130 python_LogSink.o \
131 python_asap.o
132
133OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
134
135HEADERS := MathUtils.h \
136 LineCatalog.h \
137 Lorentzian1D.h \
138 Lorentzian1DParam.h \
139 Logger.h \
140 STAttr.h \
141 STHeader.h \
142 Scantable.h \
143 STFiller.h \
144 STMath.h \
145 RowAccumulator.h \
146 STSubTable.h \
147 STMolecules.h \
148 STTcal.h \
149 STFocus.h \
150 STWeather.h \
151 STHistory.h \
152 STFrequencies.h \
153 STDefs.h \
154 STWriter.h \
155 STSelector.h \
156 STFitter.h \
157 STFit.h \
158 STFitEntry.h \
159 STLineFinder.h \
160 Factory.h \
161 FactoryBase.h \
162 STPol.h \
163 STPolStokes.h \
164 STPolCircular.h \
165 STPolLinear.h \
166 STWriter.h \
167 STAsciiWriter.h \
168 STFITSImageWriter.h \
169 IndexedCompare.h \
170 STAtmosphere.h \
171 STCoordinate.h \
172 FillerBase.h \
173 NROFiller.h \
174 PKSFiller.h \
175 AsapLogSink.h
176
177STATICCCLIB := libasap.a
178MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
179
180.SUFFIXES: .c .o .cpp .cc .cxx .C
181
182.cpp.o:
183 -@ echo
184 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
185
186.cc.o:
187 -@ echo
188 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
189
190.cxx.o:
191 -@ echo
192 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
193
194.C.o:
195 -@ echo
196 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
197
198
199.PHONY : all clean objects realclean relink
200
201all : $(TARGET)
202
203relink : cleanso $(TARGET)
204
205objects : $(OBJECTS)
206
207$(TARGET) : $(OBJECTS)
208 -@ echo
209 $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
210
211$(OBJECTS) : $(HEADERS)
212
213staticlib: $(MEMBERS)
214
215clean :
216 -rm -f $(OBJECTS)
217
218cleanso :
219 -rm -f $(TARGET)
220
221realclean : clean cleanso
222
223test: objects tasap2.o
224 -@ echo
225 $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
Note: See TracBrowser for help on using the repository browser.