source: trunk/external/libpyrap/Makefile@ 1897

Last change on this file since 1897 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
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))
18ifeq "$(CASAARCH)" "darwin"
19 CASADIST := /opt/casa
20else
21 CASADIST := /usr/lib/casapy
22endif
23
24TARGET := libpyrap.so
25TESTMOD := $(TESTDIR)/_tConvert.so
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# numpy (use numpy in CASA)
41NUMPYROOT := $(CASADIST)/lib/python2.5/site-packages/numpy
42NUMPYINCD := $(NUMPYROOT)/core/include
43NUMPYLIBD := $(NUMPYROOT)/core/
44NUMPYLIB := #-L$(NUMPYLIBD) -lmultiarray
45
46# python
47PYTHONROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONROOT eval_vars) && echo $$PYTHONROOT)
48PYTHONINCD := $(PYTHONROOT)/include/python2.5
49
50# the compiler
51ifndef CXX
52 CXX := g++
53endif
54
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
73OBJECTS := $(PYRAPDIR)/PycArray.o \
74 $(PYRAPDIR)/PycArrayNP.o \
75 $(PYRAPDIR)/PycBasicData.o \
76 $(PYRAPDIR)/PycExcp.o \
77 $(PYRAPDIR)/PycRecord.o \
78 $(PYRAPDIR)/PycValueHolder.o #\
79# $(PYRAPDIR)/PycArrayNA.o
80
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
91TESTSRC := $(TESTDIR)/tConvert.cc
92TESTOBJ := $(TESTDIR)/tConvert.o
93
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:
105 rm -rf $(OBJECTS) $(TARGET)
106 rm -rf $(TESTDIR)/$(TESTMOD) $(TESTDIR)/$(TESTOBJ)
107
108install:
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.