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