texplay 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +63 -0
- data/README +21 -0
- data/README1st +9 -0
- data/Rakefile +85 -0
- data/examples/basic.rb +48 -0
- data/examples/basic2.rb +37 -0
- data/examples/benchmark.rb +299 -0
- data/examples/common.rb +8 -0
- data/examples/example_alpha_blend.rb +31 -0
- data/examples/example_bezier.rb +51 -0
- data/examples/example_color_control.rb +68 -0
- data/examples/example_color_transform.rb +29 -0
- data/examples/example_dup.rb +52 -0
- data/examples/example_each.rb +42 -0
- data/examples/example_effect.rb +35 -0
- data/examples/example_fill.rb +49 -0
- data/examples/example_fill_old.rb +49 -0
- data/examples/example_fluent.rb +31 -0
- data/examples/example_gen_eval.rb +34 -0
- data/examples/example_hash_arguments.rb +47 -0
- data/examples/example_melt.rb +27 -0
- data/examples/example_polyline.rb +43 -0
- data/examples/example_simple.rb +35 -0
- data/examples/example_splice.rb +37 -0
- data/examples/example_sync.rb +60 -0
- data/examples/example_turtle.rb +40 -0
- data/examples/media/empty2.png +0 -0
- data/examples/media/gosu.png +0 -0
- data/examples/media/maria.png +0 -0
- data/examples/media/rose.bmp +0 -0
- data/examples/media/sand1.png +0 -0
- data/examples/media/sunset.png +0 -0
- data/examples/media/texplay.png +0 -0
- data/examples/specs.rb +240 -0
- data/examples/test.rb +70 -0
- data/examples/test2.rb +72 -0
- data/lib/texplay-contrib.rb +77 -0
- data/lib/texplay.rb +134 -0
- data/src/Makefile +181 -0
- data/src/TAGS +286 -0
- data/src/actions.c +1306 -0
- data/src/actions.h +52 -0
- data/src/actions.o +0 -0
- data/src/bindings.c +1081 -0
- data/src/bindings.h +45 -0
- data/src/bindings.o +0 -0
- data/src/cache.c +132 -0
- data/src/cache.h +24 -0
- data/src/cache.o +0 -0
- data/src/compat.h +23 -0
- data/src/ctexplay.so +0 -0
- data/src/extconf.rb +18 -0
- data/src/gen_eval.c +209 -0
- data/src/gen_eval.h +20 -0
- data/src/gen_eval.o +0 -0
- data/src/mkmf.log +22 -0
- data/src/object2module.c +171 -0
- data/src/object2module.h +11 -0
- data/src/object2module.o +0 -0
- data/src/texplay.c +136 -0
- data/src/texplay.h +107 -0
- data/src/texplay.o +0 -0
- data/src/utils.c +959 -0
- data/src/utils.h +143 -0
- data/src/utils.o +0 -0
- metadata +126 -0
data/examples/test.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'common'
|
2
|
+
require 'gosu'
|
3
|
+
require 'texplay'
|
4
|
+
|
5
|
+
class MyWindow < Gosu::Window
|
6
|
+
def initialize
|
7
|
+
super(1024, 768, false, 20)
|
8
|
+
|
9
|
+
# image for texture filling
|
10
|
+
@gosu = Gosu::Image.new(self,"#{Common::MEDIA}/gosu.png")
|
11
|
+
|
12
|
+
# images for testing
|
13
|
+
@unchanged = Gosu::Image.new(self,"#{Common::MEDIA}/texplay.png")
|
14
|
+
@simple = Gosu::Image.new(self,"#{Common::MEDIA}/texplay.png")
|
15
|
+
@polyline = Gosu::Image.new(self,"#{Common::MEDIA}/texplay.png")
|
16
|
+
@bezier = Gosu::Image.new(self,"#{Common::MEDIA}/texplay.png")
|
17
|
+
@flood_fill = Gosu::Image.new(self,"#{Common::MEDIA}/texplay.png")
|
18
|
+
|
19
|
+
# height and width
|
20
|
+
@width = @simple.width
|
21
|
+
@height = @simple.height
|
22
|
+
|
23
|
+
# initializations
|
24
|
+
setup_simple
|
25
|
+
setup_polyline
|
26
|
+
setup_bezier
|
27
|
+
setup_flood_fill
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
def setup_simple
|
32
|
+
@simple.line 0, 0, 1024, 1024
|
33
|
+
@simple.rect 0,0, @width - 1, @height - 1
|
34
|
+
@simple.circle @simple.width/2, @simple.height/2, 30
|
35
|
+
end
|
36
|
+
|
37
|
+
def setup_polyline
|
38
|
+
@polyline.polyline [0, 0, @width / 2, @height - 1, @width - 1, 0]
|
39
|
+
end
|
40
|
+
|
41
|
+
def setup_bezier
|
42
|
+
points = []
|
43
|
+
10.times {
|
44
|
+
point = []
|
45
|
+
point[0] = @width * rand
|
46
|
+
point[1] = @height * rand
|
47
|
+
|
48
|
+
points += point
|
49
|
+
}
|
50
|
+
@bezier.bezier points
|
51
|
+
end
|
52
|
+
|
53
|
+
def setup_flood_fill
|
54
|
+
@flood_fill.fill 100, 96, :color => :random, :scan => true
|
55
|
+
end
|
56
|
+
|
57
|
+
def draw
|
58
|
+
|
59
|
+
@simple.draw(20, 10, 1)
|
60
|
+
@polyline.draw(20, 210, 1)
|
61
|
+
@bezier.draw(20, 410, 1)
|
62
|
+
@flood_fill.draw(400, 10, 1)
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
w = MyWindow.new
|
68
|
+
w.show
|
69
|
+
|
70
|
+
|
data/examples/test2.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'common'
|
2
|
+
require 'gosu'
|
3
|
+
require 'texplay'
|
4
|
+
|
5
|
+
class MyWindow < Gosu::Window
|
6
|
+
def initialize
|
7
|
+
super(1024, 768, false, 20)
|
8
|
+
|
9
|
+
# image for texture filling
|
10
|
+
@gosu = Gosu::Image.new(self,"#{Common::MEDIA}/gosu.png")
|
11
|
+
|
12
|
+
# images for testing
|
13
|
+
@unchanged = Gosu::Image.new(self,"#{Common::MEDIA}/texplay.png")
|
14
|
+
@simple = Gosu::Image.new(self,"#{Common::MEDIA}/texplay.png")
|
15
|
+
@polyline = Gosu::Image.new(self,"#{Common::MEDIA}/texplay.png")
|
16
|
+
@bezier = Gosu::Image.new(self,"#{Common::MEDIA}/texplay.png")
|
17
|
+
@flood_fill = Gosu::Image.new(self,"#{Common::MEDIA}/texplay.png")
|
18
|
+
|
19
|
+
# height and width
|
20
|
+
@width = @simple.width
|
21
|
+
@height = @simple.height
|
22
|
+
|
23
|
+
# initializations
|
24
|
+
setup_simple
|
25
|
+
setup_polyline
|
26
|
+
setup_bezier
|
27
|
+
setup_flood_fill
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
def setup_simple
|
32
|
+
@simple.line 0, 0, 1024, 1024
|
33
|
+
@simple.rect 0,0, @width - 1, @height - 1
|
34
|
+
@simple.circle @simple.width/2, @simple.height/2, 30
|
35
|
+
end
|
36
|
+
|
37
|
+
def setup_polyline
|
38
|
+
@polyline.polyline [0, 0, @width / 2, @height - 1, @width - 1, 0]
|
39
|
+
end
|
40
|
+
|
41
|
+
def setup_bezier
|
42
|
+
points = []
|
43
|
+
10.times {
|
44
|
+
point = []
|
45
|
+
point[0] = @width * rand
|
46
|
+
point[1] = @height * rand
|
47
|
+
|
48
|
+
points += point
|
49
|
+
}
|
50
|
+
@bezier.bezier points
|
51
|
+
end
|
52
|
+
|
53
|
+
def setup_flood_fill
|
54
|
+
@flood_fill.fill 100, 96, :color => :random
|
55
|
+
end
|
56
|
+
|
57
|
+
def draw
|
58
|
+
|
59
|
+
@simple.draw(20, 10, 1)
|
60
|
+
@polyline.draw(20, 210, 1)
|
61
|
+
@bezier.draw(20, 410, 1)
|
62
|
+
@flood_fill.draw(400, 10, 1)
|
63
|
+
|
64
|
+
@polyline.paint
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
w = MyWindow.new
|
70
|
+
w.show
|
71
|
+
|
72
|
+
|
@@ -0,0 +1,77 @@
|
|
1
|
+
begin
|
2
|
+
require 'rubygems'
|
3
|
+
rescue LoadError
|
4
|
+
end
|
5
|
+
|
6
|
+
require 'texplay'
|
7
|
+
|
8
|
+
# setup will be executed straight after Gosu::Image instantiation
|
9
|
+
TexPlay.on_setup do
|
10
|
+
@turtle_pos = TexPlay::TPPoint.new(width / 2, height / 2 )
|
11
|
+
@turtle_angle = 0
|
12
|
+
end
|
13
|
+
|
14
|
+
TexPlay.create_macro(:move_to) do |x, y|
|
15
|
+
capture {
|
16
|
+
@turtle_pos.x = x
|
17
|
+
@turtle_pos.y = y
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
TexPlay.create_macro(:move_rel) do |dx, dy|
|
22
|
+
capture {
|
23
|
+
@turtle_pos.x += dx
|
24
|
+
@turtle_pos.y += dy
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
TexPlay.create_macro(:line_to) do |x, y, *other|
|
29
|
+
capture {
|
30
|
+
line(@turtle_pos.x, @turtle_pos.y, x, y, *other)
|
31
|
+
|
32
|
+
@turtle_pos.x, @turtle_pos.y = x, y
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
TexPlay.create_macro(:line_rel) do |dx, dy, *other|
|
37
|
+
capture {
|
38
|
+
x = @turtle_pos.x + dx
|
39
|
+
y = @turtle_pos.y + dy
|
40
|
+
|
41
|
+
line(@turtle_pos.x, @turtle_pos.y, x, y, *other)
|
42
|
+
|
43
|
+
@turtle_pos.x, @turtle_pos.y = x, y
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
TexPlay.create_macro(:turn_to) do |a|
|
48
|
+
capture {
|
49
|
+
@turtle_angle = a
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
TexPlay.create_macro(:turn) do |da|
|
54
|
+
capture {
|
55
|
+
@turtle_angle += da
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
TexPlay.create_macro(:forward) do |dist, *other|
|
60
|
+
capture {
|
61
|
+
visible = other.shift
|
62
|
+
|
63
|
+
radians_per_degree = 0.0174532925199433
|
64
|
+
|
65
|
+
x = @turtle_pos.x + dist * Math::cos(radians_per_degree * @turtle_angle)
|
66
|
+
y = @turtle_pos.y + dist * Math::sin(radians_per_degree * @turtle_angle)
|
67
|
+
|
68
|
+
if(visible) then
|
69
|
+
line_to(x, y, *other)
|
70
|
+
else
|
71
|
+
move_to(x, y)
|
72
|
+
end
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
|
data/lib/texplay.rb
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
# (C) John Mair 2009, under the MIT licence
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rubygems'
|
5
|
+
rescue LoadError
|
6
|
+
end
|
7
|
+
|
8
|
+
# include gosu first
|
9
|
+
require 'rbconfig'
|
10
|
+
require 'gosu'
|
11
|
+
|
12
|
+
module TexPlay
|
13
|
+
TEXPLAY_VERSION = "0.2.0"
|
14
|
+
|
15
|
+
def self.on_setup(&block)
|
16
|
+
raise "need a block" if !block
|
17
|
+
|
18
|
+
@__init_procs__ ||= []
|
19
|
+
@__init_procs__.push(block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.setup(receiver)
|
23
|
+
if @__init_procs__ then
|
24
|
+
@__init_procs__.each do |init_proc|
|
25
|
+
receiver.instance_eval(&init_proc)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.create_blank_image(window, width, height)
|
31
|
+
Gosu::Image.new(window, EmptyImageStub.new(width, height))
|
32
|
+
end
|
33
|
+
|
34
|
+
module Colors
|
35
|
+
Red = [1, 0, 0, 1]
|
36
|
+
Green = [0, 1, 0, 1]
|
37
|
+
Blue = [0, 0, 1, 1]
|
38
|
+
Black = [0, 0, 0, 1]
|
39
|
+
White = [1, 1, 1, 1]
|
40
|
+
Grey = [0.5, 0.5, 0.5, 0.5]
|
41
|
+
Alpha = [0, 0, 0, 0]
|
42
|
+
Purple = [1, 0, 1, 1]
|
43
|
+
Yellow = [1, 1, 0, 1]
|
44
|
+
Cyan = [0, 1, 1, 1]
|
45
|
+
Orange = [1, 0.5, 0, 1]
|
46
|
+
Brown = [0.39, 0.26, 0.13, 1]
|
47
|
+
Turquoise = [1, 0.6, 0.8, 1]
|
48
|
+
Tyrian = [0.4, 0.007, 0.235, 1]
|
49
|
+
end
|
50
|
+
include Colors
|
51
|
+
end
|
52
|
+
|
53
|
+
# credit to philomory for this class
|
54
|
+
class EmptyImageStub
|
55
|
+
def initialize(w,h)
|
56
|
+
@w, @h = w, h;
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_blob
|
60
|
+
"\0" * @w * @h * 4
|
61
|
+
end
|
62
|
+
|
63
|
+
def rows
|
64
|
+
@h
|
65
|
+
end
|
66
|
+
|
67
|
+
def columns
|
68
|
+
@w
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# bring in user-defined extensions to TexPlay
|
73
|
+
direc = File.dirname(__FILE__)
|
74
|
+
dlext = Config::CONFIG['DLEXT']
|
75
|
+
begin
|
76
|
+
if RUBY_VERSION && RUBY_VERSION =~ /1.9/
|
77
|
+
require "#{direc}/ctexplay19.#{dlext}"
|
78
|
+
else
|
79
|
+
require "#{direc}/ctexplay18.#{dlext}"
|
80
|
+
end
|
81
|
+
rescue LoadError => e
|
82
|
+
require "#{direc}/ctexplay.#{dlext}"
|
83
|
+
end
|
84
|
+
|
85
|
+
require "#{direc}/texplay-contrib"
|
86
|
+
|
87
|
+
# monkey patching the Gosu::Image class to add image manipulation functionality
|
88
|
+
module Gosu
|
89
|
+
class Image
|
90
|
+
|
91
|
+
# bring in the TexPlay image manipulation methods
|
92
|
+
include TexPlay
|
93
|
+
|
94
|
+
class << self
|
95
|
+
alias_method :original_new, :new
|
96
|
+
|
97
|
+
def new(*args, &block)
|
98
|
+
|
99
|
+
# invoke old behaviour
|
100
|
+
obj = original_new(*args, &block)
|
101
|
+
|
102
|
+
# refresh the TexPlay image cache
|
103
|
+
if obj.width <= (TexPlay::TP_MAX_QUAD_SIZE - 2) &&
|
104
|
+
obj.height <= (TexPlay::TP_MAX_QUAD_SIZE - 2) && obj.quad_cached? then
|
105
|
+
|
106
|
+
obj.refresh_cache
|
107
|
+
end
|
108
|
+
|
109
|
+
# run custom setup
|
110
|
+
TexPlay::setup(obj)
|
111
|
+
|
112
|
+
obj.instance_variable_set(:@__window__, args.first)
|
113
|
+
|
114
|
+
# return the new image
|
115
|
+
obj
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def __window__
|
120
|
+
@__window__
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# a bug in ruby 1.8.6 rb_eval_string() means i must define this here (rather than in texplay.c)
|
126
|
+
class Proc
|
127
|
+
def __context__
|
128
|
+
eval('self', self.binding)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
data/src/Makefile
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
#### Start of system configuration section. ####
|
5
|
+
|
6
|
+
srcdir = .
|
7
|
+
topdir = /usr/local/include/ruby19-1.9.1
|
8
|
+
hdrdir = /usr/local/include/ruby19-1.9.1
|
9
|
+
arch_hdrdir = /usr/local/include/ruby19-1.9.1/$(arch)
|
10
|
+
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
11
|
+
prefix = $(DESTDIR)/usr/local
|
12
|
+
exec_prefix = $(prefix)
|
13
|
+
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
14
|
+
sitehdrdir = $(rubyhdrdir)/site_ruby
|
15
|
+
rubyhdrdir = $(includedir)/$(RUBY_INSTALL_NAME)-$(ruby_version)
|
16
|
+
vendordir = $(libdir)/$(RUBY_INSTALL_NAME)/vendor_ruby
|
17
|
+
sitedir = $(libdir)/$(RUBY_INSTALL_NAME)/site_ruby
|
18
|
+
mandir = $(datarootdir)/man
|
19
|
+
localedir = $(datarootdir)/locale
|
20
|
+
libdir = $(exec_prefix)/lib
|
21
|
+
psdir = $(docdir)
|
22
|
+
pdfdir = $(docdir)
|
23
|
+
dvidir = $(docdir)
|
24
|
+
htmldir = $(docdir)
|
25
|
+
infodir = $(datarootdir)/info
|
26
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
27
|
+
oldincludedir = $(DESTDIR)/usr/include
|
28
|
+
includedir = $(prefix)/include
|
29
|
+
localstatedir = $(prefix)/var
|
30
|
+
sharedstatedir = $(prefix)/com
|
31
|
+
sysconfdir = $(prefix)/etc
|
32
|
+
datadir = $(datarootdir)
|
33
|
+
datarootdir = $(prefix)/share
|
34
|
+
libexecdir = $(exec_prefix)/libexec
|
35
|
+
sbindir = $(exec_prefix)/sbin
|
36
|
+
bindir = $(exec_prefix)/bin
|
37
|
+
rubylibdir = $(libdir)/$(ruby_install_name)/$(ruby_version)
|
38
|
+
archdir = $(rubylibdir)/$(arch)
|
39
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
40
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
41
|
+
vendorlibdir = $(vendordir)/$(ruby_version)
|
42
|
+
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
43
|
+
|
44
|
+
CC = gcc
|
45
|
+
CXX = g++
|
46
|
+
LIBRUBY = $(LIBRUBY_A)
|
47
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
48
|
+
LIBRUBYARG_SHARED = -Wl,-R -Wl,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)
|
49
|
+
LIBRUBYARG_STATIC = -Wl,-R -Wl,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static
|
50
|
+
OUTFLAG = -o
|
51
|
+
COUTFLAG = -o
|
52
|
+
|
53
|
+
RUBY_EXTCONF_H =
|
54
|
+
cflags = $(optflags) $(debugflags) $(warnflags)
|
55
|
+
optflags = -O2
|
56
|
+
debugflags = -g
|
57
|
+
warnflags = -Wall -Wno-parentheses
|
58
|
+
CFLAGS = -fPIC $(cflags)
|
59
|
+
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
60
|
+
DEFS = -D_FILE_OFFSET_BITS=64
|
61
|
+
CPPFLAGS = $(DEFS) $(cppflags)
|
62
|
+
CXXFLAGS = $(CFLAGS) $(cxxflags)
|
63
|
+
ldflags = -L. -rdynamic -Wl,-export-dynamic
|
64
|
+
dldflags =
|
65
|
+
archflag =
|
66
|
+
DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
|
67
|
+
LDSHARED = $(CC) -shared
|
68
|
+
LDSHAREDXX = $(CXX) -shared
|
69
|
+
AR = ar
|
70
|
+
EXEEXT =
|
71
|
+
|
72
|
+
RUBY_INSTALL_NAME = ruby19
|
73
|
+
RUBY_SO_NAME = ruby19
|
74
|
+
arch = i686-linux
|
75
|
+
sitearch = i686-linux
|
76
|
+
ruby_version = 1.9.1
|
77
|
+
ruby = /usr/local/bin/ruby19
|
78
|
+
RUBY = $(ruby)
|
79
|
+
RM = rm -f
|
80
|
+
RM_RF = $(RUBY) -run -e rm -- -rf
|
81
|
+
RMDIRS = $(RUBY) -run -e rmdir -- -p
|
82
|
+
MAKEDIRS = mkdir -p
|
83
|
+
INSTALL = /usr/bin/install -c
|
84
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
85
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
86
|
+
COPY = cp
|
87
|
+
|
88
|
+
#### End of system configuration section. ####
|
89
|
+
|
90
|
+
preload =
|
91
|
+
|
92
|
+
libpath = . $(libdir)
|
93
|
+
LIBPATH = -L. -L$(libdir) -Wl,-R$(libdir)
|
94
|
+
DEFFILE =
|
95
|
+
|
96
|
+
CLEANFILES = mkmf.log
|
97
|
+
DISTCLEANFILES =
|
98
|
+
DISTCLEANDIRS =
|
99
|
+
|
100
|
+
extout =
|
101
|
+
extout_prefix =
|
102
|
+
target_prefix =
|
103
|
+
LOCAL_LIBS =
|
104
|
+
LIBS = -lglut -lpthread -lrt -ldl -lcrypt -lm -lc
|
105
|
+
SRCS = texplay.c actions.c object2module.c utils.c bindings.c gen_eval.c cache.c
|
106
|
+
OBJS = texplay.o actions.o object2module.o utils.o bindings.o gen_eval.o cache.o
|
107
|
+
TARGET = ctexplay
|
108
|
+
DLLIB = $(TARGET).so
|
109
|
+
EXTSTATIC =
|
110
|
+
STATIC_LIB =
|
111
|
+
|
112
|
+
BINDIR = $(bindir)
|
113
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
114
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
115
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
116
|
+
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
117
|
+
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
118
|
+
|
119
|
+
TARGET_SO = $(DLLIB)
|
120
|
+
CLEANLIBS = $(TARGET).so
|
121
|
+
CLEANOBJS = *.o *.bak
|
122
|
+
|
123
|
+
all: $(DLLIB)
|
124
|
+
static: $(STATIC_LIB)
|
125
|
+
|
126
|
+
clean-rb-default::
|
127
|
+
clean-rb::
|
128
|
+
clean-so::
|
129
|
+
clean: clean-so clean-rb-default clean-rb
|
130
|
+
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
131
|
+
|
132
|
+
distclean-rb-default::
|
133
|
+
distclean-rb::
|
134
|
+
distclean-so::
|
135
|
+
distclean: clean distclean-so distclean-rb-default distclean-rb
|
136
|
+
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
137
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
138
|
+
@-$(RMDIRS) $(DISTCLEANDIRS)
|
139
|
+
|
140
|
+
realclean: distclean
|
141
|
+
install: install-so install-rb
|
142
|
+
|
143
|
+
install-so: $(RUBYARCHDIR)
|
144
|
+
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
145
|
+
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
146
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
147
|
+
install-rb: pre-install-rb install-rb-default
|
148
|
+
install-rb-default: pre-install-rb-default
|
149
|
+
pre-install-rb: Makefile
|
150
|
+
pre-install-rb-default: Makefile
|
151
|
+
$(RUBYARCHDIR):
|
152
|
+
$(MAKEDIRS) $@
|
153
|
+
|
154
|
+
site-install: site-install-so site-install-rb
|
155
|
+
site-install-so: install-so
|
156
|
+
site-install-rb: install-rb
|
157
|
+
|
158
|
+
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
159
|
+
|
160
|
+
.cc.o:
|
161
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
162
|
+
|
163
|
+
.cxx.o:
|
164
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
165
|
+
|
166
|
+
.cpp.o:
|
167
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
168
|
+
|
169
|
+
.C.o:
|
170
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
171
|
+
|
172
|
+
.c.o:
|
173
|
+
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
174
|
+
|
175
|
+
$(DLLIB): $(OBJS) Makefile
|
176
|
+
@-$(RM) $(@)
|
177
|
+
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
$(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
|