ruby-dnn 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4d8dd255a75d99969d877a06faa150456210f131858a6f08b558dc070f5af9f
4
- data.tar.gz: 72fe90225b3deb1a2957af33529ef4f1845749cd53ce0246d75ffd8ed36fded5
3
+ metadata.gz: 03afaeb7e854b0eb697e775bb943501bd26a6afb149032d963c9ca71b3e0b4fe
4
+ data.tar.gz: 43fb3980ae04eca255180279202b8164a7c0c9b742d145fe19e6a07b860b179b
5
5
  SHA512:
6
- metadata.gz: 96194040842f66d4ea3499fab0eefb7e5b47212ec8ba2981640879446ac72103c531bab05e55aab64ecc40d2e490fc8a5a96b20068167e017d58250f060230cf
7
- data.tar.gz: 718a6f11e8a8e647dc0fa3867b72c3f289efa3d8a8efd689425d92ab5003e221f729a326011a46caa3c0d53be10cfe569a7e959197c0b818f44e948842a1b832
6
+ metadata.gz: 20fcb65e677558cb9095149f735c3efeede18da9b260a47cde1dafcb65bbdbc38502c3ca97ec0d169999ebeed45e1a1d59e5f44f8273ccc456dfc49468746e08
7
+ data.tar.gz: 87edeed4d7285e9f3e5bd638c21a24ea2e127aa6f42dad4f9f846876b3033d94cec4269fdc756c5f2398036fbe8160210aa257666a1deb5855d04cca70dc55e5
data/Rakefile CHANGED
@@ -7,4 +7,16 @@ Rake::TestTask.new(:test) do |t|
7
7
  t.test_files = FileList["test/**/*_test.rb"]
8
8
  end
9
9
 
10
- task :default => :test
10
+ task :build_mnist do
11
+ sh "cd lib/dnn/ext/mnist; ruby extconf.rb; make"
12
+ end
13
+
14
+ task :build_cifar10 do
15
+ sh "cd lib/dnn/ext/cifar10; ruby extconf.rb; make"
16
+ end
17
+
18
+ task :build_image_io do
19
+ sh "cd lib/dnn/ext/image_io; ruby extconf.rb; make"
20
+ end
21
+
22
+ task :default => [:test, :build_mnist, :build_cifar10, :build_image_io]
@@ -0,0 +1,62 @@
1
+ require "dnn"
2
+ require "dnn/lib/cifar10"
3
+ #require "numo/linalg/autoloader"
4
+
5
+ include Numo
6
+ include DNN::Layers
7
+ include DNN::Activations
8
+ include DNN::Optimizers
9
+ Model = DNN::Model
10
+ CIFAR10 = DNN::CIFAR10
11
+
12
+ x_train, y_train = CIFAR10.load_train
13
+ x_test, y_test = CIFAR10.load_test
14
+
15
+ x_train = SFloat.cast(x_train).reshape(x_train.shape[0], 32, 32, 3).transpose(0, 3, 2, 1)
16
+ x_test = SFloat.cast(x_test).reshape(x_test.shape[0], 32, 32, 3).transpose(0, 3, 2, 1)
17
+
18
+ x_train /= 255
19
+ x_test /= 255
20
+
21
+ y_train = DNN::Util.to_categorical(y_train, 10)
22
+ y_test = DNN::Util.to_categorical(y_test, 10)
23
+
24
+ model = Model.new
25
+
26
+ model << InputLayer.new([3, 32, 32])
27
+
28
+ model << Conv2D.new(16, 5, 5)
29
+ model << BatchNormalization.new
30
+ model << ReLU.new
31
+
32
+ model << Conv2D.new(16, 5, 5)
33
+ model << BatchNormalization.new
34
+ model << ReLU.new
35
+
36
+ model << MaxPool2D.new(2, 2)
37
+
38
+ model << Conv2D.new(32, 5, 5)
39
+ model << BatchNormalization.new
40
+ model << ReLU.new
41
+
42
+ model << Conv2D.new(32, 5, 5)
43
+ model << BatchNormalization.new
44
+ model << ReLU.new
45
+
46
+ model << Flatten.new
47
+
48
+ model << Dense.new(512)
49
+ model << BatchNormalization.new
50
+ model << ReLU.new
51
+ model << Dropout.new(0.5)
52
+
53
+ model << Dense.new(10)
54
+ model << SoftmaxWithLoss.new
55
+
56
+ model.compile(Adam.new)
57
+
58
+ model.train(x_train, y_train, 20, batch_size: 100) do
59
+ model.test(x_test, y_test)
60
+ end
61
+
62
+ model.save("trained_cifar10.marshal")
@@ -0,0 +1,43 @@
1
+ require "dnn"
2
+ require "dnn/lib/mnist"
3
+ #require "numo/linalg/autoloader"
4
+
5
+ include Numo
6
+ include DNN::Layers
7
+ include DNN::Activations
8
+ include DNN::Optimizers
9
+ Model = DNN::Model
10
+ MNIST = DNN::MNIST
11
+
12
+ x_train, y_train = MNIST.load_train
13
+ x_test, y_test = MNIST.load_test
14
+
15
+ x_train = SFloat.cast(x_train).reshape(x_train.shape[0], 784)
16
+ x_test = SFloat.cast(x_test).reshape(x_test.shape[0], 784)
17
+
18
+ x_train /= 255
19
+ x_test /= 255
20
+
21
+ y_train = DNN::Util.to_categorical(y_train, 10)
22
+ y_test = DNN::Util.to_categorical(y_test, 10)
23
+
24
+ model = Model.new
25
+
26
+ model << InputLayer.new(784)
27
+
28
+ model << Dense.new(256)
29
+ model << BatchNormalization.new
30
+ model << ReLU.new
31
+
32
+ model << Dense.new(256)
33
+ model << BatchNormalization.new
34
+ model << ReLU.new
35
+
36
+ model << Dense.new(10)
37
+ model << SoftmaxWithLoss.new
38
+
39
+ model.compile(RMSProp.new)
40
+
41
+ model.train(x_train, y_train, 10, batch_size: 100) do
42
+ model.test(x_test, y_test)
43
+ end
@@ -0,0 +1,52 @@
1
+ require "dnn"
2
+ require "dnn/lib/mnist"
3
+ #require "numo/linalg/autoloader"
4
+
5
+ include Numo
6
+ include DNN::Layers
7
+ include DNN::Activations
8
+ include DNN::Optimizers
9
+ Model = DNN::Model
10
+ MNIST = DNN::MNIST
11
+
12
+ x_train, y_train = MNIST.load_train
13
+ x_test, y_test = MNIST.load_test
14
+
15
+ x_train = SFloat.cast(x_train).reshape(x_train.shape[0], 1, 28, 28)
16
+ x_test = SFloat.cast(x_test).reshape(x_test.shape[0], 1, 28, 28)
17
+
18
+ x_train /= 255
19
+ x_test /= 255
20
+
21
+ y_train = DNN::Util.to_categorical(y_train, 10)
22
+ y_test = DNN::Util.to_categorical(y_test, 10)
23
+
24
+ model = Model.new
25
+
26
+ model << InputLayer.new([1, 28, 28])
27
+
28
+ model << Conv2D.new(16, 5, 5)
29
+ model << BatchNormalization.new
30
+ model << ReLU.new
31
+
32
+ model << MaxPool2D.new(2, 2)
33
+
34
+ model << Conv2D.new(32, 5, 5)
35
+ model << BatchNormalization.new
36
+ model << ReLU.new
37
+
38
+ model << Flatten.new
39
+
40
+ model << Dense.new(256)
41
+ model << BatchNormalization.new
42
+ model << ReLU.new
43
+ model << Dropout.new(0.5)
44
+
45
+ model << Dense.new(10)
46
+ model << SoftmaxWithLoss.new
47
+
48
+ model.compile(Adam.new)
49
+
50
+ model.train(x_train, y_train, 10, batch_size: 100) do
51
+ model.test(x_test, y_test)
52
+ end
@@ -0,0 +1,24 @@
1
+ require "dnn"
2
+
3
+ include Numo
4
+ include DNN::Layers
5
+ include DNN::Activations
6
+ include DNN::Optimizers
7
+ Model = DNN::Model
8
+
9
+ x = SFloat[[0, 0], [1, 0], [0, 1], [1, 1]]
10
+ y = SFloat[[0], [1], [1], [0]]
11
+
12
+ model = Model.new
13
+
14
+ model << InputLayer.new(2)
15
+ model << Dense.new(16)
16
+ model << ReLU.new
17
+ model << Dense.new(1)
18
+ model << SigmoidWithLoss.new
19
+
20
+ model.compile(SGD.new)
21
+
22
+ model.train(x, y, 20000, batch_size: 4, verbose: false)
23
+
24
+ p model.predict(x)
@@ -1,3 +1,3 @@
1
1
  module DNN
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/dnn/lib/mnist.rb CHANGED
@@ -1,22 +1,42 @@
1
+ require "open-uri"
1
2
  require "zlib"
3
+ require "dnn/core/error"
2
4
  require "dnn/ext/mnist/mnist_ext"
3
5
 
4
6
  module DNN
5
7
  module MNIST
6
- class MNISTLoadError < StandardError
7
- end
8
+ class DNN_MNIST_LoadError < DNN_Error; end
9
+
10
+ class DNN_MNIST_DownloadError < DNN_Error; end
11
+
12
+ URL_TRAIN_IMAGES = "http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz"
13
+ URL_TRAIN_LABELS = "http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz"
14
+ URL_TEST_IMAGES = "http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz"
15
+ URL_TEST_LABELS = "http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz"
8
16
 
9
17
  private_class_method :_mnist_load_images
10
18
  private_class_method :_mnist_load_labels
11
19
 
20
+ def self.downloads
21
+ return if Dir.exist?(mnist_dir)
22
+ Dir.mkdir(mnist_dir)
23
+ puts "Now downloading..."
24
+ download(URL_TRAIN_IMAGES)
25
+ download(URL_TRAIN_LABELS)
26
+ download(URL_TEST_IMAGES)
27
+ download(URL_TEST_LABELS)
28
+ puts "The download has ended."
29
+ end
30
+
12
31
  def self.load_train
13
- train_images_file_name = "mnist/train-images-idx3-ubyte.gz"
14
- train_labels_file_name = "mnist/train-labels-idx1-ubyte.gz"
32
+ downloads
33
+ train_images_file_name = url_to_file_name(URL_TRAIN_IMAGES)
34
+ train_labels_file_name = url_to_file_name(URL_TRAIN_LABELS)
15
35
  unless File.exist?(train_images_file_name)
16
- raise MNISTLoadError.new(%`file "#{train_images_file_name}" is not found.`)
36
+ raise DNN_MNIST_LoadError.new(%`file "#{train_images_file_name}" is not found.`)
17
37
  end
18
38
  unless File.exist?(train_labels_file_name)
19
- raise MNISTLoadError.new(%`file "#{train_labels_file_name}" is not found.`)
39
+ raise DNN_MNIST_LoadError.new(%`file "#{train_labels_file_name}" is not found.`)
20
40
  end
21
41
  images = load_images(train_images_file_name)
22
42
  labels = load_labels(train_labels_file_name)
@@ -24,13 +44,14 @@ module DNN
24
44
  end
25
45
 
26
46
  def self.load_test
27
- test_images_file_name = "mnist/t10k-images-idx3-ubyte.gz"
28
- test_labels_file_name = "mnist/t10k-labels-idx1-ubyte.gz"
47
+ downloads
48
+ test_images_file_name = url_to_file_name(URL_TEST_IMAGES)
49
+ test_labels_file_name = url_to_file_name(URL_TEST_LABELS)
29
50
  unless File.exist?(test_images_file_name)
30
- raise MNISTLoadError.new(%`file "#{train_images_file_name}" is not found.`)
51
+ raise DNN_MNIST_LoadError.new(%`file "#{train_images_file_name}" is not found.`)
31
52
  end
32
53
  unless File.exist?(test_labels_file_name)
33
- raise MNISTLoadError.new(%`file "#{train_labels_file_name}" is not found.`)
54
+ raise DNN_MNIST_LoadError.new(%`file "#{train_labels_file_name}" is not found.`)
34
55
  end
35
56
  images = load_images(test_images_file_name)
36
57
  labels = load_labels(test_labels_file_name)
@@ -39,6 +60,14 @@ module DNN
39
60
 
40
61
  private_class_method
41
62
 
63
+ def self.download(url)
64
+ open(url, "rb") do |f|
65
+ File.binwrite(url_to_file_name(url), f.read)
66
+ end
67
+ rescue => ex
68
+ raise DNN_MNIST_DownloadError.new(ex.message)
69
+ end
70
+
42
71
  def self.load_images(file_name)
43
72
  images = nil
44
73
  Zlib::GzipReader.open(file_name) do |f|
@@ -57,5 +86,13 @@ module DNN
57
86
  end
58
87
  labels
59
88
  end
89
+
90
+ def self.mnist_dir
91
+ __dir__ + "/mnist"
92
+ end
93
+
94
+ def self.url_to_file_name(url)
95
+ mnist_dir + "/" + url.match(%r`.+/(.+)$`)[1]
96
+ end
60
97
  end
61
98
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-dnn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - unagiootoro
@@ -82,6 +82,10 @@ files:
82
82
  - Rakefile
83
83
  - bin/console
84
84
  - bin/setup
85
+ - examples/cifar10_example.rb
86
+ - examples/mnist_example.rb
87
+ - examples/mnist_example2.rb
88
+ - examples/xor_example.rb
85
89
  - lib/dnn.rb
86
90
  - lib/dnn/core/activations.rb
87
91
  - lib/dnn/core/error.rb
@@ -91,10 +95,7 @@ files:
91
95
  - lib/dnn/core/optimizers.rb
92
96
  - lib/dnn/core/util.rb
93
97
  - lib/dnn/core/version.rb
94
- - lib/dnn/ext/cifar10/Makefile
95
98
  - lib/dnn/ext/cifar10/cifar10_ext.c
96
- - lib/dnn/ext/cifar10/cifar10_ext.o
97
- - lib/dnn/ext/cifar10/cifar10_ext.so
98
99
  - lib/dnn/ext/cifar10/extconf.rb
99
100
  - lib/dnn/ext/cifar10/numo/compat.h
100
101
  - lib/dnn/ext/cifar10/numo/extconf.h
@@ -125,10 +126,8 @@ files:
125
126
  - lib/dnn/ext/cifar10/numo/types/uint8.h
126
127
  - lib/dnn/ext/cifar10/numo/types/uint_macro.h
127
128
  - lib/dnn/ext/cifar10/numo/types/xint_macro.h
128
- - lib/dnn/ext/image_io/Makefile
129
129
  - lib/dnn/ext/image_io/extconf.rb
130
130
  - lib/dnn/ext/image_io/image_io_ext.c
131
- - lib/dnn/ext/image_io/image_io_ext.so
132
131
  - lib/dnn/ext/image_io/numo/compat.h
133
132
  - lib/dnn/ext/image_io/numo/extconf.h
134
133
  - lib/dnn/ext/image_io/numo/intern.h
@@ -160,11 +159,8 @@ files:
160
159
  - lib/dnn/ext/image_io/numo/types/xint_macro.h
161
160
  - lib/dnn/ext/image_io/stb_image.h
162
161
  - lib/dnn/ext/image_io/stb_image_write.h
163
- - lib/dnn/ext/mnist/Makefile
164
162
  - lib/dnn/ext/mnist/extconf.rb
165
163
  - lib/dnn/ext/mnist/mnist_ext.c
166
- - lib/dnn/ext/mnist/mnist_ext.o
167
- - lib/dnn/ext/mnist/mnist_ext.so
168
164
  - lib/dnn/ext/mnist/numo/compat.h
169
165
  - lib/dnn/ext/mnist/numo/extconf.h
170
166
  - lib/dnn/ext/mnist/numo/intern.h
@@ -1,263 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- # V=0 quiet, V=1 verbose. other values don't work.
5
- V = 0
6
- Q1 = $(V:1=)
7
- Q = $(Q1:0=@)
8
- ECHO1 = $(V:1=@ :)
9
- ECHO = $(ECHO1:0=@ echo)
10
- NULLCMD = :
11
-
12
- #### Start of system configuration section. ####
13
-
14
- srcdir = .
15
- topdir = /home/ootoro/.rbenv/versions/2.5.1/include/ruby-2.5.0
16
- hdrdir = $(topdir)
17
- arch_hdrdir = /home/ootoro/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-linux
18
- PATH_SEPARATOR = :
19
- VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
20
- prefix = $(DESTDIR)/home/ootoro/.rbenv/versions/2.5.1
21
- rubysitearchprefix = $(rubylibprefix)/$(sitearch)
22
- rubyarchprefix = $(rubylibprefix)/$(arch)
23
- rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
24
- exec_prefix = $(prefix)
25
- vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
26
- sitearchhdrdir = $(sitehdrdir)/$(sitearch)
27
- rubyarchhdrdir = $(rubyhdrdir)/$(arch)
28
- vendorhdrdir = $(rubyhdrdir)/vendor_ruby
29
- sitehdrdir = $(rubyhdrdir)/site_ruby
30
- rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
31
- vendorarchdir = $(vendorlibdir)/$(sitearch)
32
- vendorlibdir = $(vendordir)/$(ruby_version)
33
- vendordir = $(rubylibprefix)/vendor_ruby
34
- sitearchdir = $(sitelibdir)/$(sitearch)
35
- sitelibdir = $(sitedir)/$(ruby_version)
36
- sitedir = $(rubylibprefix)/site_ruby
37
- rubyarchdir = $(rubylibdir)/$(arch)
38
- rubylibdir = $(rubylibprefix)/$(ruby_version)
39
- sitearchincludedir = $(includedir)/$(sitearch)
40
- archincludedir = $(includedir)/$(arch)
41
- sitearchlibdir = $(libdir)/$(sitearch)
42
- archlibdir = $(libdir)/$(arch)
43
- ridir = $(datarootdir)/$(RI_BASE_NAME)
44
- mandir = $(datarootdir)/man
45
- localedir = $(datarootdir)/locale
46
- libdir = $(exec_prefix)/lib
47
- psdir = $(docdir)
48
- pdfdir = $(docdir)
49
- dvidir = $(docdir)
50
- htmldir = $(docdir)
51
- infodir = $(datarootdir)/info
52
- docdir = $(datarootdir)/doc/$(PACKAGE)
53
- oldincludedir = $(DESTDIR)/usr/include
54
- includedir = $(prefix)/include
55
- localstatedir = $(prefix)/var
56
- sharedstatedir = $(prefix)/com
57
- sysconfdir = $(prefix)/etc
58
- datadir = $(datarootdir)
59
- datarootdir = $(prefix)/share
60
- libexecdir = $(exec_prefix)/libexec
61
- sbindir = $(exec_prefix)/sbin
62
- bindir = $(exec_prefix)/bin
63
- archdir = $(rubyarchdir)
64
-
65
-
66
- CC = gcc
67
- CXX = g++
68
- LIBRUBY = $(LIBRUBY_A)
69
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
70
- LIBRUBYARG_SHARED = -Wl,-rpath,$(libdir) -L$(libdir)
71
- LIBRUBYARG_STATIC = -Wl,-rpath,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static
72
- empty =
73
- OUTFLAG = -o $(empty)
74
- COUTFLAG = -o $(empty)
75
- CSRCFLAG = $(empty)
76
-
77
- RUBY_EXTCONF_H =
78
- cflags = $(optflags) $(debugflags) $(warnflags)
79
- cxxflags = $(optflags) $(debugflags) $(warnflags)
80
- optflags = -O3
81
- debugflags = -ggdb3
82
- warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized
83
- CCDLFLAGS = -fPIC
84
- CFLAGS = $(CCDLFLAGS) $(cflags) $(ARCH_FLAG)
85
- INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
86
- DEFS =
87
- CPPFLAGS = -I/home/ootoro/.rbenv/versions/2.5.1/include $(DEFS) $(cppflags)
88
- CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
89
- ldflags = -L. -L/home/ootoro/.rbenv/versions/2.5.1/lib -fstack-protector -rdynamic -Wl,-export-dynamic
90
- dldflags = -L/home/ootoro/.rbenv/versions/2.5.1/lib -Wl,--compress-debug-sections=zlib
91
- ARCH_FLAG =
92
- DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
93
- LDSHARED = $(CC) -shared
94
- LDSHAREDXX = $(CXX) -shared
95
- AR = ar
96
- EXEEXT =
97
-
98
- RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
99
- RUBY_SO_NAME = ruby
100
- RUBYW_INSTALL_NAME =
101
- RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
102
- RUBYW_BASE_NAME = rubyw
103
- RUBY_BASE_NAME = ruby
104
-
105
- arch = x86_64-linux
106
- sitearch = $(arch)
107
- ruby_version = 2.5.0
108
- ruby = $(bindir)/$(RUBY_BASE_NAME)
109
- RUBY = $(ruby)
110
- ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
111
-
112
- RM = rm -f
113
- RM_RF = $(RUBY) -run -e rm -- -rf
114
- RMDIRS = rmdir --ignore-fail-on-non-empty -p
115
- MAKEDIRS = /bin/mkdir -p
116
- INSTALL = /usr/bin/install -c
117
- INSTALL_PROG = $(INSTALL) -m 0755
118
- INSTALL_DATA = $(INSTALL) -m 644
119
- COPY = cp
120
- TOUCH = exit >
121
-
122
- #### End of system configuration section. ####
123
-
124
- preload =
125
- libpath = . $(libdir)
126
- LIBPATH = -L. -L$(libdir) -Wl,-rpath,$(libdir)
127
- DEFFILE =
128
-
129
- CLEANFILES = mkmf.log
130
- DISTCLEANFILES =
131
- DISTCLEANDIRS =
132
-
133
- extout =
134
- extout_prefix =
135
- target_prefix =
136
- LOCAL_LIBS =
137
- LIBS = -lpthread -ldl -lcrypt -lm -lc
138
- ORIG_SRCS = cifar10_ext.c
139
- SRCS = $(ORIG_SRCS)
140
- OBJS = cifar10_ext.o
141
- HDRS =
142
- LOCAL_HDRS =
143
- TARGET = cifar10_ext
144
- TARGET_NAME = cifar10_ext
145
- TARGET_ENTRY = Init_$(TARGET_NAME)
146
- DLLIB = $(TARGET).so
147
- EXTSTATIC =
148
- STATIC_LIB =
149
-
150
- TIMESTAMP_DIR = .
151
- BINDIR = $(bindir)
152
- RUBYCOMMONDIR = $(sitedir)$(target_prefix)
153
- RUBYLIBDIR = $(sitelibdir)$(target_prefix)
154
- RUBYARCHDIR = $(sitearchdir)$(target_prefix)
155
- HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
156
- ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
157
- TARGET_SO_DIR =
158
- TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
159
- CLEANLIBS = $(TARGET_SO)
160
- CLEANOBJS = *.o *.bak
161
-
162
- all: $(DLLIB)
163
- static: $(STATIC_LIB)
164
- .PHONY: all install static install-so install-rb
165
- .PHONY: clean clean-so clean-static clean-rb
166
-
167
- clean-static::
168
- clean-rb-default::
169
- clean-rb::
170
- clean-so::
171
- clean: clean-so clean-static clean-rb-default clean-rb
172
- -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
173
-
174
- distclean-rb-default::
175
- distclean-rb::
176
- distclean-so::
177
- distclean-static::
178
- distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
179
- -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
180
- -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
181
- -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
182
-
183
- realclean: distclean
184
- install: install-so install-rb
185
-
186
- install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.time
187
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
188
- clean-static::
189
- -$(Q)$(RM) $(STATIC_LIB)
190
- install-rb: pre-install-rb do-install-rb install-rb-default
191
- install-rb-default: pre-install-rb-default do-install-rb-default
192
- pre-install-rb: Makefile
193
- pre-install-rb-default: Makefile
194
- do-install-rb:
195
- do-install-rb-default:
196
- pre-install-rb-default:
197
- @$(NULLCMD)
198
- $(TIMESTAMP_DIR)/.sitearchdir.time:
199
- $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
200
- $(Q) $(TOUCH) $@
201
-
202
- site-install: site-install-so site-install-rb
203
- site-install-so: install-so
204
- site-install-rb: install-rb
205
-
206
- .SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
207
-
208
- .cc.o:
209
- $(ECHO) compiling $(<)
210
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
211
-
212
- .cc.S:
213
- $(ECHO) translating $(<)
214
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
215
-
216
- .mm.o:
217
- $(ECHO) compiling $(<)
218
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
219
-
220
- .mm.S:
221
- $(ECHO) translating $(<)
222
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
223
-
224
- .cxx.o:
225
- $(ECHO) compiling $(<)
226
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
227
-
228
- .cxx.S:
229
- $(ECHO) translating $(<)
230
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
231
-
232
- .cpp.o:
233
- $(ECHO) compiling $(<)
234
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
235
-
236
- .cpp.S:
237
- $(ECHO) translating $(<)
238
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
239
-
240
- .c.o:
241
- $(ECHO) compiling $(<)
242
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
243
-
244
- .c.S:
245
- $(ECHO) translating $(<)
246
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
247
-
248
- .m.o:
249
- $(ECHO) compiling $(<)
250
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
251
-
252
- .m.S:
253
- $(ECHO) translating $(<)
254
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
255
-
256
- $(TARGET_SO): $(OBJS) Makefile
257
- $(ECHO) linking shared-object $(DLLIB)
258
- -$(Q)$(RM) $(@)
259
- $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
260
-
261
-
262
-
263
- $(OBJS): $(HDRS) $(ruby_headers)
Binary file
Binary file
@@ -1,263 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- # V=0 quiet, V=1 verbose. other values don't work.
5
- V = 0
6
- Q1 = $(V:1=)
7
- Q = $(Q1:0=@)
8
- ECHO1 = $(V:1=@ :)
9
- ECHO = $(ECHO1:0=@ echo)
10
- NULLCMD = :
11
-
12
- #### Start of system configuration section. ####
13
-
14
- srcdir = .
15
- topdir = /home/ootoro/.rbenv/versions/2.5.1/include/ruby-2.5.0
16
- hdrdir = $(topdir)
17
- arch_hdrdir = /home/ootoro/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-linux
18
- PATH_SEPARATOR = :
19
- VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
20
- prefix = $(DESTDIR)/home/ootoro/.rbenv/versions/2.5.1
21
- rubysitearchprefix = $(rubylibprefix)/$(sitearch)
22
- rubyarchprefix = $(rubylibprefix)/$(arch)
23
- rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
24
- exec_prefix = $(prefix)
25
- vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
26
- sitearchhdrdir = $(sitehdrdir)/$(sitearch)
27
- rubyarchhdrdir = $(rubyhdrdir)/$(arch)
28
- vendorhdrdir = $(rubyhdrdir)/vendor_ruby
29
- sitehdrdir = $(rubyhdrdir)/site_ruby
30
- rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
31
- vendorarchdir = $(vendorlibdir)/$(sitearch)
32
- vendorlibdir = $(vendordir)/$(ruby_version)
33
- vendordir = $(rubylibprefix)/vendor_ruby
34
- sitearchdir = $(sitelibdir)/$(sitearch)
35
- sitelibdir = $(sitedir)/$(ruby_version)
36
- sitedir = $(rubylibprefix)/site_ruby
37
- rubyarchdir = $(rubylibdir)/$(arch)
38
- rubylibdir = $(rubylibprefix)/$(ruby_version)
39
- sitearchincludedir = $(includedir)/$(sitearch)
40
- archincludedir = $(includedir)/$(arch)
41
- sitearchlibdir = $(libdir)/$(sitearch)
42
- archlibdir = $(libdir)/$(arch)
43
- ridir = $(datarootdir)/$(RI_BASE_NAME)
44
- mandir = $(datarootdir)/man
45
- localedir = $(datarootdir)/locale
46
- libdir = $(exec_prefix)/lib
47
- psdir = $(docdir)
48
- pdfdir = $(docdir)
49
- dvidir = $(docdir)
50
- htmldir = $(docdir)
51
- infodir = $(datarootdir)/info
52
- docdir = $(datarootdir)/doc/$(PACKAGE)
53
- oldincludedir = $(DESTDIR)/usr/include
54
- includedir = $(prefix)/include
55
- localstatedir = $(prefix)/var
56
- sharedstatedir = $(prefix)/com
57
- sysconfdir = $(prefix)/etc
58
- datadir = $(datarootdir)
59
- datarootdir = $(prefix)/share
60
- libexecdir = $(exec_prefix)/libexec
61
- sbindir = $(exec_prefix)/sbin
62
- bindir = $(exec_prefix)/bin
63
- archdir = $(rubyarchdir)
64
-
65
-
66
- CC = gcc
67
- CXX = g++
68
- LIBRUBY = $(LIBRUBY_A)
69
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
70
- LIBRUBYARG_SHARED = -Wl,-rpath,$(libdir) -L$(libdir)
71
- LIBRUBYARG_STATIC = -Wl,-rpath,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static
72
- empty =
73
- OUTFLAG = -o $(empty)
74
- COUTFLAG = -o $(empty)
75
- CSRCFLAG = $(empty)
76
-
77
- RUBY_EXTCONF_H =
78
- cflags = $(optflags) $(debugflags) $(warnflags)
79
- cxxflags = $(optflags) $(debugflags) $(warnflags)
80
- optflags = -O3
81
- debugflags = -ggdb3
82
- warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized
83
- CCDLFLAGS = -fPIC
84
- CFLAGS = $(CCDLFLAGS) $(cflags) $(ARCH_FLAG)
85
- INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
86
- DEFS =
87
- CPPFLAGS = -I/home/ootoro/.rbenv/versions/2.5.1/include $(DEFS) $(cppflags)
88
- CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
89
- ldflags = -L. -L/home/ootoro/.rbenv/versions/2.5.1/lib -fstack-protector -rdynamic -Wl,-export-dynamic
90
- dldflags = -L/home/ootoro/.rbenv/versions/2.5.1/lib -Wl,--compress-debug-sections=zlib
91
- ARCH_FLAG =
92
- DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
93
- LDSHARED = $(CC) -shared
94
- LDSHAREDXX = $(CXX) -shared
95
- AR = ar
96
- EXEEXT =
97
-
98
- RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
99
- RUBY_SO_NAME = ruby
100
- RUBYW_INSTALL_NAME =
101
- RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
102
- RUBYW_BASE_NAME = rubyw
103
- RUBY_BASE_NAME = ruby
104
-
105
- arch = x86_64-linux
106
- sitearch = $(arch)
107
- ruby_version = 2.5.0
108
- ruby = $(bindir)/$(RUBY_BASE_NAME)
109
- RUBY = $(ruby)
110
- ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
111
-
112
- RM = rm -f
113
- RM_RF = $(RUBY) -run -e rm -- -rf
114
- RMDIRS = rmdir --ignore-fail-on-non-empty -p
115
- MAKEDIRS = /bin/mkdir -p
116
- INSTALL = /usr/bin/install -c
117
- INSTALL_PROG = $(INSTALL) -m 0755
118
- INSTALL_DATA = $(INSTALL) -m 644
119
- COPY = cp
120
- TOUCH = exit >
121
-
122
- #### End of system configuration section. ####
123
-
124
- preload =
125
- libpath = . $(libdir)
126
- LIBPATH = -L. -L$(libdir) -Wl,-rpath,$(libdir)
127
- DEFFILE =
128
-
129
- CLEANFILES = mkmf.log
130
- DISTCLEANFILES =
131
- DISTCLEANDIRS =
132
-
133
- extout =
134
- extout_prefix =
135
- target_prefix =
136
- LOCAL_LIBS =
137
- LIBS = -lpthread -ldl -lcrypt -lm -lc
138
- ORIG_SRCS = image_io_ext.c
139
- SRCS = $(ORIG_SRCS)
140
- OBJS = image_io_ext.o
141
- HDRS = $(srcdir)/stb_image.h $(srcdir)/stb_image_write.h
142
- LOCAL_HDRS =
143
- TARGET = image_io_ext
144
- TARGET_NAME = image_io_ext
145
- TARGET_ENTRY = Init_$(TARGET_NAME)
146
- DLLIB = $(TARGET).so
147
- EXTSTATIC =
148
- STATIC_LIB =
149
-
150
- TIMESTAMP_DIR = .
151
- BINDIR = $(bindir)
152
- RUBYCOMMONDIR = $(sitedir)$(target_prefix)
153
- RUBYLIBDIR = $(sitelibdir)$(target_prefix)
154
- RUBYARCHDIR = $(sitearchdir)$(target_prefix)
155
- HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
156
- ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
157
- TARGET_SO_DIR =
158
- TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
159
- CLEANLIBS = $(TARGET_SO)
160
- CLEANOBJS = *.o *.bak
161
-
162
- all: $(DLLIB)
163
- static: $(STATIC_LIB)
164
- .PHONY: all install static install-so install-rb
165
- .PHONY: clean clean-so clean-static clean-rb
166
-
167
- clean-static::
168
- clean-rb-default::
169
- clean-rb::
170
- clean-so::
171
- clean: clean-so clean-static clean-rb-default clean-rb
172
- -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
173
-
174
- distclean-rb-default::
175
- distclean-rb::
176
- distclean-so::
177
- distclean-static::
178
- distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
179
- -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
180
- -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
181
- -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
182
-
183
- realclean: distclean
184
- install: install-so install-rb
185
-
186
- install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.time
187
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
188
- clean-static::
189
- -$(Q)$(RM) $(STATIC_LIB)
190
- install-rb: pre-install-rb do-install-rb install-rb-default
191
- install-rb-default: pre-install-rb-default do-install-rb-default
192
- pre-install-rb: Makefile
193
- pre-install-rb-default: Makefile
194
- do-install-rb:
195
- do-install-rb-default:
196
- pre-install-rb-default:
197
- @$(NULLCMD)
198
- $(TIMESTAMP_DIR)/.sitearchdir.time:
199
- $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
200
- $(Q) $(TOUCH) $@
201
-
202
- site-install: site-install-so site-install-rb
203
- site-install-so: install-so
204
- site-install-rb: install-rb
205
-
206
- .SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
207
-
208
- .cc.o:
209
- $(ECHO) compiling $(<)
210
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
211
-
212
- .cc.S:
213
- $(ECHO) translating $(<)
214
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
215
-
216
- .mm.o:
217
- $(ECHO) compiling $(<)
218
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
219
-
220
- .mm.S:
221
- $(ECHO) translating $(<)
222
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
223
-
224
- .cxx.o:
225
- $(ECHO) compiling $(<)
226
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
227
-
228
- .cxx.S:
229
- $(ECHO) translating $(<)
230
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
231
-
232
- .cpp.o:
233
- $(ECHO) compiling $(<)
234
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
235
-
236
- .cpp.S:
237
- $(ECHO) translating $(<)
238
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
239
-
240
- .c.o:
241
- $(ECHO) compiling $(<)
242
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
243
-
244
- .c.S:
245
- $(ECHO) translating $(<)
246
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
247
-
248
- .m.o:
249
- $(ECHO) compiling $(<)
250
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
251
-
252
- .m.S:
253
- $(ECHO) translating $(<)
254
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
255
-
256
- $(TARGET_SO): $(OBJS) Makefile
257
- $(ECHO) linking shared-object $(DLLIB)
258
- -$(Q)$(RM) $(@)
259
- $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
260
-
261
-
262
-
263
- $(OBJS): $(HDRS) $(ruby_headers)
Binary file
@@ -1,263 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- # V=0 quiet, V=1 verbose. other values don't work.
5
- V = 0
6
- Q1 = $(V:1=)
7
- Q = $(Q1:0=@)
8
- ECHO1 = $(V:1=@ :)
9
- ECHO = $(ECHO1:0=@ echo)
10
- NULLCMD = :
11
-
12
- #### Start of system configuration section. ####
13
-
14
- srcdir = .
15
- topdir = /home/ootoro/.rbenv/versions/2.5.1/include/ruby-2.5.0
16
- hdrdir = $(topdir)
17
- arch_hdrdir = /home/ootoro/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-linux
18
- PATH_SEPARATOR = :
19
- VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
20
- prefix = $(DESTDIR)/home/ootoro/.rbenv/versions/2.5.1
21
- rubysitearchprefix = $(rubylibprefix)/$(sitearch)
22
- rubyarchprefix = $(rubylibprefix)/$(arch)
23
- rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
24
- exec_prefix = $(prefix)
25
- vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
26
- sitearchhdrdir = $(sitehdrdir)/$(sitearch)
27
- rubyarchhdrdir = $(rubyhdrdir)/$(arch)
28
- vendorhdrdir = $(rubyhdrdir)/vendor_ruby
29
- sitehdrdir = $(rubyhdrdir)/site_ruby
30
- rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
31
- vendorarchdir = $(vendorlibdir)/$(sitearch)
32
- vendorlibdir = $(vendordir)/$(ruby_version)
33
- vendordir = $(rubylibprefix)/vendor_ruby
34
- sitearchdir = $(sitelibdir)/$(sitearch)
35
- sitelibdir = $(sitedir)/$(ruby_version)
36
- sitedir = $(rubylibprefix)/site_ruby
37
- rubyarchdir = $(rubylibdir)/$(arch)
38
- rubylibdir = $(rubylibprefix)/$(ruby_version)
39
- sitearchincludedir = $(includedir)/$(sitearch)
40
- archincludedir = $(includedir)/$(arch)
41
- sitearchlibdir = $(libdir)/$(sitearch)
42
- archlibdir = $(libdir)/$(arch)
43
- ridir = $(datarootdir)/$(RI_BASE_NAME)
44
- mandir = $(datarootdir)/man
45
- localedir = $(datarootdir)/locale
46
- libdir = $(exec_prefix)/lib
47
- psdir = $(docdir)
48
- pdfdir = $(docdir)
49
- dvidir = $(docdir)
50
- htmldir = $(docdir)
51
- infodir = $(datarootdir)/info
52
- docdir = $(datarootdir)/doc/$(PACKAGE)
53
- oldincludedir = $(DESTDIR)/usr/include
54
- includedir = $(prefix)/include
55
- localstatedir = $(prefix)/var
56
- sharedstatedir = $(prefix)/com
57
- sysconfdir = $(prefix)/etc
58
- datadir = $(datarootdir)
59
- datarootdir = $(prefix)/share
60
- libexecdir = $(exec_prefix)/libexec
61
- sbindir = $(exec_prefix)/sbin
62
- bindir = $(exec_prefix)/bin
63
- archdir = $(rubyarchdir)
64
-
65
-
66
- CC = gcc
67
- CXX = g++
68
- LIBRUBY = $(LIBRUBY_A)
69
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
70
- LIBRUBYARG_SHARED = -Wl,-rpath,$(libdir) -L$(libdir)
71
- LIBRUBYARG_STATIC = -Wl,-rpath,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static
72
- empty =
73
- OUTFLAG = -o $(empty)
74
- COUTFLAG = -o $(empty)
75
- CSRCFLAG = $(empty)
76
-
77
- RUBY_EXTCONF_H =
78
- cflags = $(optflags) $(debugflags) $(warnflags)
79
- cxxflags = $(optflags) $(debugflags) $(warnflags)
80
- optflags = -O3
81
- debugflags = -ggdb3
82
- warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized
83
- CCDLFLAGS = -fPIC
84
- CFLAGS = $(CCDLFLAGS) $(cflags) $(ARCH_FLAG)
85
- INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
86
- DEFS =
87
- CPPFLAGS = -I/home/ootoro/.rbenv/versions/2.5.1/include $(DEFS) $(cppflags)
88
- CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
89
- ldflags = -L. -L/home/ootoro/.rbenv/versions/2.5.1/lib -fstack-protector -rdynamic -Wl,-export-dynamic
90
- dldflags = -L/home/ootoro/.rbenv/versions/2.5.1/lib -Wl,--compress-debug-sections=zlib
91
- ARCH_FLAG =
92
- DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
93
- LDSHARED = $(CC) -shared
94
- LDSHAREDXX = $(CXX) -shared
95
- AR = ar
96
- EXEEXT =
97
-
98
- RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
99
- RUBY_SO_NAME = ruby
100
- RUBYW_INSTALL_NAME =
101
- RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
102
- RUBYW_BASE_NAME = rubyw
103
- RUBY_BASE_NAME = ruby
104
-
105
- arch = x86_64-linux
106
- sitearch = $(arch)
107
- ruby_version = 2.5.0
108
- ruby = $(bindir)/$(RUBY_BASE_NAME)
109
- RUBY = $(ruby)
110
- ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
111
-
112
- RM = rm -f
113
- RM_RF = $(RUBY) -run -e rm -- -rf
114
- RMDIRS = rmdir --ignore-fail-on-non-empty -p
115
- MAKEDIRS = /bin/mkdir -p
116
- INSTALL = /usr/bin/install -c
117
- INSTALL_PROG = $(INSTALL) -m 0755
118
- INSTALL_DATA = $(INSTALL) -m 644
119
- COPY = cp
120
- TOUCH = exit >
121
-
122
- #### End of system configuration section. ####
123
-
124
- preload =
125
- libpath = . $(libdir)
126
- LIBPATH = -L. -L$(libdir) -Wl,-rpath,$(libdir)
127
- DEFFILE =
128
-
129
- CLEANFILES = mkmf.log
130
- DISTCLEANFILES =
131
- DISTCLEANDIRS =
132
-
133
- extout =
134
- extout_prefix =
135
- target_prefix =
136
- LOCAL_LIBS =
137
- LIBS = -lpthread -ldl -lcrypt -lm -lc
138
- ORIG_SRCS = mnist_ext.c
139
- SRCS = $(ORIG_SRCS)
140
- OBJS = mnist_ext.o
141
- HDRS =
142
- LOCAL_HDRS =
143
- TARGET = mnist_ext
144
- TARGET_NAME = mnist_ext
145
- TARGET_ENTRY = Init_$(TARGET_NAME)
146
- DLLIB = $(TARGET).so
147
- EXTSTATIC =
148
- STATIC_LIB =
149
-
150
- TIMESTAMP_DIR = .
151
- BINDIR = $(bindir)
152
- RUBYCOMMONDIR = $(sitedir)$(target_prefix)
153
- RUBYLIBDIR = $(sitelibdir)$(target_prefix)
154
- RUBYARCHDIR = $(sitearchdir)$(target_prefix)
155
- HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
156
- ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
157
- TARGET_SO_DIR =
158
- TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
159
- CLEANLIBS = $(TARGET_SO)
160
- CLEANOBJS = *.o *.bak
161
-
162
- all: $(DLLIB)
163
- static: $(STATIC_LIB)
164
- .PHONY: all install static install-so install-rb
165
- .PHONY: clean clean-so clean-static clean-rb
166
-
167
- clean-static::
168
- clean-rb-default::
169
- clean-rb::
170
- clean-so::
171
- clean: clean-so clean-static clean-rb-default clean-rb
172
- -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
173
-
174
- distclean-rb-default::
175
- distclean-rb::
176
- distclean-so::
177
- distclean-static::
178
- distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
179
- -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
180
- -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
181
- -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
182
-
183
- realclean: distclean
184
- install: install-so install-rb
185
-
186
- install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.time
187
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
188
- clean-static::
189
- -$(Q)$(RM) $(STATIC_LIB)
190
- install-rb: pre-install-rb do-install-rb install-rb-default
191
- install-rb-default: pre-install-rb-default do-install-rb-default
192
- pre-install-rb: Makefile
193
- pre-install-rb-default: Makefile
194
- do-install-rb:
195
- do-install-rb-default:
196
- pre-install-rb-default:
197
- @$(NULLCMD)
198
- $(TIMESTAMP_DIR)/.sitearchdir.time:
199
- $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
200
- $(Q) $(TOUCH) $@
201
-
202
- site-install: site-install-so site-install-rb
203
- site-install-so: install-so
204
- site-install-rb: install-rb
205
-
206
- .SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
207
-
208
- .cc.o:
209
- $(ECHO) compiling $(<)
210
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
211
-
212
- .cc.S:
213
- $(ECHO) translating $(<)
214
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
215
-
216
- .mm.o:
217
- $(ECHO) compiling $(<)
218
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
219
-
220
- .mm.S:
221
- $(ECHO) translating $(<)
222
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
223
-
224
- .cxx.o:
225
- $(ECHO) compiling $(<)
226
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
227
-
228
- .cxx.S:
229
- $(ECHO) translating $(<)
230
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
231
-
232
- .cpp.o:
233
- $(ECHO) compiling $(<)
234
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
235
-
236
- .cpp.S:
237
- $(ECHO) translating $(<)
238
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
239
-
240
- .c.o:
241
- $(ECHO) compiling $(<)
242
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
243
-
244
- .c.S:
245
- $(ECHO) translating $(<)
246
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
247
-
248
- .m.o:
249
- $(ECHO) compiling $(<)
250
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
251
-
252
- .m.S:
253
- $(ECHO) translating $(<)
254
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
255
-
256
- $(TARGET_SO): $(OBJS) Makefile
257
- $(ECHO) linking shared-object $(DLLIB)
258
- -$(Q)$(RM) $(@)
259
- $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
260
-
261
-
262
-
263
- $(OBJS): $(HDRS) $(ruby_headers)
Binary file
Binary file