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 |
|
---|
14 | # the casa environment AIPSPATH has to be defined
|
---|
15 | CASAROOT := $(word 1, $(CASAPATH))
|
---|
16 | CASAARCH := $(word 2, $(CASAPATH))
|
---|
17 | ifeq "$(CASAARCH)" "darwin"
|
---|
18 | CASADIST := /opt/casa
|
---|
19 | else
|
---|
20 | CASADIST := /usr/lib/casapy
|
---|
21 | endif
|
---|
22 |
|
---|
23 | TARGET := libpyrap.so
|
---|
24 | INSTDIR := $(CASAROOT)/$(CASAARCH)/lib
|
---|
25 |
|
---|
26 | # CASACORE
|
---|
27 | #COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
|
---|
28 | COREINCD := $(CASAROOT)/$(CASAARCH)/include/casacore
|
---|
29 | CORELIBD := $(CASAROOT)/$(CASAARCH)/lib
|
---|
30 | CORELIB := -L$(CORELIBD) -lcasa_casa
|
---|
31 |
|
---|
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
|
---|
37 |
|
---|
38 | # numpy (use numpy in CASA)
|
---|
39 | NUMPYROOT := $(CASADIST)/lib/python2.5/site-packages/numpy
|
---|
40 | NUMPYINCD := $(NUMPYROOT)/core/include
|
---|
41 | NUMPYLIBD := $(NUMPYROOT)/core/
|
---|
42 | NUMPYLIB := #-L$(NUMPYLIBD) -lmultiarray
|
---|
43 |
|
---|
44 | # python
|
---|
45 | PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
|
---|
46 | PYTHONINCD := $(PYTHONROOT)/include/python2.5
|
---|
47 |
|
---|
48 | # the compiler
|
---|
49 | ifndef CXX
|
---|
50 | CXX := g++
|
---|
51 | endif
|
---|
52 |
|
---|
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 |
|
---|
71 | OBJECTS := $(PYRAPDIR)/PycArray.o \
|
---|
72 | $(PYRAPDIR)/PycArrayNP.o \
|
---|
73 | $(PYRAPDIR)/PycBasicData.o \
|
---|
74 | $(PYRAPDIR)/PycExcp.o \
|
---|
75 | $(PYRAPDIR)/PycRecord.o \
|
---|
76 | $(PYRAPDIR)/PycValueHolder.o #\
|
---|
77 | # $(PYRAPDIR)/PycArrayNA.o
|
---|
78 |
|
---|
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) |
---|