source: branches/alma/src/Makefile@ 1775

Last change on this file since 1775 was 1762, checked in by TakTsutsumi, 14 years ago

New Development: No

JIRA Issue: No/Yes List JIRA ticket.

Ready for Test: Yes

Interface Changes: Yes/No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Adjusted Makefile to compile on MacOSX


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