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 | ifeq ($(shell uname), Darwin)
|
---|
20 | TARGET := libpyrap.dylib
|
---|
21 | TESTMOD := $(TESTDIR)/_tConvert.dylib
|
---|
22 | else
|
---|
23 | TARGET := libpyrap.so
|
---|
24 | TESTMOD := $(TESTDIR)/_tConvert.so
|
---|
25 | endif
|
---|
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 | # python
|
---|
41 | PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
|
---|
42 | PYTHONINCD := $(PYTHONROOT)/include/python2.5
|
---|
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)
|
---|
45 |
|
---|
46 | # numpy (use numpy in CASA)
|
---|
47 | NUMPYROOT := $(PYTHONLIBD)/python2.5/site-packages/numpy
|
---|
48 | NUMPYINCD := $(NUMPYROOT)/core/include
|
---|
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 | 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
|
---|
65 |
|
---|
66 | # links to external libraries
|
---|
67 | LIBS := $(CORELIB) $(BOOSTLIB) $(PYTHONLIB)
|
---|
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 |
|
---|
76 | OBJECTS := $(PYRAPDIR)/PycArray.o \
|
---|
77 | $(PYRAPDIR)/PycArrayNP.o \
|
---|
78 | $(PYRAPDIR)/PycBasicData.o \
|
---|
79 | $(PYRAPDIR)/PycExcp.o \
|
---|
80 | $(PYRAPDIR)/PycRecord.o \
|
---|
81 | $(PYRAPDIR)/PycValueHolder.o #\
|
---|
82 | # $(PYRAPDIR)/PycArrayNA.o
|
---|
83 |
|
---|
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 |
|
---|
94 | TESTSRC := $(TESTDIR)/tConvert.cc
|
---|
95 | TESTOBJ := $(TESTDIR)/tConvert.o
|
---|
96 |
|
---|
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:
|
---|
108 | rm -f $(OBJECTS) $(TARGET)
|
---|
109 | rm -f $(TESTDIR)/$(TESTMOD) $(TESTDIR)/$(TESTOBJ)
|
---|
110 | rm -f $(INSTDIR)/$(TARGET)
|
---|
111 |
|
---|
112 | install:
|
---|
113 | cp -f $(TARGET) $(INSTDIR)
|
---|
114 |
|
---|
115 | test:
|
---|
116 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $(TESTOBJ) $(TESTSRC)
|
---|
117 | $(LD) $(LDFLAGS) -o $(TESTMOD) $(TESTOBJ) $(LIBS) -L$(EXTDIR) -lpyrap
|
---|