/[ascend]/trunk/models/johnpye/extfn/Makefile
ViewVC logotype

Contents of /trunk/models/johnpye/extfn/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 382 - (show annotations) (download)
Sun Mar 19 23:39:23 2006 UTC (17 years, 8 months ago) by johnpye
File size: 1604 byte(s)
Fixing python path for Linux
1 # Makefile for add-ins in the current directory; for each .c file you will get a separate .so file.
2
3 PACKAGES = extfntest
4
5 ASCEND_BASE_REL = ../../..
6
7 ASCEND_BASE = $(shell cd $(ASCEND_BASE_REL) && pwd)
8
9 ASCEND_INCDIR = $(ASCEND_BASE)/base/generic
10
11 LIBS = $(PACKAGES:%=$(SO_PREF)%$(SO_SUF))
12
13 ifeq ($(OSTYPE),msys)
14 PYTHON_VERSION := 24
15 PYTHON_ROOT := /c/Python$(PYTHON_VERSION)
16 PYTHON_CPPFLAGS := -I$(PYTHON_ROOT)/include
17 PYTHON_LDFLAGS := -L$(PYTHON_ROOT)/libs -lpython$(PYTHON_VERSION)
18 PYTHON := $(PYTHON_ROOT)/python
19 SO_SUF = .dll
20 SO_PREF =
21 else
22 ifeq ($(TERM),cygwin)
23 PYTHON_VERSION := 24
24 PYTHON_ROOT := /cygdrive/c/Python$(PYTHON_VERSION)
25 PYTHON_CPPFLAGS := -I$(PYTHON_ROOT)/include
26 PYTHON_LDFLAGS := -L$(PYTHON_ROOT)/libs -lpython24
27 PYTHON := $(PYTHON_ROOT)/python
28 SO_SUF = .dll
29 SO_PREF =
30 else
31 PYTHON_VERSION := $(shell python -V 2>&1 | sed s/Python\ // | sed s/^\\\([0-9][0-9]*\\.[0-9][0-9]*\\\).*/\\1/ )
32 PYTHON_CPPFLAGS := -I/usr/include/python$(PYTHON_VERSION)
33 PYTHON_LDFLAGS := -lpython$(PYTHON_VERSION)
34 PYTHON := python
35 SO_SUF = .so
36 SO_PREF = lib
37 endif
38 endif
39
40 all: ascend makelibs test
41
42 makelibs: $(LIBS)
43 @echo "Compiled libraries $(LIBS)"
44
45 test: $(LIBS)
46 PYTHONPATH=$(ASCEND_BASE)/pygtk/interface/ $(PYTHON) extfntest.py
47
48 ascend:
49 make -j2 -C $(ASCEND_BASE)/pygtk/interface/
50
51 CC = gcc
52
53 LD = libtool --mode=link $(CC) -module -shared
54
55 LDFLAGS = -lm -Wl,-no-undefined
56
57 CPPFLAGS = -I$(ASCEND_INCDIR)
58 CFLAGS = -O -c
59
60 $(SO_PREF)%$(SO_SUF): %.o
61 $(LD) -o $@ $^ $(LDFLAGS)
62
63 %.lo: %.c
64 libtool --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) $^
65
66 clean:
67 -rm *.o *.so

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22