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