[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 |
|
---|
| 20 | COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
|
---|
| 21 | CORELIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CORELIB eval_vars) && echo $$CORELIB)
|
---|
| 22 | WCSLIBLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIBD eval_vars) && echo $$WCSLIBLIBD)
|
---|
| 23 | WCSLIBLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIB eval_vars) && echo $$WCSLIBLIB)
|
---|
[1762] | 24 | PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
|
---|
[1608] | 25 | PYTHONLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIBD eval_vars) && echo $$PYTHONLIBD)
|
---|
| 26 | PYTHONINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONINCD eval_vars) && echo $$PYTHONINCD)
|
---|
| 27 | PYTHONLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIB eval_vars) && echo $$PYTHONLIB)
|
---|
[1762] | 28 | #PYTHONVER := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONVER eval_vars) && echo $$PYTHONVER)
|
---|
[1608] | 29 | BOOSTROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=BOOSTROOT eval_vars) && echo $$BOOSTROOT)
|
---|
[1762] | 30 | RPFITSLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=RPFITSLIBD eval_vars) && echo $$RPFITSLIBD)
|
---|
[1608] | 31 |
|
---|
| 32 | CASAINC := -I$(CASAROOT)/code/include -I$(COREINCD) -I$(CASAROOT)/$(CASAARCH)/include
|
---|
[1446] | 33 | CASALIB := $(CASAROOT)/$(CASAARCH)/lib
|
---|
[1877] | 34 | USELIB := lib64
|
---|
[1446] | 35 |
|
---|
| 36 | # the compiler
|
---|
| 37 | ifndef CXX
|
---|
| 38 | CXX := g++
|
---|
| 39 | endif
|
---|
| 40 |
|
---|
| 41 | # compiler flags
|
---|
| 42 | CXXFLAGS := -fPIC -O3 -g
|
---|
| 43 | CXXFLAGS += -ansi -Wno-long-long -Wall
|
---|
[1879] | 44 | CXXOPTS := -DAIPS_64B
|
---|
[1446] | 45 |
|
---|
| 46 | # darwin specific flags
|
---|
| 47 | ifeq "$(CASAARCH)" "darwin"
|
---|
[1762] | 48 | #CXXFLAGS +=-DAIPS_DARWIN -arch i386 #For 10.6
|
---|
[1446] | 49 | CXXFLAGS +=-DAIPS_DARWIN
|
---|
[1762] | 50 | #CXXFLAGS += -Wno-long-double
|
---|
[1446] | 51 | endif
|
---|
| 52 |
|
---|
| 53 | # cfitsio
|
---|
| 54 | CFITSIOROOT := /usr
|
---|
| 55 | CFITSIOINC := -I$(CFITSIOROOT)/include/cfitsio
|
---|
| 56 | CFITSIOLIB := -lcfitsio
|
---|
| 57 |
|
---|
| 58 | #rpfits
|
---|
| 59 | RPFITSROOT := /usr
|
---|
| 60 | RPFITSLIB := -lrpfits
|
---|
| 61 |
|
---|
| 62 | G2CROOT := /usr
|
---|
[1608] | 63 | G2CLIB := -lgfortran
|
---|
[1446] | 64 |
|
---|
[1879] | 65 | # links to external libraries
|
---|
| 66 | CASAPPLIB := -L$(ASAPROOT)/$(ATNFD) -latnf $(CORELIB) \
|
---|
[1704] | 67 | -L$(WCSLIBLIBD) $(WCSLIBLIB) \
|
---|
[1762] | 68 | -L$(RPFITSLIBD) $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
|
---|
[1446] | 69 |
|
---|
| 70 | # darwin specific CASA flags
|
---|
| 71 | ifeq "$(CASAARCH)" "darwin"
|
---|
| 72 | CASAPPLIB += -framework vecLib
|
---|
| 73 | else
|
---|
| 74 | CASAPPLIB += -llapack -lblas
|
---|
| 75 | endif
|
---|
| 76 |
|
---|
| 77 | # python
|
---|
[1608] | 78 | PYTHONINC := $(addprefix -I,$(PYTHONINCD))
|
---|
| 79 | PYTHONLIB := -L$(PYTHONLIBD) $(PYTHONLIB)
|
---|
[1446] | 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
|
---|
[1877] | 95 | INCDIRS := -I. $(CASAINC) $(CFITSIOINC) $(BOOSTINC) $(PYTHONINC) -I$(ASAPROOT)/$(ATNFD)
|
---|
[1446] | 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 \
|
---|
[1818] | 127 | FillerBase.o \
|
---|
| 128 | NROFiller.o \
|
---|
| 129 | PKSFiller.o \
|
---|
| 130 | AsapLogSink.o \
|
---|
[1446] | 131 | Templates.o
|
---|
[1818] | 132 |
|
---|
[1446] | 133 | PYOBJECTS := 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 \
|
---|
[1693] | 143 | python_SrcType.o \
|
---|
[1757] | 144 | python_STAtmosphere.o \
|
---|
| 145 | python_STCoordinate.o \
|
---|
[1818] | 146 | python_Filler.o \
|
---|
| 147 | python_LogSink.o \
|
---|
[1446] | 148 | python_asap.o
|
---|
| 149 |
|
---|
| 150 | OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
|
---|
| 151 |
|
---|
| 152 | HEADERS := MathUtils.h \
|
---|
[1818] | 153 | LineCatalog.h \
|
---|
[1700] | 154 | Lorentzian1D.h \
|
---|
| 155 | Lorentzian1DParam.h \
|
---|
[1446] | 156 | Logger.h \
|
---|
| 157 | STAttr.h \
|
---|
| 158 | STHeader.h \
|
---|
| 159 | Scantable.h \
|
---|
| 160 | STFiller.h \
|
---|
| 161 | STMath.h \
|
---|
| 162 | RowAccumulator.h \
|
---|
| 163 | STSubTable.h \
|
---|
| 164 | STMolecules.h \
|
---|
| 165 | STTcal.h \
|
---|
| 166 | STFocus.h \
|
---|
| 167 | STWeather.h \
|
---|
| 168 | STHistory.h \
|
---|
| 169 | STFrequencies.h \
|
---|
| 170 | STDefs.h \
|
---|
| 171 | STWriter.h \
|
---|
| 172 | STSelector.h \
|
---|
| 173 | STFitter.h \
|
---|
| 174 | STFit.h \
|
---|
| 175 | STFitEntry.h \
|
---|
| 176 | STLineFinder.h \
|
---|
| 177 | Factory.h \
|
---|
| 178 | FactoryBase.h \
|
---|
| 179 | STPol.h \
|
---|
| 180 | STPolStokes.h \
|
---|
| 181 | STPolCircular.h \
|
---|
| 182 | STPolLinear.h \
|
---|
| 183 | STWriter.h \
|
---|
[1603] | 184 | STAsciiWriter.h \
|
---|
[1757] | 185 | STFITSImageWriter.h \
|
---|
| 186 | IndexedCompare.h \
|
---|
| 187 | STAtmosphere.h \
|
---|
[1818] | 188 | STCoordinate.h \
|
---|
| 189 | FillerBase.h \
|
---|
| 190 | NROFiller.h \
|
---|
| 191 | PKSFiller.h \
|
---|
| 192 | AsapLogSink.h
|
---|
[1446] | 193 |
|
---|
| 194 | STATICCCLIB := libasap.a
|
---|
| 195 | MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
|
---|
| 196 |
|
---|
| 197 | .SUFFIXES: .c .o .cpp .cc .cxx .C
|
---|
| 198 |
|
---|
| 199 | .cpp.o:
|
---|
| 200 | -@ echo
|
---|
| 201 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 202 |
|
---|
| 203 | .cc.o:
|
---|
| 204 | -@ echo
|
---|
| 205 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 206 |
|
---|
| 207 | .cxx.o:
|
---|
| 208 | -@ echo
|
---|
| 209 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 210 |
|
---|
| 211 | .C.o:
|
---|
| 212 | -@ echo
|
---|
| 213 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 214 |
|
---|
| 215 |
|
---|
| 216 | .PHONY : all clean objects realclean relink
|
---|
| 217 |
|
---|
| 218 | all : $(TARGET)
|
---|
| 219 |
|
---|
| 220 | relink : cleanso $(TARGET)
|
---|
| 221 |
|
---|
| 222 | objects : $(OBJECTS)
|
---|
| 223 |
|
---|
| 224 | $(TARGET) : $(OBJECTS)
|
---|
| 225 | -@ echo
|
---|
| 226 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
| 227 |
|
---|
| 228 | $(OBJECTS) : $(HEADERS)
|
---|
| 229 |
|
---|
| 230 | staticlib: $(MEMBERS)
|
---|
| 231 |
|
---|
| 232 | clean :
|
---|
| 233 | -rm -f $(OBJECTS)
|
---|
| 234 |
|
---|
| 235 | cleanso :
|
---|
| 236 | -rm -f $(TARGET)
|
---|
| 237 |
|
---|
| 238 | realclean : clean cleanso
|
---|
| 239 |
|
---|
| 240 | test: objects tasap2.o
|
---|
| 241 | -@ echo
|
---|
| 242 | $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
|
---|