source: trunk/src/Makefile@ 1883

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

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

Test Programs: make & make install

Put in Release Notes: No

Module(s): none

Description: Modified Makefile-s so that libatnf.so is installed at the time of "make install" instead of "make"


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