[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 | ifeq "$(CASAARCH)" "darwin"
|
---|
[1892] | 19 | CASADIST := /opt/casa
|
---|
| 20 | else
|
---|
[1891] | 21 | CASADIST := /usr/lib/casapy
|
---|
| 22 | endif
|
---|
| 23 |
|
---|
[1892] | 24 | TARGET := libpyrap.so
|
---|
[1895] | 25 | TESTMOD := $(TESTDIR)/_tConvert.so
|
---|
[1892] | 26 | INSTDIR := $(CASAROOT)/$(CASAARCH)/lib
|
---|
[1891] | 27 |
|
---|
| 28 | # CASACORE
|
---|
[1892] | 29 | #COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
|
---|
[1891] | 30 | COREINCD := $(CASAROOT)/$(CASAARCH)/include/casacore
|
---|
| 31 | CORELIBD := $(CASAROOT)/$(CASAARCH)/lib
|
---|
[1892] | 32 | CORELIB := -L$(CORELIBD) -lcasa_casa
|
---|
[1891] | 33 |
|
---|
[1892] | 34 | # boost
|
---|
| 35 | BOOSTROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=BOOSTROOT eval_vars) && echo $$BOOSTROOT)
|
---|
| 36 | BOOSTINCD := $(BOOSTROOT)/include
|
---|
| 37 | BOOSTLIBD := $(BOOSTROOT)/lib
|
---|
| 38 | BOOSTLIB := -L$(BOOSTLIBD) -lboost_python
|
---|
[1891] | 39 |
|
---|
[1892] | 40 | # numpy (use numpy in CASA)
|
---|
[1891] | 41 | NUMPYROOT := $(CASADIST)/lib/python2.5/site-packages/numpy
|
---|
| 42 | NUMPYINCD := $(NUMPYROOT)/core/include
|
---|
| 43 | NUMPYLIBD := $(NUMPYROOT)/core/
|
---|
[1892] | 44 | NUMPYLIB := #-L$(NUMPYLIBD) -lmultiarray
|
---|
[1891] | 45 |
|
---|
[1892] | 46 | # python
|
---|
| 47 | PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
|
---|
| 48 | PYTHONINCD := $(PYTHONROOT)/include/python2.5
|
---|
[1891] | 49 |
|
---|
[1892] | 50 | # the compiler
|
---|
| 51 | ifndef CXX
|
---|
| 52 | CXX := g++
|
---|
| 53 | endif
|
---|
[1891] | 54 |
|
---|
[1892] | 55 | # the linker
|
---|
| 56 | LD := $(CXX)
|
---|
| 57 |
|
---|
| 58 | # compiler flags
|
---|
| 59 | CXXFLAGS := -fPIC -O3 -g
|
---|
| 60 | CXXFLAGS += -ansi -Wno-long-long -Wall
|
---|
| 61 | CXXOPTS := -DAIPS_64B -DAIPS_USENUMPY
|
---|
| 62 |
|
---|
| 63 | # links to external libraries
|
---|
| 64 | LIBS := $(CORELIB) $(BOOSTLIB) $(NUMPYLIB)
|
---|
| 65 |
|
---|
| 66 | # include directories
|
---|
| 67 | INCDIRS := -I$(COREINCD) -I$(BOOSTINCD) -I$(NUMPYINCD) \
|
---|
| 68 | -I$(PYRAPROOT) -I$(PYTHONINCD)
|
---|
| 69 |
|
---|
| 70 | # link option
|
---|
| 71 | LDFLAGS := -shared
|
---|
| 72 |
|
---|
[1891] | 73 | OBJECTS := $(PYRAPDIR)/PycArray.o \
|
---|
| 74 | $(PYRAPDIR)/PycArrayNP.o \
|
---|
| 75 | $(PYRAPDIR)/PycBasicData.o \
|
---|
[1892] | 76 | $(PYRAPDIR)/PycExcp.o \
|
---|
[1891] | 77 | $(PYRAPDIR)/PycRecord.o \
|
---|
| 78 | $(PYRAPDIR)/PycValueHolder.o #\
|
---|
| 79 | # $(PYRAPDIR)/PycArrayNA.o
|
---|
| 80 |
|
---|
[1892] | 81 | HEADERS := $(PYRAPDIR)/PycArrayComCC.h \
|
---|
| 82 | $(PYRAPDIR)/PycArrayComH.h \
|
---|
| 83 | $(PYRAPDIR)/PycArray.h \
|
---|
| 84 | $(PYRAPDIR)/PycArrayNP.h \
|
---|
| 85 | $(PYRAPDIR)/PycBasicData.h \
|
---|
| 86 | $(PYRAPDIR)/PycExcp.h \
|
---|
| 87 | $(PYRAPDIR)/PycRecord.h \
|
---|
| 88 | $(PYRAPDIR)/PycValueHolder.h #\
|
---|
| 89 | # $(PYRAPDIR)/PycArrayNA.h
|
---|
| 90 |
|
---|
[1895] | 91 | TESTSRC := $(TESTDIR)/tConvert.cc
|
---|
| 92 | TESTOBJ := $(TESTDIR)/tConvert.o
|
---|
| 93 |
|
---|
[1892] | 94 | all: $(TARGET)
|
---|
| 95 |
|
---|
| 96 | .cc.o:
|
---|
| 97 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 98 |
|
---|
| 99 | $(TARGET): $(OBJECTS)
|
---|
| 100 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
| 101 |
|
---|
| 102 | $(OBJECTS): $(HEADERS)
|
---|
| 103 |
|
---|
| 104 | clean:
|
---|
[1895] | 105 | rm -rf $(OBJECTS) $(TARGET)
|
---|
| 106 | rm -rf $(TESTDIR)/$(TESTMOD) $(TESTDIR)/$(TESTOBJ)
|
---|
[1892] | 107 |
|
---|
| 108 | install:
|
---|
[1895] | 109 | cp -f $(TARGET) $(INSTDIR)
|
---|
| 110 |
|
---|
| 111 | test:
|
---|
| 112 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $(TESTOBJ) $(TESTSRC)
|
---|
| 113 | $(LD) $(LDFLAGS) -o $(TESTMOD) $(TESTOBJ) $(LIBS) -L$(INSTDIR) -lpyrap
|
---|