summaryrefslogtreecommitdiff
path: root/GNUmakefile.in
blob: 1f38136db2d65f66b7c357c04dbb5813f5c2dcd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
## -*- makefile -*-

ifneq (,)
This makefile requires GNU Make.
endif

VPATH := @srcdir@

PACKAGE := @PACKAGE@
VERSION := @VERSION@

STATIC_EXAMPLES := pyhello.py testtk.py
EXAMPLES        := $(addprefix docs/examples/, env.sh)
DOCS            := $(addprefix docs/html/, index.html ivycpy_wrap.html)

DEFINES   := @DEFINES@
INCLUDES  := @INCLUDES@
LIBRARIES := @LIBRARIES@

prefix      := @prefix@
exec_prefix := @exec_prefix@
datadir     := @datadir@
includedir  := @includedir@
libdir      := @libdir@
bindir      := @bindir@
mandir      := @mandir@
infodir     := @infodir@
pyexecdir   := @pyexecdir@
pythondir   := @pythondir@

PKGEXAMPLESDIR := $(datadir)/$(PACKAGE)-$(VERSION)/examples
PKGDOCDIR      := $(datadir)/$(PACKAGE)-$(VERSION)/docs

MKDIR := mkdir -p
RMDIR := rmdir -p

LN_S := @LN_S@ -f

ARFLAGS := r

RANLIB := @RANLIB@

INSTALL         := @INSTALL@
INSTALL_PROGRAM := @INSTALL_PROGRAM@
INSTALL_SCRIPT  := @INSTALL_SCRIPT@
INSTALL_DATA    := @INSTALL_DATA@

UMASK ?= 022

INSTALL_DIR := $(SHELL) $(top_srcdir)/mkinstalldirs
INSTALL_DIR := $(INSTALL) -d
INSTALL_DIR := umask $(UMASK) && mkdirhier
INSTALL_DIR := umask $(UMASK) && $(MKDIR)

SWIG := @SWIG@

CC := gcc

CC_WARNING_OPTIONS := -Wall
CC_PIC_OPTIONS     := -fPIC
CC_SHARED_OPTIONS  := -shared

CC_OPTIONS := $(CC_WARNING_OPTIONS)

ifdef DEBUG
CC_OPTIONS += -g
DEFINES    += -D__DEBUG__
else
DEFINES    += -DNDEBUG
endif

CPPFLAGS = $(DEFINES) $(INCLUDES) @DEFS@ @CPPFLAGS@
CFLAGS   = @CFLAGS@  $(CC_OPTIONS)
LDFLAGS  = @LDFLAGS@ $(LD_OPTIONS)
LDLIBS   = $(LIBRARIES) @LIBS@

default: ivycpy.so $(DOCS) $(EXAMPLES)

ivycpy.so: ivycpy_wrap_neat.o @PYTHON_LIBDIR@/python@PYTHON_VERSION@/lib-dynload/_tkinter.so
	$(LINK.o) $(CC_SHARED_OPTIONS) $^ -o $@ -livy $(LDLIBS) -lc

ivycpy_wrap_neat.o: CFLAGS += $(CC_PIC_OPTIONS)
ivycpy_wrap_neat.o: ivycpy_wrap_neat.c

# true or neat wrapper with proper name for function
ivycpy_wrap_neat.c: ivycpy_wrap.c
	>$@ sed -f ivycpy_namer.sed $<

# wrapper code generated by swig
ivycpy_wrap.c: ivycpy.i
	$(SWIG) -python -dhtml $<

# testing include and defines

ivycpy_test.e:	ivycpy_test.c
		>|$@ $(CC) -E $(CPPFLAGS) $< 

# documentation

docs/html/ivycpy_wrap.html: ivycpy_wrap.html
	>|$@ sed -e "s/<B>pyIvy/<B>Ivy/g" $< 

docs/html/index.html: docs/html/index_tpl.html
	>|$@ sed -e "s/_VERSION_/$(VERSION)/g" $< 

VERSION:
	printf '# generated dynamically do not edit; change VERSION in configure.in instead\n' >|$@ 
	printf '$$Id$$\n' $(VERSION) >|$@ 

# misc 
docs/examples/env.sh: env_tpl.sh
	>|$@ sed -e "s|_IVYCPYPATH_|$(pythondir)|g" $<

install:: ivycpy.so
	$(INSTALL_DIR) $(pythondir)
	$(INSTALL_DATA) $< $(pythondir)

install:: $(DOCS)
	$(INSTALL_DIR) $(PKGDOCDIR)
	cp -rp docs/* $(PKGDOCDIR)

.PHONY: default install VERSION

clean:
	$(RM) core a.out *.o
	$(RM) ivycpy.so

realclean: clean
	$(RM) ivycpy_wrap*.c
	$(RM) $(EXAMPLES)

distclean: realclean
	$(RM) ivycpy_wrap*.*
	$(RM) GNUmakefile config.log config.status config.cache

.PHONY: clean realclean distclean

GNUmakefile:: GNUmakefile.in
	CONFIG_FILES=GNUmakefile ./config.status

GNUmakefile:: ./config.status
	./config.status

config.status: @top_srcdir@/configure
	./config.status --recheck

@top_srcdir@/configure: @top_srcdir@/configure.in
	cd @top_srcdir@ && autoconf

recheck:
	./config.status --recheck && ./config.status

.PHONY: recheck

## [END OF FILE]