[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 |
|
---|
[1905] | 19 | ifeq ($(shell uname), Darwin)
|
---|
| 20 | TARGET := libpyrap.dylib
|
---|
| 21 | TESTMOD := $(TESTDIR)/_tConvert.so
|
---|
| 22 | else
|
---|
| 23 | TARGET := libpyrap.so
|
---|
| 24 | TESTMOD := $(TESTDIR)/_tConvert.so
|
---|
| 25 | endif
|
---|
[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 | # python
|
---|
| 41 | PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
|
---|
| 42 | PYTHONINCD := $(PYTHONROOT)/include/python2.5
|
---|
[1905] | 43 | PYTHONLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIBD eval_vars) && echo $$PYTHONLIBD)
|
---|
| 44 | PYTHONLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIB eval_vars) && echo $$PYTHONLIB)
|
---|
[1891] | 45 |
|
---|
[1899] | 46 | # numpy (use numpy in CASA)
|
---|
| 47 | NUMPYROOT := $(PYTHONLIBD)/python2.5/site-packages/numpy
|
---|
| 48 | NUMPYINCD := $(NUMPYROOT)/core/include
|
---|
| 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
|
---|
[1905] | 59 | #CXXFLAGS := -fPIC -O3 -g
|
---|
| 60 | #CXXFLAGS += -ansi -Wno-long-long -Wall
|
---|
| 61 | CXXFLAGS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CXXFLAGS eval_vars) && echo $$CXXFLAGS)
|
---|
| 62 | CXXFLAGS += -fPIC -O3
|
---|
| 63 | CXXOPTS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COPTFLAGS eval_vars) && echo $$COPTFLAGS)
|
---|
| 64 | CXXOPTS += -DAIPS_USENUMPY
|
---|
[1892] | 65 |
|
---|
| 66 | # links to external libraries
|
---|
[1905] | 67 | LIBS := $(CORELIB) $(BOOSTLIB) $(PYTHONLIB)
|
---|
[1892] | 68 |
|
---|
| 69 | # include directories
|
---|
| 70 | INCDIRS := -I$(COREINCD) -I$(BOOSTINCD) -I$(NUMPYINCD) \
|
---|
| 71 | -I$(PYRAPROOT) -I$(PYTHONINCD)
|
---|
| 72 |
|
---|
| 73 | # link option
|
---|
| 74 | LDFLAGS := -shared
|
---|
| 75 |
|
---|
[1891] | 76 | OBJECTS := $(PYRAPDIR)/PycArray.o \
|
---|
| 77 | $(PYRAPDIR)/PycArrayNP.o \
|
---|
| 78 | $(PYRAPDIR)/PycBasicData.o \
|
---|
[1892] | 79 | $(PYRAPDIR)/PycExcp.o \
|
---|
[1891] | 80 | $(PYRAPDIR)/PycRecord.o \
|
---|
| 81 | $(PYRAPDIR)/PycValueHolder.o #\
|
---|
| 82 | # $(PYRAPDIR)/PycArrayNA.o
|
---|
| 83 |
|
---|
[1892] | 84 | HEADERS := $(PYRAPDIR)/PycArrayComCC.h \
|
---|
| 85 | $(PYRAPDIR)/PycArrayComH.h \
|
---|
| 86 | $(PYRAPDIR)/PycArray.h \
|
---|
| 87 | $(PYRAPDIR)/PycArrayNP.h \
|
---|
| 88 | $(PYRAPDIR)/PycBasicData.h \
|
---|
| 89 | $(PYRAPDIR)/PycExcp.h \
|
---|
| 90 | $(PYRAPDIR)/PycRecord.h \
|
---|
| 91 | $(PYRAPDIR)/PycValueHolder.h #\
|
---|
| 92 | # $(PYRAPDIR)/PycArrayNA.h
|
---|
| 93 |
|
---|
[1895] | 94 | TESTSRC := $(TESTDIR)/tConvert.cc
|
---|
| 95 | TESTOBJ := $(TESTDIR)/tConvert.o
|
---|
| 96 |
|
---|
[1892] | 97 | all: $(TARGET)
|
---|
| 98 |
|
---|
| 99 | .cc.o:
|
---|
| 100 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 101 |
|
---|
| 102 | $(TARGET): $(OBJECTS)
|
---|
| 103 | $(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
|
---|
| 104 |
|
---|
| 105 | $(OBJECTS): $(HEADERS)
|
---|
| 106 |
|
---|
| 107 | clean:
|
---|
[1899] | 108 | rm -f $(OBJECTS) $(TARGET)
|
---|
| 109 | rm -f $(TESTDIR)/$(TESTMOD) $(TESTDIR)/$(TESTOBJ)
|
---|
| 110 | rm -f $(INSTDIR)/$(TARGET)
|
---|
[1892] | 111 |
|
---|
| 112 | install:
|
---|
[1895] | 113 | cp -f $(TARGET) $(INSTDIR)
|
---|
| 114 |
|
---|
| 115 | test:
|
---|
| 116 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $(TESTOBJ) $(TESTSRC)
|
---|
[1905] | 117 | $(LD) $(LDFLAGS) -o $(TESTMOD) $(TESTOBJ) $(LIBS) -L$(EXTDIR) -lpyrap
|
---|