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