[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'.
|
---|
[1520] | 9 | TARGET := /tmp/_asap.so
|
---|
[1446] | 10 |
|
---|
| 11 | # the casa environment AIPSPATH has to be defined
|
---|
[1455] | 12 | CASAROOT := $(word 1, $(CASAPATH))
|
---|
| 13 | CASAARCH := $(word 2, $(CASAPATH))
|
---|
[1608] | 14 |
|
---|
| 15 | COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
|
---|
| 16 | CORELIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CORELIB eval_vars) && echo $$CORELIB)
|
---|
| 17 | WCSLIBLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIBD eval_vars) && echo $$WCSLIBLIBD)
|
---|
| 18 | WCSLIBLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIB eval_vars) && echo $$WCSLIBLIB)
|
---|
[1762] | 19 | PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
|
---|
[1608] | 20 | PYTHONLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIBD eval_vars) && echo $$PYTHONLIBD)
|
---|
| 21 | PYTHONINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONINCD eval_vars) && echo $$PYTHONINCD)
|
---|
| 22 | PYTHONLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIB eval_vars) && echo $$PYTHONLIB)
|
---|
[1762] | 23 | #PYTHONVER := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONVER eval_vars) && echo $$PYTHONVER)
|
---|
[1608] | 24 | BOOSTROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=BOOSTROOT eval_vars) && echo $$BOOSTROOT)
|
---|
[1762] | 25 | RPFITSLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=RPFITSLIBD eval_vars) && echo $$RPFITSLIBD)
|
---|
[1608] | 26 |
|
---|
| 27 | CASAINC := -I$(CASAROOT)/code/include -I$(COREINCD) -I$(CASAROOT)/$(CASAARCH)/include
|
---|
[1446] | 28 | CASALIB := $(CASAROOT)/$(CASAARCH)/lib
|
---|
[1762] | 29 | #USELIB := lib64
|
---|
| 30 | USELIB := lib
|
---|
[1446] | 31 |
|
---|
| 32 | # the compiler
|
---|
| 33 | ifndef CXX
|
---|
| 34 | CXX := g++
|
---|
| 35 | endif
|
---|
| 36 |
|
---|
| 37 | # compiler flags
|
---|
| 38 | CXXFLAGS := -fPIC -O3 -g
|
---|
| 39 | CXXFLAGS += -ansi -Wno-long-long -Wall
|
---|
[1762] | 40 | #CXXOPTS := -DAIPS_64B
|
---|
[1446] | 41 |
|
---|
| 42 | # darwin specific flags
|
---|
| 43 | ifeq "$(CASAARCH)" "darwin"
|
---|
[1762] | 44 | #CXXFLAGS +=-DAIPS_DARWIN -arch i386 #For 10.6
|
---|
[1446] | 45 | CXXFLAGS +=-DAIPS_DARWIN
|
---|
[1762] | 46 | #CXXFLAGS += -Wno-long-double
|
---|
[1446] | 47 | endif
|
---|
| 48 |
|
---|
| 49 | # cfitsio
|
---|
| 50 | CFITSIOROOT := /usr
|
---|
| 51 | CFITSIOINC := -I$(CFITSIOROOT)/include/cfitsio
|
---|
| 52 | CFITSIOLIB := -lcfitsio
|
---|
| 53 |
|
---|
| 54 | #rpfits
|
---|
| 55 | RPFITSROOT := /usr
|
---|
| 56 | RPFITSLIB := -lrpfits
|
---|
| 57 |
|
---|
| 58 | G2CROOT := /usr
|
---|
[1608] | 59 | G2CLIB := -lgfortran
|
---|
[1446] | 60 |
|
---|
| 61 | # This assumes all casa libs are static only (*.a)
|
---|
| 62 | # if not than there might by symbol resolution errors.
|
---|
[1608] | 63 | CASAPPLIB := -L$(CASALIB) -latnf $(CORELIB) \
|
---|
[1704] | 64 | -L$(WCSLIBLIBD) $(WCSLIBLIB) \
|
---|
[1762] | 65 | -L$(RPFITSLIBD) $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
|
---|
[1446] | 66 |
|
---|
| 67 | # darwin specific CASA flags
|
---|
| 68 | ifeq "$(CASAARCH)" "darwin"
|
---|
| 69 | CASAPPLIB += -framework vecLib
|
---|
| 70 | else
|
---|
| 71 | CASAPPLIB += -llapack -lblas
|
---|
| 72 | endif
|
---|
| 73 |
|
---|
| 74 | # python
|
---|
[1608] | 75 | PYTHONINC := $(addprefix -I,$(PYTHONINCD))
|
---|
| 76 | PYTHONLIB := -L$(PYTHONLIBD) $(PYTHONLIB)
|
---|
[1446] | 77 |
|
---|
| 78 | # use python universal build
|
---|
[1762] | 79 | #ifeq "$(CASAARCH)" "darwin"
|
---|
| 80 | # PYVERSION := 2.5
|
---|
| 81 | # PYTHONROOT := /Library/Frameworks/Python.framework/Versions/$(PYVERSION)
|
---|
| 82 | # PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
|
---|
| 83 | # PYTHONLIB := -L$(PYTHONROOT)/lib -framework Python
|
---|
| 84 | #endif
|
---|
[1446] | 85 |
|
---|
| 86 | # the linker
|
---|
| 87 | LD := $(CXX)
|
---|
| 88 |
|
---|
| 89 | # has to be build with same g++ version as casa
|
---|
| 90 | BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
|
---|
[1608] | 91 | BOOSTINC := -I$(BOOSTROOT)/include/boost -I$(BOOSTROOT)/include
|
---|
[1446] | 92 |
|
---|
| 93 | LDFLAGS := -shared -Wl$(TARGET) -s -Xlinker -rpath -Xlinker $(BOOSTROOT)/lib:$(PYTHONROOT)/lib:$(CASALIB)
|
---|
| 94 | ifeq "$(CASAARCH)" "darwin"
|
---|
| 95 | LDFLAGS := -bundle
|
---|
| 96 | endif
|
---|
| 97 |
|
---|
| 98 |
|
---|
| 99 | # DO NOT MODIFY AFTER THIS
|
---|
| 100 | INCDIRS := -I. $(CASAINC) $(CFITSIOINC) $(BOOSTINC) $(PYTHONINC)
|
---|
| 101 | LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
|
---|
| 102 |
|
---|
| 103 | CCOBJECTS := MathUtils.o \
|
---|
| 104 | RowAccumulator.o \
|
---|
| 105 | Logger.o \
|
---|
| 106 | LineCatalog.o \
|
---|
| 107 | STAttr.o \
|
---|
| 108 | STHeader.o \
|
---|
| 109 | STFiller.o \
|
---|
| 110 | STMath.o \
|
---|
| 111 | STSubTable.o \
|
---|
| 112 | STMolecules.o \
|
---|
| 113 | STTcal.o \
|
---|
| 114 | STFocus.o \
|
---|
| 115 | STWeather.o \
|
---|
| 116 | STFrequencies.o \
|
---|
| 117 | STHistory.o \
|
---|
| 118 | STSelector.o \
|
---|
| 119 | STLineFinder.o \
|
---|
| 120 | STFitter.o \
|
---|
| 121 | STFitEntry.o \
|
---|
| 122 | STFit.o \
|
---|
| 123 | STPol.o \
|
---|
| 124 | STPolLinear.o \
|
---|
| 125 | STPolCircular.o \
|
---|
| 126 | STPolStokes.o \
|
---|
| 127 | STWriter.o \
|
---|
| 128 | STAsciiWriter.o \
|
---|
[1603] | 129 | STFITSImageWriter.o \
|
---|
[1757] | 130 | STAtmosphere.o \
|
---|
[1446] | 131 | Scantable.o \
|
---|
[1792] | 132 | FillerBase.o \
|
---|
| 133 | NROFiller.o \
|
---|
[1446] | 134 | Templates.o
|
---|
| 135 | PYOBJECTS := python_Scantable.o \
|
---|
| 136 | python_STFiller.o \
|
---|
| 137 | python_STSelector.o \
|
---|
| 138 | python_STMath.o \
|
---|
| 139 | python_Fitter.o \
|
---|
| 140 | python_Logger.o \
|
---|
| 141 | python_STLineFinder.o \
|
---|
| 142 | python_STFitEntry.o \
|
---|
| 143 | python_STWriter.o \
|
---|
| 144 | python_LineCatalog.o \
|
---|
[1693] | 145 | python_SrcType.o \
|
---|
[1757] | 146 | python_STAtmosphere.o \
|
---|
| 147 | python_STCoordinate.o \
|
---|
[1792] | 148 | python_Filler.o \
|
---|
[1446] | 149 | python_asap.o
|
---|
| 150 |
|
---|
| 151 | OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
|
---|
| 152 |
|
---|
| 153 | HEADERS := MathUtils.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 \
|
---|
| 188 | STCoordinate.h
|
---|
[1446] | 189 |
|
---|
| 190 | STATICCCLIB := libasap.a
|
---|
| 191 | MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
|
---|
| 192 |
|
---|
| 193 | .SUFFIXES: .c .o .cpp .cc .cxx .C
|
---|
| 194 |
|
---|
| 195 | .cpp.o:
|
---|
| 196 | -@ echo
|
---|
| 197 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 198 |
|
---|
| 199 | .cc.o:
|
---|
| 200 | -@ echo
|
---|
| 201 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 202 |
|
---|
| 203 | .cxx.o:
|
---|
| 204 | -@ echo
|
---|
| 205 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 206 |
|
---|
| 207 | .C.o:
|
---|
| 208 | -@ echo
|
---|
| 209 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 210 |
|
---|
| 211 |
|
---|
| 212 | .PHONY : all clean objects realclean relink
|
---|
| 213 |
|
---|
| 214 | all : $(TARGET)
|
---|
| 215 |
|
---|
| 216 | relink : cleanso $(TARGET)
|
---|
| 217 |
|
---|
| 218 | objects : $(OBJECTS)
|
---|
| 219 |
|
---|
| 220 | $(TARGET) : $(OBJECTS)
|
---|
| 221 | -@ echo
|
---|
| 222 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
| 223 |
|
---|
| 224 | $(OBJECTS) : $(HEADERS)
|
---|
| 225 |
|
---|
| 226 | staticlib: $(MEMBERS)
|
---|
| 227 |
|
---|
| 228 | clean :
|
---|
| 229 | -rm -f $(OBJECTS)
|
---|
| 230 |
|
---|
| 231 | cleanso :
|
---|
| 232 | -rm -f $(TARGET)
|
---|
| 233 |
|
---|
| 234 | realclean : clean cleanso
|
---|
| 235 |
|
---|
| 236 | test: objects tasap2.o
|
---|
| 237 | -@ echo
|
---|
| 238 | $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
|
---|