source: trunk/external/libpyrap/Makefile@ 1907

Last change on this file since 1907 was 1905, checked in by Takeshi Nakazato, 14 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: do make

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Support Mac OS X.
Link libpython2.5.


File size: 3.4 KB
Line 
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#####
10EXTDIR := $(shell pwd)
11PYRAPROOT := $(EXTDIR)/pyrap-0.3.2/
12PYRAPDIR := $(EXTDIR)/pyrap-0.3.2/pyrap/Converters
13TESTDIR := $(PYRAPDIR)/test
14
15# the casa environment AIPSPATH has to be defined
16CASAROOT := $(word 1, $(CASAPATH))
17CASAARCH := $(word 2, $(CASAPATH))
18
19ifeq ($(shell uname), Darwin)
20 TARGET := libpyrap.dylib
21 TESTMOD := $(TESTDIR)/_tConvert.so
22else
23 TARGET := libpyrap.so
24 TESTMOD := $(TESTDIR)/_tConvert.so
25endif
26INSTDIR := $(CASAROOT)/$(CASAARCH)/lib
27
28# CASACORE
29#COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
30COREINCD := $(CASAROOT)/$(CASAARCH)/include/casacore
31CORELIBD := $(CASAROOT)/$(CASAARCH)/lib
32CORELIB := -L$(CORELIBD) -lcasa_casa
33
34# boost
35BOOSTROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=BOOSTROOT eval_vars) && echo $$BOOSTROOT)
36BOOSTINCD := $(BOOSTROOT)/include
37BOOSTLIBD := $(BOOSTROOT)/lib
38BOOSTLIB := -L$(BOOSTLIBD) -lboost_python
39
40# python
41PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
42PYTHONINCD := $(PYTHONROOT)/include/python2.5
43PYTHONLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIBD eval_vars) && echo $$PYTHONLIBD)
44PYTHONLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIB eval_vars) && echo $$PYTHONLIB)
45
46# numpy (use numpy in CASA)
47NUMPYROOT := $(PYTHONLIBD)/python2.5/site-packages/numpy
48NUMPYINCD := $(NUMPYROOT)/core/include
49
50# the compiler
51ifndef CXX
52 CXX := g++
53endif
54
55# the linker
56LD := $(CXX)
57
58# compiler flags
59#CXXFLAGS := -fPIC -O3 -g
60#CXXFLAGS += -ansi -Wno-long-long -Wall
61CXXFLAGS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CXXFLAGS eval_vars) && echo $$CXXFLAGS)
62CXXFLAGS += -fPIC -O3
63CXXOPTS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COPTFLAGS eval_vars) && echo $$COPTFLAGS)
64CXXOPTS += -DAIPS_USENUMPY
65
66# links to external libraries
67LIBS := $(CORELIB) $(BOOSTLIB) $(PYTHONLIB)
68
69# include directories
70INCDIRS := -I$(COREINCD) -I$(BOOSTINCD) -I$(NUMPYINCD) \
71 -I$(PYRAPROOT) -I$(PYTHONINCD)
72
73# link option
74LDFLAGS := -shared
75
76OBJECTS := $(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
84HEADERS := $(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
94TESTSRC := $(TESTDIR)/tConvert.cc
95TESTOBJ := $(TESTDIR)/tConvert.o
96
97all: $(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
107clean:
108 rm -f $(OBJECTS) $(TARGET)
109 rm -f $(TESTDIR)/$(TESTMOD) $(TESTDIR)/$(TESTOBJ)
110 rm -f $(INSTDIR)/$(TARGET)
111
112install:
113 cp -f $(TARGET) $(INSTDIR)
114
115test:
116 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $(TESTOBJ) $(TESTSRC)
117 $(LD) $(LDFLAGS) -o $(TESTMOD) $(TESTOBJ) $(LIBS) -L$(EXTDIR) -lpyrap
Note: See TracBrowser for help on using the repository browser.