[1198] | 1 | TARGET := _asap.so
|
---|
[794] | 2 |
|
---|
| 3 | # the casa environment AIPSPATH has to be defined
|
---|
| 4 | CASAROOT := $(word 1, $(AIPSPATH))
|
---|
| 5 | CASAARCH := $(word 2, $(AIPSPATH))
|
---|
| 6 | CASAINC := -I$(CASAROOT)/code/include -I$(CASAROOT)/code/casa
|
---|
| 7 | CASALIB := $(CASAROOT)/$(CASAARCH)/lib
|
---|
| 8 |
|
---|
| 9 |
|
---|
| 10 | # the compiler
|
---|
[635] | 11 | ifndef CXX
|
---|
| 12 | CXX := g++
|
---|
[260] | 13 | endif
|
---|
[794] | 14 |
|
---|
| 15 | # compiler flags
|
---|
[997] | 16 | CXXFLAGS := -fPIC -O3
|
---|
[1198] | 17 | CXXFLAGS += -ansi -Wno-long-long -Wall
|
---|
[684] | 18 | CXXOPTS := -DAIPS_NO_TEMPLATE_SRC
|
---|
[2] | 19 |
|
---|
[794] | 20 | # darwin specific flags
|
---|
| 21 | ifeq "$(CASAARCH)" "darwin"
|
---|
[1198] | 22 | CXXFLAGS +=-DAIPS_DARWIN
|
---|
| 23 | CXXFLAGS += -Wno-long-double
|
---|
[794] | 24 | endif
|
---|
| 25 |
|
---|
| 26 | # cfitsio
|
---|
[1259] | 27 | CFITSIOROOT := /usr/local
|
---|
[794] | 28 | CFITSIOINC := -I$(CFITSIOROOT)/include
|
---|
[1259] | 29 | CFITSIOLIB := -L$(CFITSIOROOT)/lib -lcfitsio
|
---|
[71] | 30 |
|
---|
[794] | 31 | #rpfits
|
---|
| 32 | RPFITSROOT := /usr/local
|
---|
| 33 | RPFITSLIB := $(RPFITSROOT)/lib/librpfits.a
|
---|
[684] | 34 |
|
---|
[1259] | 35 | G2CROOT := /usr/local
|
---|
[1295] | 36 | G2CARCH := #$(G2CROOT)/lib/gcc/powerpc-apple-darwin8.7.0/4.2.0/libgcc.a
|
---|
| 37 | G2CLIB := $(G2CROOT)/lib/libg2c.a $(G2CARCH)
|
---|
[1198] | 38 |
|
---|
[655] | 39 | # This assumes all casa libs are static only (*.a)
|
---|
| 40 | # if not than there might by symbol resolution errors.
|
---|
[82] | 41 | CASAPPLIB := $(CASALIB)/version.o \
|
---|
[794] | 42 | -L$(CASALIB) \
|
---|
[1295] | 43 | -latnf -lms -lcomponents -lcoordinates \
|
---|
| 44 | -llattices -lfits -lmeasures \
|
---|
[818] | 45 | -ltables -lscimath -lscimath_f -lcasa \
|
---|
| 46 | $(CASALIB)/libwcs.a \
|
---|
[1198] | 47 | $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
|
---|
[2] | 48 |
|
---|
[794] | 49 | # darwin specific CASA flags
|
---|
| 50 | ifeq "$(CASAARCH)" "darwin"
|
---|
| 51 | CASAPPLIB += -framework vecLib
|
---|
| 52 | else
|
---|
| 53 | CASAPPLIB += -llapack -lblas
|
---|
| 54 | endif
|
---|
| 55 |
|
---|
| 56 | # the linker
|
---|
[635] | 57 | LD := $(CXX)
|
---|
[794] | 58 |
|
---|
[655] | 59 | LDFLAGS := -shared -Wl$(TARGET) -s
|
---|
[794] | 60 | ifeq "$(CASAARCH)" "darwin"
|
---|
[1198] | 61 | LDFLAGS := -bundle
|
---|
[794] | 62 | endif
|
---|
[2] | 63 |
|
---|
[1198] | 64 | # python
|
---|
[655] | 65 | PYVERSION := 2.3
|
---|
[908] | 66 | PYTHONROOT := /usr
|
---|
[655] | 67 | PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
|
---|
[908] | 68 | PYTHONLIB := -L$(PYTHONROOT)/lib -lpython$(PYVERSION)
|
---|
[655] | 69 |
|
---|
[1198] | 70 | # use python universal build
|
---|
| 71 | ifeq "$(CASAARCH)" "darwin"
|
---|
| 72 | PYVERSION := 2.4
|
---|
| 73 | PYTHONROOT := /Library/Frameworks/Python.framework/Versions/$(PYVERSION)
|
---|
| 74 | PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
|
---|
| 75 | PYTHONLIB := -L$(PYTHONROOT)/lib -framework Python
|
---|
| 76 | endif
|
---|
| 77 |
|
---|
[794] | 78 | # has to be build with same g++ version as casa
|
---|
[1259] | 79 | BOOSTROOT := /usr/local
|
---|
[684] | 80 | BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python
|
---|
[635] | 81 | BOOSTINC := -I$(BOOSTROOT)/include/boost
|
---|
[2] | 82 |
|
---|
[260] | 83 |
|
---|
[794] | 84 | # DO NOT MODIFY AFTER THIS
|
---|
[897] | 85 | INCDIRS := -I. $(CASAINC) $(CFITSIOINC) $(BOOSTINC) $(PYTHONINC)
|
---|
[655] | 86 | LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB)
|
---|
[2] | 87 |
|
---|
[655] | 88 | CCOBJECTS := MathUtils.o \
|
---|
[1198] | 89 | MathUtils2.o \
|
---|
[897] | 90 | RowAccumulator.o \
|
---|
[894] | 91 | Logger.o \
|
---|
[1259] | 92 | LineCatalog.o \
|
---|
[879] | 93 | STAttr.o \
|
---|
[901] | 94 | STHeader.o \
|
---|
[818] | 95 | STFiller.o \
|
---|
| 96 | STMath.o \
|
---|
| 97 | STSubTable.o \
|
---|
| 98 | STMolecules.o \
|
---|
| 99 | STTcal.o \
|
---|
| 100 | STFocus.o \
|
---|
| 101 | STWeather.o \
|
---|
| 102 | STFrequencies.o \
|
---|
[860] | 103 | STHistory.o \
|
---|
[879] | 104 | STSelector.o \
|
---|
[894] | 105 | STLineFinder.o \
|
---|
[897] | 106 | STFitter.o \
|
---|
[962] | 107 | STFitEntry.o \
|
---|
| 108 | STFit.o \
|
---|
[906] | 109 | STPol.o \
|
---|
[897] | 110 | STPolLinear.o \
|
---|
[916] | 111 | STPolStokes.o \
|
---|
[988] | 112 | STWriter.o \
|
---|
| 113 | STAsciiWriter.o \
|
---|
[897] | 114 | Scantable.o \
|
---|
| 115 | Templates.o
|
---|
[879] | 116 | PYOBJECTS := python_Scantable.o \
|
---|
| 117 | python_STFiller.o \
|
---|
| 118 | python_STSelector.o \
|
---|
| 119 | python_STMath.o \
|
---|
[894] | 120 | python_Fitter.o \
|
---|
| 121 | python_Logger.o \
|
---|
| 122 | python_STLineFinder.o \
|
---|
[962] | 123 | python_STFitEntry.o \
|
---|
[988] | 124 | python_STWriter.o \
|
---|
[1259] | 125 | python_LineCatalog.o \
|
---|
[879] | 126 | python_asap.o
|
---|
[31] | 127 |
|
---|
[655] | 128 | OBJECTS := $(CCOBJECTS) $(PYOBJECTS)
|
---|
[2] | 129 |
|
---|
[813] | 130 | HEADERS := MathUtils.h \
|
---|
[894] | 131 | Logger.h \
|
---|
[879] | 132 | STAttr.h \
|
---|
[901] | 133 | STHeader.h \
|
---|
[813] | 134 | Scantable.h \
|
---|
[818] | 135 | STFiller.h \
|
---|
| 136 | STMath.h \
|
---|
| 137 | RowAccumulator.h \
|
---|
| 138 | STSubTable.h \
|
---|
| 139 | STMolecules.h \
|
---|
| 140 | STTcal.h \
|
---|
| 141 | STFocus.h \
|
---|
| 142 | STWeather.h \
|
---|
[860] | 143 | STHistory.h \
|
---|
[818] | 144 | STFrequencies.h \
|
---|
[828] | 145 | STDefs.h \
|
---|
| 146 | STWriter.h \
|
---|
[882] | 147 | STSelector.h \
|
---|
[894] | 148 | STFitter.h \
|
---|
[962] | 149 | STFit.h \
|
---|
| 150 | STFitEntry.h \
|
---|
[897] | 151 | STLineFinder.h \
|
---|
| 152 | Factory.h \
|
---|
| 153 | FactoryBase.h \
|
---|
| 154 | STPol.h \
|
---|
[916] | 155 | STPolStokes.h \
|
---|
[988] | 156 | STPolLinear.h \
|
---|
| 157 | STWriter.h \
|
---|
| 158 | STAsciiWriter.h
|
---|
[2] | 159 |
|
---|
[655] | 160 | STATICCCLIB := libasap.a
|
---|
| 161 | MEMBERS := $(patsubst %,$(STATICCCLIB)(%),$(CCOBJECTS))
|
---|
[193] | 162 |
|
---|
[2] | 163 | .SUFFIXES: .c .o .cpp .cc .cxx .C
|
---|
| 164 |
|
---|
| 165 | .cpp.o:
|
---|
[65] | 166 | -@ echo
|
---|
[818] | 167 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
[2] | 168 |
|
---|
| 169 | .cc.o:
|
---|
[65] | 170 | -@ echo
|
---|
[818] | 171 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
[2] | 172 |
|
---|
[65] | 173 | .cxx.o:
|
---|
| 174 | -@ echo
|
---|
[818] | 175 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
[2] | 176 |
|
---|
| 177 | .C.o:
|
---|
[65] | 178 | -@ echo
|
---|
[818] | 179 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
[2] | 180 |
|
---|
| 181 |
|
---|
[65] | 182 | .PHONY : all clean objects realclean relink
|
---|
[2] | 183 |
|
---|
[65] | 184 | all : $(TARGET)
|
---|
| 185 |
|
---|
| 186 | relink : cleanso $(TARGET)
|
---|
| 187 |
|
---|
| 188 | objects : $(OBJECTS)
|
---|
| 189 |
|
---|
| 190 | $(TARGET) : $(OBJECTS)
|
---|
| 191 | -@ echo
|
---|
[818] | 192 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
[65] | 193 |
|
---|
| 194 | $(OBJECTS) : $(HEADERS)
|
---|
| 195 |
|
---|
[655] | 196 | staticlib: $(MEMBERS)
|
---|
| 197 |
|
---|
[65] | 198 | clean :
|
---|
[2] | 199 | -rm -f $(OBJECTS)
|
---|
| 200 |
|
---|
[65] | 201 | cleanso :
|
---|
[2] | 202 | -rm -f $(TARGET)
|
---|
[65] | 203 |
|
---|
| 204 | realclean : clean cleanso
|
---|
[813] | 205 |
|
---|
[828] | 206 | test: objects tasap2.o
|
---|
[813] | 207 | -@ echo
|
---|
[828] | 208 | $(LD) -g -o /tmp/tasap2 $(OBJECTS) $(LIBS) tasap2.o
|
---|