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.so
|
---|
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 | CORELIBD := $(CASAROOT)/$(CASAARCH)/lib
|
---|
31 | CORELIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CORELIB eval_vars) && echo $$CORELIB)
|
---|
32 |
|
---|
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
|
---|
38 |
|
---|
39 | # python
|
---|
40 | PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
|
---|
41 | PYTHONINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONINCD eval_vars) && echo $$PYTHONINCD)
|
---|
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)
|
---|
44 |
|
---|
45 | # numpy (use numpy in CASA)
|
---|
46 | #NUMPYROOT := $(PYTHONLIBD)/python2.5/site-packages/numpy
|
---|
47 | #NUMPYINCD := $(NUMPYROOT)/core/include
|
---|
48 |
|
---|
49 | # the compiler
|
---|
50 | ifndef CXX
|
---|
51 | CXX := g++
|
---|
52 | endif
|
---|
53 |
|
---|
54 | # the linker
|
---|
55 | LD := $(CXX)
|
---|
56 |
|
---|
57 | # compiler flags
|
---|
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
|
---|
64 |
|
---|
65 | # links to external libraries
|
---|
66 | LIBS := $(CORELIB) $(BOOSTLIB) $(PYTHONLIB)
|
---|
67 |
|
---|
68 | # include directories
|
---|
69 | INCDIRS := -I$(COREINCD) -I$(BOOSTINCD) \
|
---|
70 | -I$(PYRAPROOT) $(addprefix -I, $(PYTHONINCD))
|
---|
71 |
|
---|
72 | # link option
|
---|
73 | LDFLAGS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=LD_FLAGS eval_vars) && echo $$LD_FLAGS)
|
---|
74 | LDFLAGS += -shared
|
---|
75 | ifeq ($(shell uname), Darwin)
|
---|
76 | LDFLAGS += -headerpad_max_install_names -install_name $(CASAROOT)/$(CASAARCH)/lib/$(TARGET)
|
---|
77 | endif
|
---|
78 |
|
---|
79 | OBJECTS := $(PYRAPDIR)/PycArray.o \
|
---|
80 | $(PYRAPDIR)/PycArrayNP.o \
|
---|
81 | $(PYRAPDIR)/PycBasicData.o \
|
---|
82 | $(PYRAPDIR)/PycExcp.o \
|
---|
83 | $(PYRAPDIR)/PycRecord.o \
|
---|
84 | $(PYRAPDIR)/PycValueHolder.o #\
|
---|
85 | # $(PYRAPDIR)/PycArrayNA.o
|
---|
86 |
|
---|
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 |
|
---|
97 | TESTSRC := $(TESTDIR)/tConvert.cc
|
---|
98 | TESTOBJ := $(TESTDIR)/tConvert.o
|
---|
99 |
|
---|
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:
|
---|
111 | rm -f $(OBJECTS) $(TARGET)
|
---|
112 | rm -f $(TESTDIR)/$(TESTMOD) $(TESTDIR)/$(TESTOBJ)
|
---|
113 | rm -f $(INSTDIR)/$(TARGET)
|
---|
114 |
|
---|
115 | install:
|
---|
116 | cp -f $(TARGET) $(INSTDIR)
|
---|
117 |
|
---|
118 | test:
|
---|
119 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $(TESTOBJ) $(TESTSRC)
|
---|
120 | $(LD) $(LDFLAGS) -o $(TESTMOD) $(TESTOBJ) $(LIBS) -L$(EXTDIR) -lpyrap
|
---|