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
RevLine 
[1891]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)
[1892]11PYRAPROOT := $(EXTDIR)/pyrap-0.3.2/
[1891]12PYRAPDIR := $(EXTDIR)/pyrap-0.3.2/pyrap/Converters
[1895]13TESTDIR := $(PYRAPDIR)/test
[1891]14
15# the casa environment AIPSPATH has to be defined
16CASAROOT := $(word 1, $(CASAPATH))
17CASAARCH := $(word 2, $(CASAPATH))
18
[1905]19ifeq ($(shell uname), Darwin)
20 TARGET := libpyrap.dylib
21 TESTMOD := $(TESTDIR)/_tConvert.so
22else
23 TARGET := libpyrap.so
24 TESTMOD := $(TESTDIR)/_tConvert.so
25endif
[1892]26INSTDIR := $(CASAROOT)/$(CASAARCH)/lib
[1891]27
28# CASACORE
[1892]29#COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
[1891]30COREINCD := $(CASAROOT)/$(CASAARCH)/include/casacore
31CORELIBD := $(CASAROOT)/$(CASAARCH)/lib
[1892]32CORELIB := -L$(CORELIBD) -lcasa_casa
[1891]33
[1892]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
[1891]39
[1892]40# python
41PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
42PYTHONINCD := $(PYTHONROOT)/include/python2.5
[1905]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)
[1891]45
[1899]46# numpy (use numpy in CASA)
47NUMPYROOT := $(PYTHONLIBD)/python2.5/site-packages/numpy
48NUMPYINCD := $(NUMPYROOT)/core/include
49
[1892]50# the compiler
51ifndef CXX
52 CXX := g++
53endif
[1891]54
[1892]55# the linker
56LD := $(CXX)
57
58# compiler flags
[1905]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
[1892]65
66# links to external libraries
[1905]67LIBS := $(CORELIB) $(BOOSTLIB) $(PYTHONLIB)
[1892]68
69# include directories
70INCDIRS := -I$(COREINCD) -I$(BOOSTINCD) -I$(NUMPYINCD) \
71 -I$(PYRAPROOT) -I$(PYTHONINCD)
72
73# link option
74LDFLAGS := -shared
75
[1891]76OBJECTS := $(PYRAPDIR)/PycArray.o \
77 $(PYRAPDIR)/PycArrayNP.o \
78 $(PYRAPDIR)/PycBasicData.o \
[1892]79 $(PYRAPDIR)/PycExcp.o \
[1891]80 $(PYRAPDIR)/PycRecord.o \
81 $(PYRAPDIR)/PycValueHolder.o #\
82# $(PYRAPDIR)/PycArrayNA.o
83
[1892]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
[1895]94TESTSRC := $(TESTDIR)/tConvert.cc
95TESTOBJ := $(TESTDIR)/tConvert.o
96
[1892]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:
[1899]108 rm -f $(OBJECTS) $(TARGET)
109 rm -f $(TESTDIR)/$(TESTMOD) $(TESTDIR)/$(TESTOBJ)
110 rm -f $(INSTDIR)/$(TARGET)
[1892]111
112install:
[1895]113 cp -f $(TARGET) $(INSTDIR)
114
115test:
116 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $(TESTOBJ) $(TESTSRC)
[1905]117 $(LD) $(LDFLAGS) -o $(TESTMOD) $(TESTOBJ) $(LIBS) -L$(EXTDIR) -lpyrap
Note: See TracBrowser for help on using the repository browser.