[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
|
---|
[1894] | 46 | CXXFLAGS += -fPIC
|
---|
[1446] | 47 |
|
---|
| 48 | CFITSIOLIB := -lcfitsio
|
---|
| 49 |
|
---|
| 50 | #rpfits
|
---|
| 51 | RPFITSLIB := -lrpfits
|
---|
| 52 |
|
---|
| 53 | G2CROOT := /usr
|
---|
[1608] | 54 | G2CLIB := -lgfortran
|
---|
[1446] | 55 |
|
---|
[1879] | 56 | # links to external libraries
|
---|
| 57 | CASAPPLIB := -L$(ASAPROOT)/$(ATNFD) -latnf $(CORELIB) \
|
---|
[1704] | 58 | -L$(WCSLIBLIBD) $(WCSLIBLIB) \
|
---|
[1762] | 59 | -L$(RPFITSLIBD) $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
|
---|
[1446] | 60 |
|
---|
| 61 | # darwin specific CASA flags
|
---|
[1898] | 62 | ifeq ($(shell uname), Darwin)
|
---|
[1446] | 63 | CASAPPLIB += -framework vecLib
|
---|
| 64 | else
|
---|
| 65 | CASAPPLIB += -llapack -lblas
|
---|
| 66 | endif
|
---|
| 67 |
|
---|
| 68 | LD := $(CXX)
|
---|
| 69 |
|
---|
| 70 | # has to be build with same g++ version as casa
|
---|
| 71 | BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
|
---|
[1608] | 72 | BOOSTINC := -I$(BOOSTROOT)/include/boost -I$(BOOSTROOT)/include
|
---|
[1446] | 73 |
|
---|
[1894] | 74 | LDFLAGS += -shared
|
---|
[1446] | 75 |
|
---|
| 76 |
|
---|
| 77 | # DO NOT MODIFY AFTER THIS
|
---|
[1894] | 78 | INCDIRS := -I. $(CASAINC) -I$(CFITSIOINCD) $(BOOSTINC) -I$(PYTHONINCD) -I$(ASAPROOT)/$(ATNFD)
|
---|
[1446] | 79 | LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
|
---|
| 80 |
|
---|
| 81 | CCOBJECTS := 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 \
|
---|
[1603] | 107 | STFITSImageWriter.o \
|
---|
[1757] | 108 | STAtmosphere.o \
|
---|
[1446] | 109 | Scantable.o \
|
---|
[1818] | 110 | FillerBase.o \
|
---|
| 111 | NROFiller.o \
|
---|
| 112 | PKSFiller.o \
|
---|
| 113 | AsapLogSink.o \
|
---|
[1446] | 114 | Templates.o
|
---|
[1818] | 115 |
|
---|
[1446] | 116 | PYOBJECTS := 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 \
|
---|
[1693] | 126 | python_SrcType.o \
|
---|
[1757] | 127 | python_STAtmosphere.o \
|
---|
| 128 | python_STCoordinate.o \
|
---|
[1818] | 129 | python_Filler.o \
|
---|
| 130 | python_LogSink.o \
|
---|
[1446] | 131 | python_asap.o
|
---|
| 132 |
|
---|
| 133 | OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
|
---|
| 134 |
|
---|
| 135 | HEADERS := MathUtils.h \
|
---|
[1818] | 136 | LineCatalog.h \
|
---|
[1700] | 137 | Lorentzian1D.h \
|
---|
| 138 | Lorentzian1DParam.h \
|
---|
[1446] | 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 \
|
---|
[1603] | 167 | STAsciiWriter.h \
|
---|
[1757] | 168 | STFITSImageWriter.h \
|
---|
| 169 | IndexedCompare.h \
|
---|
| 170 | STAtmosphere.h \
|
---|
[1818] | 171 | STCoordinate.h \
|
---|
| 172 | FillerBase.h \
|
---|
| 173 | NROFiller.h \
|
---|
| 174 | PKSFiller.h \
|
---|
| 175 | AsapLogSink.h
|
---|
[1446] | 176 |
|
---|
| 177 | STATICCCLIB := libasap.a
|
---|
| 178 | MEMBERS := $(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 |
|
---|
| 201 | all : $(TARGET)
|
---|
| 202 |
|
---|
| 203 | relink : cleanso $(TARGET)
|
---|
| 204 |
|
---|
| 205 | objects : $(OBJECTS)
|
---|
| 206 |
|
---|
| 207 | $(TARGET) : $(OBJECTS)
|
---|
| 208 | -@ echo
|
---|
| 209 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
| 210 |
|
---|
| 211 | $(OBJECTS) : $(HEADERS)
|
---|
| 212 |
|
---|
| 213 | staticlib: $(MEMBERS)
|
---|
| 214 |
|
---|
| 215 | clean :
|
---|
| 216 | -rm -f $(OBJECTS)
|
---|
| 217 |
|
---|
| 218 | cleanso :
|
---|
| 219 | -rm -f $(TARGET)
|
---|
| 220 |
|
---|
| 221 | realclean : clean cleanso
|
---|
| 222 |
|
---|
| 223 | test: objects tasap2.o
|
---|
| 224 | -@ echo
|
---|
| 225 | $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
|
---|