[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
|
---|
[1762] | 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 |
|
---|
| 65 | # This assumes all casa libs are static only (*.a)
|
---|
| 66 | # if not than there might by symbol resolution errors.
|
---|
[1608] | 67 | CASAPPLIB := -L$(CASALIB) -latnf $(CORELIB) \
|
---|
[1704] | 68 | -L$(WCSLIBLIBD) $(WCSLIBLIB) \
|
---|
[1762] | 69 | -L$(RPFITSLIBD) $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
|
---|
[1446] | 70 |
|
---|
| 71 | # darwin specific CASA flags
|
---|
| 72 | ifeq "$(CASAARCH)" "darwin"
|
---|
| 73 | CASAPPLIB += -framework vecLib
|
---|
| 74 | else
|
---|
| 75 | CASAPPLIB += -llapack -lblas
|
---|
| 76 | endif
|
---|
| 77 |
|
---|
| 78 | # python
|
---|
[1608] | 79 | PYTHONINC := $(addprefix -I,$(PYTHONINCD))
|
---|
| 80 | PYTHONLIB := -L$(PYTHONLIBD) $(PYTHONLIB)
|
---|
[1446] | 81 |
|
---|
| 82 | # use python universal build
|
---|
[1762] | 83 | #ifeq "$(CASAARCH)" "darwin"
|
---|
| 84 | # PYVERSION := 2.5
|
---|
| 85 | # PYTHONROOT := /Library/Frameworks/Python.framework/Versions/$(PYVERSION)
|
---|
| 86 | # PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
|
---|
| 87 | # PYTHONLIB := -L$(PYTHONROOT)/lib -framework Python
|
---|
| 88 | #endif
|
---|
[1446] | 89 |
|
---|
| 90 | # the linker
|
---|
| 91 | LD := $(CXX)
|
---|
| 92 |
|
---|
| 93 | # has to be build with same g++ version as casa
|
---|
| 94 | BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
|
---|
[1608] | 95 | BOOSTINC := -I$(BOOSTROOT)/include/boost -I$(BOOSTROOT)/include
|
---|
[1446] | 96 |
|
---|
| 97 | LDFLAGS := -shared -Wl$(TARGET) -s -Xlinker -rpath -Xlinker $(BOOSTROOT)/lib:$(PYTHONROOT)/lib:$(CASALIB)
|
---|
| 98 | ifeq "$(CASAARCH)" "darwin"
|
---|
| 99 | LDFLAGS := -bundle
|
---|
| 100 | endif
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 | # DO NOT MODIFY AFTER THIS
|
---|
[1877] | 104 | INCDIRS := -I. $(CASAINC) $(CFITSIOINC) $(BOOSTINC) $(PYTHONINC) -I$(ASAPROOT)/$(ATNFD)
|
---|
[1446] | 105 | LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
|
---|
| 106 |
|
---|
| 107 | CCOBJECTS := MathUtils.o \
|
---|
| 108 | RowAccumulator.o \
|
---|
| 109 | Logger.o \
|
---|
| 110 | LineCatalog.o \
|
---|
| 111 | STAttr.o \
|
---|
| 112 | STHeader.o \
|
---|
| 113 | STFiller.o \
|
---|
| 114 | STMath.o \
|
---|
| 115 | STSubTable.o \
|
---|
| 116 | STMolecules.o \
|
---|
| 117 | STTcal.o \
|
---|
| 118 | STFocus.o \
|
---|
| 119 | STWeather.o \
|
---|
| 120 | STFrequencies.o \
|
---|
| 121 | STHistory.o \
|
---|
| 122 | STSelector.o \
|
---|
| 123 | STLineFinder.o \
|
---|
| 124 | STFitter.o \
|
---|
| 125 | STFitEntry.o \
|
---|
| 126 | STFit.o \
|
---|
| 127 | STPol.o \
|
---|
| 128 | STPolLinear.o \
|
---|
| 129 | STPolCircular.o \
|
---|
| 130 | STPolStokes.o \
|
---|
| 131 | STWriter.o \
|
---|
| 132 | STAsciiWriter.o \
|
---|
[1603] | 133 | STFITSImageWriter.o \
|
---|
[1757] | 134 | STAtmosphere.o \
|
---|
[1446] | 135 | Scantable.o \
|
---|
[1818] | 136 | FillerBase.o \
|
---|
| 137 | NROFiller.o \
|
---|
| 138 | PKSFiller.o \
|
---|
| 139 | AsapLogSink.o \
|
---|
[1446] | 140 | Templates.o
|
---|
[1818] | 141 |
|
---|
[1446] | 142 | PYOBJECTS := python_Scantable.o \
|
---|
| 143 | python_STFiller.o \
|
---|
| 144 | python_STSelector.o \
|
---|
| 145 | python_STMath.o \
|
---|
| 146 | python_Fitter.o \
|
---|
| 147 | python_Logger.o \
|
---|
| 148 | python_STLineFinder.o \
|
---|
| 149 | python_STFitEntry.o \
|
---|
| 150 | python_STWriter.o \
|
---|
| 151 | python_LineCatalog.o \
|
---|
[1693] | 152 | python_SrcType.o \
|
---|
[1757] | 153 | python_STAtmosphere.o \
|
---|
| 154 | python_STCoordinate.o \
|
---|
[1818] | 155 | python_Filler.o \
|
---|
| 156 | python_LogSink.o \
|
---|
[1446] | 157 | python_asap.o
|
---|
| 158 |
|
---|
| 159 | OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
|
---|
| 160 |
|
---|
| 161 | HEADERS := MathUtils.h \
|
---|
[1818] | 162 | LineCatalog.h \
|
---|
[1700] | 163 | Lorentzian1D.h \
|
---|
| 164 | Lorentzian1DParam.h \
|
---|
[1446] | 165 | Logger.h \
|
---|
| 166 | STAttr.h \
|
---|
| 167 | STHeader.h \
|
---|
| 168 | Scantable.h \
|
---|
| 169 | STFiller.h \
|
---|
| 170 | STMath.h \
|
---|
| 171 | RowAccumulator.h \
|
---|
| 172 | STSubTable.h \
|
---|
| 173 | STMolecules.h \
|
---|
| 174 | STTcal.h \
|
---|
| 175 | STFocus.h \
|
---|
| 176 | STWeather.h \
|
---|
| 177 | STHistory.h \
|
---|
| 178 | STFrequencies.h \
|
---|
| 179 | STDefs.h \
|
---|
| 180 | STWriter.h \
|
---|
| 181 | STSelector.h \
|
---|
| 182 | STFitter.h \
|
---|
| 183 | STFit.h \
|
---|
| 184 | STFitEntry.h \
|
---|
| 185 | STLineFinder.h \
|
---|
| 186 | Factory.h \
|
---|
| 187 | FactoryBase.h \
|
---|
| 188 | STPol.h \
|
---|
| 189 | STPolStokes.h \
|
---|
| 190 | STPolCircular.h \
|
---|
| 191 | STPolLinear.h \
|
---|
| 192 | STWriter.h \
|
---|
[1603] | 193 | STAsciiWriter.h \
|
---|
[1757] | 194 | STFITSImageWriter.h \
|
---|
| 195 | IndexedCompare.h \
|
---|
| 196 | STAtmosphere.h \
|
---|
[1818] | 197 | STCoordinate.h \
|
---|
| 198 | FillerBase.h \
|
---|
| 199 | NROFiller.h \
|
---|
| 200 | PKSFiller.h \
|
---|
| 201 | AsapLogSink.h
|
---|
[1446] | 202 |
|
---|
| 203 | STATICCCLIB := libasap.a
|
---|
| 204 | MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
|
---|
| 205 |
|
---|
| 206 | .SUFFIXES: .c .o .cpp .cc .cxx .C
|
---|
| 207 |
|
---|
| 208 | .cpp.o:
|
---|
| 209 | -@ echo
|
---|
| 210 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 211 |
|
---|
| 212 | .cc.o:
|
---|
| 213 | -@ echo
|
---|
| 214 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 215 |
|
---|
| 216 | .cxx.o:
|
---|
| 217 | -@ echo
|
---|
| 218 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 219 |
|
---|
| 220 | .C.o:
|
---|
| 221 | -@ echo
|
---|
| 222 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 223 |
|
---|
| 224 |
|
---|
| 225 | .PHONY : all clean objects realclean relink
|
---|
| 226 |
|
---|
| 227 | all : $(TARGET)
|
---|
| 228 |
|
---|
| 229 | relink : cleanso $(TARGET)
|
---|
| 230 |
|
---|
| 231 | objects : $(OBJECTS)
|
---|
| 232 |
|
---|
| 233 | $(TARGET) : $(OBJECTS)
|
---|
| 234 | -@ echo
|
---|
| 235 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
| 236 |
|
---|
| 237 | $(OBJECTS) : $(HEADERS)
|
---|
| 238 |
|
---|
| 239 | staticlib: $(MEMBERS)
|
---|
| 240 |
|
---|
| 241 | clean :
|
---|
| 242 | -rm -f $(OBJECTS)
|
---|
| 243 |
|
---|
| 244 | cleanso :
|
---|
| 245 | -rm -f $(TARGET)
|
---|
| 246 |
|
---|
| 247 | realclean : clean cleanso
|
---|
| 248 |
|
---|
| 249 | test: objects tasap2.o
|
---|
| 250 | -@ echo
|
---|
| 251 | $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
|
---|