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