[1891] | 1 | #####
|
---|
| 2 | # Makefile for libpyrap
|
---|
| 3 | #
|
---|
| 4 | # ASSUMPTION:
|
---|
| 5 | # CASA+CASACORE build environment
|
---|
| 6 | # numpy is installed (installing CASA is fine since it contains numpy)
|
---|
| 7 | # boost is installed
|
---|
| 8 | #
|
---|
| 9 | #####
|
---|
| 10 | EXTDIR := $(shell pwd)
|
---|
[1892] | 11 | PYRAPROOT := $(EXTDIR)/pyrap-0.3.2/
|
---|
[1891] | 12 | PYRAPDIR := $(EXTDIR)/pyrap-0.3.2/pyrap/Converters
|
---|
[1895] | 13 | TESTDIR := $(PYRAPDIR)/test
|
---|
[1891] | 14 |
|
---|
| 15 | # the casa environment AIPSPATH has to be defined
|
---|
| 16 | CASAROOT := $(word 1, $(CASAPATH))
|
---|
| 17 | CASAARCH := $(word 2, $(CASAPATH))
|
---|
| 18 |
|
---|
[1892] | 19 | TARGET := libpyrap.so
|
---|
[1895] | 20 | TESTMOD := $(TESTDIR)/_tConvert.so
|
---|
[1892] | 21 | INSTDIR := $(CASAROOT)/$(CASAARCH)/lib
|
---|
[1891] | 22 |
|
---|
| 23 | # CASACORE
|
---|
[1892] | 24 | #COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
|
---|
[1891] | 25 | COREINCD := $(CASAROOT)/$(CASAARCH)/include/casacore
|
---|
| 26 | CORELIBD := $(CASAROOT)/$(CASAARCH)/lib
|
---|
[1892] | 27 | CORELIB := -L$(CORELIBD) -lcasa_casa
|
---|
[1891] | 28 |
|
---|
[1892] | 29 | # boost
|
---|
| 30 | BOOSTROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=BOOSTROOT eval_vars) && echo $$BOOSTROOT)
|
---|
| 31 | BOOSTINCD := $(BOOSTROOT)/include
|
---|
| 32 | BOOSTLIBD := $(BOOSTROOT)/lib
|
---|
| 33 | BOOSTLIB := -L$(BOOSTLIBD) -lboost_python
|
---|
[1891] | 34 |
|
---|
[1892] | 35 | # python
|
---|
| 36 | PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
|
---|
| 37 | PYTHONINCD := $(PYTHONROOT)/include/python2.5
|
---|
[1891] | 38 |
|
---|
[1899] | 39 | # numpy (use numpy in CASA)
|
---|
| 40 | PYTHONLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIBD eval_vars) && echo $$PYTHONLIBD)
|
---|
| 41 | NUMPYROOT := $(PYTHONLIBD)/python2.5/site-packages/numpy
|
---|
| 42 | NUMPYINCD := $(NUMPYROOT)/core/include
|
---|
[1900] | 43 | NUMPYLIBD := $(NUMPYROOT)/core
|
---|
| 44 | NUMPYLIB := $(NUMPYLIBD)/multiarray.so
|
---|
[1899] | 45 |
|
---|
[1892] | 46 | # the compiler
|
---|
| 47 | ifndef CXX
|
---|
| 48 | CXX := g++
|
---|
| 49 | endif
|
---|
[1891] | 50 |
|
---|
[1892] | 51 | # the linker
|
---|
| 52 | LD := $(CXX)
|
---|
| 53 |
|
---|
| 54 | # compiler flags
|
---|
| 55 | CXXFLAGS := -fPIC -O3 -g
|
---|
| 56 | CXXFLAGS += -ansi -Wno-long-long -Wall
|
---|
| 57 | CXXOPTS := -DAIPS_64B -DAIPS_USENUMPY
|
---|
| 58 |
|
---|
| 59 | # links to external libraries
|
---|
[1900] | 60 | LIBS := $(CORELIB) $(BOOSTLIB) $(NUMPYLIB)
|
---|
[1892] | 61 |
|
---|
| 62 | # include directories
|
---|
| 63 | INCDIRS := -I$(COREINCD) -I$(BOOSTINCD) -I$(NUMPYINCD) \
|
---|
| 64 | -I$(PYRAPROOT) -I$(PYTHONINCD)
|
---|
| 65 |
|
---|
| 66 | # link option
|
---|
| 67 | LDFLAGS := -shared
|
---|
| 68 |
|
---|
[1891] | 69 | OBJECTS := $(PYRAPDIR)/PycArray.o \
|
---|
| 70 | $(PYRAPDIR)/PycArrayNP.o \
|
---|
| 71 | $(PYRAPDIR)/PycBasicData.o \
|
---|
[1892] | 72 | $(PYRAPDIR)/PycExcp.o \
|
---|
[1891] | 73 | $(PYRAPDIR)/PycRecord.o \
|
---|
| 74 | $(PYRAPDIR)/PycValueHolder.o #\
|
---|
| 75 | # $(PYRAPDIR)/PycArrayNA.o
|
---|
| 76 |
|
---|
[1892] | 77 | HEADERS := $(PYRAPDIR)/PycArrayComCC.h \
|
---|
| 78 | $(PYRAPDIR)/PycArrayComH.h \
|
---|
| 79 | $(PYRAPDIR)/PycArray.h \
|
---|
| 80 | $(PYRAPDIR)/PycArrayNP.h \
|
---|
| 81 | $(PYRAPDIR)/PycBasicData.h \
|
---|
| 82 | $(PYRAPDIR)/PycExcp.h \
|
---|
| 83 | $(PYRAPDIR)/PycRecord.h \
|
---|
| 84 | $(PYRAPDIR)/PycValueHolder.h #\
|
---|
| 85 | # $(PYRAPDIR)/PycArrayNA.h
|
---|
| 86 |
|
---|
[1895] | 87 | TESTSRC := $(TESTDIR)/tConvert.cc
|
---|
| 88 | TESTOBJ := $(TESTDIR)/tConvert.o
|
---|
| 89 |
|
---|
[1892] | 90 | all: $(TARGET)
|
---|
| 91 |
|
---|
| 92 | .cc.o:
|
---|
| 93 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 94 |
|
---|
| 95 | $(TARGET): $(OBJECTS)
|
---|
| 96 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
| 97 |
|
---|
| 98 | $(OBJECTS): $(HEADERS)
|
---|
| 99 |
|
---|
| 100 | clean:
|
---|
[1899] | 101 | rm -f $(OBJECTS) $(TARGET)
|
---|
| 102 | rm -f $(TESTDIR)/$(TESTMOD) $(TESTDIR)/$(TESTOBJ)
|
---|
| 103 | rm -f $(INSTDIR)/$(TARGET)
|
---|
[1892] | 104 |
|
---|
| 105 | install:
|
---|
[1895] | 106 | cp -f $(TARGET) $(INSTDIR)
|
---|
| 107 |
|
---|
| 108 | test:
|
---|
| 109 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $(TESTOBJ) $(TESTSRC)
|
---|
| 110 | $(LD) $(LDFLAGS) -o $(TESTMOD) $(TESTOBJ) $(LIBS) -L$(INSTDIR) -lpyrap
|
---|