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