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)
|
---|
11 | PYRAPROOT := $(EXTDIR)/pyrap-0.3.2/
|
---|
12 | PYRAPDIR := $(EXTDIR)/pyrap-0.3.2/pyrap/Converters
|
---|
13 | TESTDIR := $(PYRAPDIR)/test
|
---|
14 |
|
---|
15 | # the casa environment AIPSPATH has to be defined
|
---|
16 | CASAROOT := $(word 1, $(CASAPATH))
|
---|
17 | CASAARCH := $(word 2, $(CASAPATH))
|
---|
18 |
|
---|
19 | TARGET := libpyrap.so
|
---|
20 | TESTMOD := $(TESTDIR)/_tConvert.so
|
---|
21 | INSTDIR := $(CASAROOT)/$(CASAARCH)/lib
|
---|
22 |
|
---|
23 | # CASACORE
|
---|
24 | #COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
|
---|
25 | COREINCD := $(CASAROOT)/$(CASAARCH)/include/casacore
|
---|
26 | CORELIBD := $(CASAROOT)/$(CASAARCH)/lib
|
---|
27 | CORELIB := -L$(CORELIBD) -lcasa_casa
|
---|
28 |
|
---|
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
|
---|
34 |
|
---|
35 | # python
|
---|
36 | PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
|
---|
37 | PYTHONINCD := $(PYTHONROOT)/include/python2.5
|
---|
38 |
|
---|
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
|
---|
43 | NUMPYLIBD := $(NUMPYROOT)/core
|
---|
44 | NUMPYLIB := $(NUMPYLIBD)/multiarray.so
|
---|
45 |
|
---|
46 | # the compiler
|
---|
47 | ifndef CXX
|
---|
48 | CXX := g++
|
---|
49 | endif
|
---|
50 |
|
---|
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
|
---|
60 | LIBS := $(CORELIB) $(BOOSTLIB) $(NUMPYLIB)
|
---|
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 |
|
---|
69 | OBJECTS := $(PYRAPDIR)/PycArray.o \
|
---|
70 | $(PYRAPDIR)/PycArrayNP.o \
|
---|
71 | $(PYRAPDIR)/PycBasicData.o \
|
---|
72 | $(PYRAPDIR)/PycExcp.o \
|
---|
73 | $(PYRAPDIR)/PycRecord.o \
|
---|
74 | $(PYRAPDIR)/PycValueHolder.o #\
|
---|
75 | # $(PYRAPDIR)/PycArrayNA.o
|
---|
76 |
|
---|
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 |
|
---|
87 | TESTSRC := $(TESTDIR)/tConvert.cc
|
---|
88 | TESTOBJ := $(TESTDIR)/tConvert.o
|
---|
89 |
|
---|
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:
|
---|
101 | rm -f $(OBJECTS) $(TARGET)
|
---|
102 | rm -f $(TESTDIR)/$(TESTMOD) $(TESTDIR)/$(TESTOBJ)
|
---|
103 | rm -f $(INSTDIR)/$(TARGET)
|
---|
104 |
|
---|
105 | install:
|
---|
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
|
---|