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