source: trunk/external/libpyrap/Makefile@ 1895

Last change on this file since 1895 was 1895, 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: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Added 'test' target to create library for testing.


File size: 3.0 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))
18ifeq "$(CASAARCH)" "darwin"
[1892]19 CASADIST := /opt/casa
20else
[1891]21 CASADIST := /usr/lib/casapy
22endif
23
[1892]24TARGET := libpyrap.so
[1895]25TESTMOD := $(TESTDIR)/_tConvert.so
[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# numpy (use numpy in CASA)
[1891]41NUMPYROOT := $(CASADIST)/lib/python2.5/site-packages/numpy
42NUMPYINCD := $(NUMPYROOT)/core/include
43NUMPYLIBD := $(NUMPYROOT)/core/
[1892]44NUMPYLIB := #-L$(NUMPYLIBD) -lmultiarray
[1891]45
[1892]46# python
47PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
48PYTHONINCD := $(PYTHONROOT)/include/python2.5
[1891]49
[1892]50# the compiler
51ifndef CXX
52 CXX := g++
53endif
[1891]54
[1892]55# the linker
56LD := $(CXX)
57
58# compiler flags
59CXXFLAGS := -fPIC -O3 -g
60CXXFLAGS += -ansi -Wno-long-long -Wall
61CXXOPTS := -DAIPS_64B -DAIPS_USENUMPY
62
63# links to external libraries
64LIBS := $(CORELIB) $(BOOSTLIB) $(NUMPYLIB)
65
66# include directories
67INCDIRS := -I$(COREINCD) -I$(BOOSTINCD) -I$(NUMPYINCD) \
68 -I$(PYRAPROOT) -I$(PYTHONINCD)
69
70# link option
71LDFLAGS := -shared
72
[1891]73OBJECTS := $(PYRAPDIR)/PycArray.o \
74 $(PYRAPDIR)/PycArrayNP.o \
75 $(PYRAPDIR)/PycBasicData.o \
[1892]76 $(PYRAPDIR)/PycExcp.o \
[1891]77 $(PYRAPDIR)/PycRecord.o \
78 $(PYRAPDIR)/PycValueHolder.o #\
79# $(PYRAPDIR)/PycArrayNA.o
80
[1892]81HEADERS := $(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
[1895]91TESTSRC := $(TESTDIR)/tConvert.cc
92TESTOBJ := $(TESTDIR)/tConvert.o
93
[1892]94all: $(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
104clean:
[1895]105 rm -rf $(OBJECTS) $(TARGET)
106 rm -rf $(TESTDIR)/$(TESTMOD) $(TESTDIR)/$(TESTOBJ)
[1892]107
108install:
[1895]109 cp -f $(TARGET) $(INSTDIR)
110
111test:
112 $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $(TESTOBJ) $(TESTSRC)
113 $(LD) $(LDFLAGS) -o $(TESTMOD) $(TESTOBJ) $(LIBS) -L$(INSTDIR) -lpyrap
Note: See TracBrowser for help on using the repository browser.