smarter_csv 1.16.3 → 1.16.5

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: b40fb76fef88599d7449691806af6f76a131ffcd41e2ee145d5c87f3554a2006
4
- data.tar.gz: edb27057973c0a88524579f450dc8ed3ffadbd983de7155a84ff159495c31233
3
+ metadata.gz: 9408d23e53325b5366f4033166b5d4f4b45bcfee81a4dfa94b3d0c1959317216
4
+ data.tar.gz: e05f83f08e01fbb859da5cb898125b72fc911a4ba199992ee8075e8bfe2b6a99
5
5
  SHA512:
6
- metadata.gz: 5b9e2a17ae14a5d7b3dfddd854148f38c8892d67544b51fecba888aa11c540096057460880564b89251194fea513c3e2807c500d93f896826db885daf64271fe
7
- data.tar.gz: 90b5aa10c6bc36cbc97662de879deaf61c2417a61e4cb5171924aac991a37c762588ff6413a924bfd083ca10c1fa1739049561f3c6e9de6ff196bdba85c7878f
6
+ metadata.gz: a5064055b6b7cb4a9365c139952cdeaedaad57c5636025401d2e87bd07184f406cb055a4d51229ac60b51ea3dbaace380116dc8a9862eabf00e4b4de7b345e33
7
+ data.tar.gz: 57ceb31ab4b15c36880c63c6f35c2919e8ab80ddd2599e552390a8d84ef3592e52097710f8be978b28c77cc6ae85c10583653e6050d3f4f3b6eb6ec6cb1e6aa9
data/.rubocop.yml CHANGED
@@ -121,6 +121,9 @@ Style/PercentLiteralDelimiters:
121
121
  Style/RegexpLiteral:
122
122
  Enabled: false
123
123
 
124
+ Style/RescueModifier:
125
+ Enabled: false
126
+
124
127
  Style/SafeNavigation:
125
128
  Enabled: false
126
129
 
@@ -153,6 +156,9 @@ Style/SymbolArray:
153
156
  Style/SymbolProc: # old Ruby versions can't do this
154
157
  Enabled: false
155
158
 
159
+ Style/TernaryParentheses:
160
+ Enabled: false
161
+
156
162
  Style/TrailingCommaInArrayLiteral:
157
163
  Enabled: false
158
164
  EnforcedStyleForMultiline: consistent_comma
data/CHANGELOG.md CHANGED
@@ -1,6 +1,24 @@
1
1
 
2
2
  # SmarterCSV 1.x Change Log
3
3
 
4
+ ## 1.16.5 (2026-05-18)
5
+
6
+ ### Bug Fix
7
+
8
+ - fixing issue with `remove_empty_hashes: false` not being honored in accelerated path (does not affect you when you use default settings)
9
+
10
+ ## 1.16.4 (2026-04-21) — Bug Fixes
11
+
12
+ RSpec tests: **1,434 → 1,467** (+33 tests)
13
+
14
+ ### Bug Fixes
15
+
16
+ * Fixed bug in `SmarterCSV.errors` that could lose collected records when processing raises mid-stream,
17
+ e.g. when `bad_row_limit:` was exceeded (`TooManyBadRows`), or when a user's block raised through `.process` / `.each` / `.each_chunk`.
18
+
19
+ * Fixed `enforce_utf8_encoding` incorrectly replacing all non-ASCII bytes when the input string was tagged as `ASCII-8BIT` (binary).
20
+ The encoding is now relabeled to UTF-8 before transcoding, so only genuinely invalid byte sequences are replaced.
21
+
4
22
  ## 1.16.3 (2026-04-14) — New Feature
5
23
 
6
24
  RSpec tests: **1,425 → 1,434** (+9 tests)
@@ -1176,12 +1176,20 @@ __attribute__((hot)) static VALUE rb_parse_line_to_hash(VALUE self, VALUE line,
1176
1176
  * return nil instead of the hash so the row can be skipped.
1177
1177
  * With lazy allocation, if all_blank is true, xform.hash is still Qnil —
1178
1178
  * no hash was ever allocated.
1179
+ *
1180
+ * If remove_empty_hashes is disabled, preserve the row as an empty hash.
1181
+ * This keeps parity with the Ruby path without adding any cost to the
1182
+ * normal non-blank hot path.
1179
1183
  */
1180
- if (remove_empty && all_blank) {
1181
- VALUE result = rb_ary_new_capa(2);
1182
- rb_ary_push(result, Qnil);
1183
- rb_ary_push(result, LONG2FIX(element_count));
1184
- return result;
1184
+ if (all_blank) {
1185
+ if (remove_empty) {
1186
+ VALUE result = rb_ary_new_capa(2);
1187
+ rb_ary_push(result, Qnil);
1188
+ rb_ary_push(result, LONG2FIX(element_count));
1189
+ return result;
1190
+ }
1191
+
1192
+ ensure_hash_allocated(&xform);
1185
1193
  }
1186
1194
 
1187
1195
  /* ----------------------------------------
@@ -1728,11 +1736,15 @@ __attribute__((hot)) static VALUE rb_parse_line_to_hash_ctx(VALUE self, VALUE li
1728
1736
  /* ----------------------------------------
1729
1737
  * SECTION 6: Handle blank rows
1730
1738
  * ---------------------------------------- */
1731
- if (remove_empty && all_blank) {
1732
- VALUE result = rb_ary_new_capa(2);
1733
- rb_ary_push(result, Qnil);
1734
- rb_ary_push(result, LONG2FIX(element_count));
1735
- return result;
1739
+ if (all_blank) {
1740
+ if (remove_empty) {
1741
+ VALUE result = rb_ary_new_capa(2);
1742
+ rb_ary_push(result, Qnil);
1743
+ rb_ary_push(result, LONG2FIX(element_count));
1744
+ return result;
1745
+ }
1746
+
1747
+ ensure_hash_allocated(&xform);
1736
1748
  }
1737
1749
 
1738
1750
  /* ----------------------------------------
@@ -147,9 +147,9 @@ module SmarterCSV
147
147
  options[:_keep_bitmap] = keep_flags.map { |f| f ? 1 : 0 }.pack('C*').freeze
148
148
  options[:_keep_extra_cols] = @only_headers_set ? false : true
149
149
  options[:_early_exit_after] = (@only_headers_set && !options[:strict]) ? (keep_flags.rindex(true) || -1) : -1
150
- options[:_keep_cols] = nil # nil signals C: "filter active, check _keep_bitmap"
150
+ options[:_keep_cols] = nil # nil signals C: "filter active, check _keep_bitmap"
151
151
  else
152
- options[:_keep_cols] = false # sentinel: no filtering active — C skips all bitmap paths
152
+ options[:_keep_cols] = false # sentinel: no filtering active — C skips all bitmap paths
153
153
  # Do NOT insert _keep_bitmap/_keep_extra_cols/_early_exit_after when unused.
154
154
  # Keeping the options hash as small as possible avoids hash table resize and
155
155
  # keeps all 10 per-row rb_hash_aref lookups hitting the same cache lines.
@@ -214,18 +214,18 @@ module SmarterCSV
214
214
  # on_start / on_chunk / on_complete are optional callables (nil by default).
215
215
  # Hooks only fire from `process` (library-controlled iteration). Enumerator
216
216
  # modes (each / each_chunk) do not fire hooks — the caller owns the lifecycle.
217
- _on_start = options[:on_start]
218
- _on_chunk = options[:on_chunk]
219
- _on_complete = options[:on_complete]
220
- _start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) if _on_start || _on_complete
217
+ on_start = options[:on_start]
218
+ on_chunk = options[:on_chunk]
219
+ on_complete = options[:on_complete]
220
+ start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) if on_start || on_complete
221
221
 
222
- if _on_start
223
- _input_meta = if @input.is_a?(String)
222
+ if on_start
223
+ input_meta = if @input.is_a?(String)
224
224
  { input: @input, file_size: (File.size(@input) rescue nil) }
225
225
  else
226
226
  { input: @input.class.name, file_size: nil }
227
- end
228
- _on_start.call(_input_meta.merge(col_sep: options[:col_sep], row_sep: options[:row_sep]))
227
+ end
228
+ on_start.call(input_meta.merge(col_sep: options[:col_sep], row_sep: options[:row_sep]))
229
229
  end
230
230
 
231
231
  # now on to processing all the rest of the lines in the CSV file:
@@ -385,7 +385,7 @@ module SmarterCSV
385
385
  chunk << hash # append temp result to chunk
386
386
 
387
387
  if chunk.size >= chunk_size || fh.eof? # if chunk if full, or EOF reached
388
- _on_chunk&.call({ chunk_number: @chunk_count + 1, rows_in_chunk: chunk.size, total_rows_so_far: @csv_line_count })
388
+ on_chunk&.call({ chunk_number: @chunk_count + 1, rows_in_chunk: chunk.size, total_rows_so_far: @csv_line_count })
389
389
  # do something with the chunk
390
390
  if block_given?
391
391
  yield chunk, @chunk_count # do something with the hashes in the chunk in the block
@@ -414,7 +414,7 @@ module SmarterCSV
414
414
 
415
415
  # handling of last chunk:
416
416
  if !chunk.nil? && chunk.size > 0
417
- _on_chunk&.call({ chunk_number: @chunk_count + 1, rows_in_chunk: chunk.size, total_rows_so_far: @csv_line_count })
417
+ on_chunk&.call({ chunk_number: @chunk_count + 1, rows_in_chunk: chunk.size, total_rows_so_far: @csv_line_count })
418
418
  # do something with the chunk
419
419
  if block_given?
420
420
  yield chunk, @chunk_count # do something with the hashes in the chunk in the block
@@ -425,13 +425,13 @@ module SmarterCSV
425
425
  # chunk = [] # initialize for next chunk of data
426
426
  end
427
427
 
428
- if _on_complete
429
- _on_complete.call({
430
- total_rows: @csv_line_count,
431
- total_chunks: @chunk_count,
432
- duration: Process.clock_gettime(Process::CLOCK_MONOTONIC) - _start_time,
433
- bad_rows: @errors[:bad_row_count] || 0,
434
- })
428
+ if on_complete
429
+ on_complete.call({
430
+ total_rows: @csv_line_count,
431
+ total_chunks: @chunk_count,
432
+ duration: Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time,
433
+ bad_rows: @errors[:bad_row_count] || 0,
434
+ })
435
435
  end
436
436
  ensure
437
437
  fh.close if fh.respond_to?(:close)
@@ -662,12 +662,10 @@ module SmarterCSV
662
662
  # else: mid-field quote → literal, no state change
663
663
  elsif !in_quotes
664
664
  # Non-quote character: track whether field has started
665
- if strip
666
- # rubocop:disable Style/MultipleComparison -- two direct == comparisons are faster than Array#include? in this hot loop
665
+ if strip # -- two direct == comparisons are faster than Array#include? in this hot loop
667
666
  field_started = true unless line[i] == ' ' || line[i] == "\t"
668
- # rubocop:enable Style/MultipleComparison
669
- else
670
- field_started = true
667
+ else
668
+ field_started = true
671
669
  end
672
670
  end
673
671
  i += 1
@@ -780,9 +778,13 @@ module SmarterCSV
780
778
  end
781
779
 
782
780
  def enforce_utf8_encoding(line, options)
783
- # return line unless options[:force_utf8] || options[:file_encoding] !~ /utf-8/i
784
-
785
- line.force_encoding('utf-8').encode('utf-8', invalid: :replace, undef: :replace, replace: options[:invalid_byte_sequence])
781
+ replace = options[:invalid_byte_sequence]
782
+ # ASCII_8BIT (Encoding::BINARY is an alias) has no codepoint mapping above 0x7F,
783
+ # so encode('utf-8', ASCII_8BIT) would replace every non-ASCII byte. Relabel as
784
+ # UTF-8 first so encode() treats the bytes as already-UTF-8 and only replaces
785
+ # sequences that are actually invalid.
786
+ line = line.force_encoding('utf-8') if line.encoding == Encoding::ASCII_8BIT
787
+ line.encode('utf-8', line.encoding, invalid: :replace, undef: :replace, replace: replace)
786
788
  end
787
789
 
788
790
  def handle_bad_row(error, line, start_csv_line, start_file_line, options)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmarterCSV
4
- VERSION = "1.16.3"
4
+ VERSION = "1.16.5"
5
5
  end
data/lib/smarter_csv.rb CHANGED
@@ -78,9 +78,12 @@ module SmarterCSV
78
78
  def self.process(input, given_options = {}, &block)
79
79
  Thread.current[:current_thread_recent_errors] = {}
80
80
  reader = Reader.new(input, given_options)
81
- result = reader.process(&block)
82
- Thread.current[:current_thread_recent_errors] = reader.errors
83
- result
81
+ reader.process(&block)
82
+ ensure
83
+ # Preserve partial error state when processing raises mid-stream
84
+ # (e.g. TooManyBadRows, or a user block raising). `reader` is nil if
85
+ # Reader.new itself raised before the local was assigned.
86
+ Thread.current[:current_thread_recent_errors] = reader.errors if reader
84
87
  end
85
88
 
86
89
  # Convenience method for parsing a CSV string directly.
@@ -109,9 +112,9 @@ module SmarterCSV
109
112
  def self.each(input, options = {}, &block)
110
113
  Thread.current[:current_thread_recent_errors] = {}
111
114
  reader = Reader.new(input, options)
112
- result = reader.each(&block)
113
- Thread.current[:current_thread_recent_errors] = reader.errors
114
- result
115
+ reader.each(&block)
116
+ ensure
117
+ Thread.current[:current_thread_recent_errors] = reader.errors if reader
115
118
  end
116
119
 
117
120
  # Yields each chunk as Array<Hash> plus its 0-based chunk index.
@@ -126,9 +129,9 @@ module SmarterCSV
126
129
  def self.each_chunk(input, options = {}, &block)
127
130
  Thread.current[:current_thread_recent_errors] = {}
128
131
  reader = Reader.new(input, options)
129
- result = reader.each_chunk(&block)
130
- Thread.current[:current_thread_recent_errors] = reader.errors
131
- result
132
+ reader.each_chunk(&block)
133
+ ensure
134
+ Thread.current[:current_thread_recent_errors] = reader.errors if reader
132
135
  end
133
136
 
134
137
  # Returns the errors from the most recent call to .process, .parse, .each, or .each_chunk
@@ -198,7 +201,7 @@ module SmarterCSV
198
201
  begin
199
202
  yield writer
200
203
  ensure
201
- writer&.finalize # must finalize before reading io.string
204
+ writer&.finalize # must finalize before reading io.string
202
205
  end
203
206
  io.string
204
207
  else
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smarter_csv
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.3
4
+ version: 1.16.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilo Sloboda
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-04-14 00:00:00.000000000 Z
10
+ date: 2026-05-17 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: |
13
13
  SmarterCSV is a high-performance CSV reader and writer for Ruby focused on
@@ -62,7 +62,6 @@ files:
62
62
  - docs/row_col_sep.md
63
63
  - docs/ruby_csv_pitfalls.md
64
64
  - docs/value_converters.md
65
- - ext/smarter_csv/Makefile
66
65
  - ext/smarter_csv/extconf.rb
67
66
  - ext/smarter_csv/smarter_csv.c
68
67
  - images/SmarterCSV_1.16.0_vs_RubyCSV_3.3.5_speedup.png
@@ -110,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
109
  - !ruby/object:Gem::Version
111
110
  version: '0'
112
111
  requirements: []
113
- rubygems_version: 4.0.6
112
+ rubygems_version: 4.0.11
114
113
  specification_version: 4
115
114
  summary: Fastest end-to-end CSV ingestion for Ruby with smart defaults and Rails-ready
116
115
  hash output
@@ -1,270 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- # V=0 quiet, V=1 verbose. other values don't work.
5
- V = 0
6
- V0 = $(V:0=)
7
- Q1 = $(V:1=)
8
- Q = $(Q1:0=@)
9
- ECHO1 = $(V:1=@ :)
10
- ECHO = $(ECHO1:0=@ echo)
11
- NULLCMD = :
12
-
13
- #### Start of system configuration section. ####
14
-
15
- srcdir = .
16
- topdir = /Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0
17
- hdrdir = $(topdir)
18
- arch_hdrdir = /Users/tilo/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/arm64-darwin23
19
- PATH_SEPARATOR = :
20
- VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
21
- prefix = $(DESTDIR)/Users/tilo/.rvm/rubies/ruby-3.2.2
22
- rubysitearchprefix = $(rubylibprefix)/$(sitearch)
23
- rubyarchprefix = $(rubylibprefix)/$(arch)
24
- rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
25
- exec_prefix = $(prefix)
26
- vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
27
- sitearchhdrdir = $(sitehdrdir)/$(sitearch)
28
- rubyarchhdrdir = $(rubyhdrdir)/$(arch)
29
- vendorhdrdir = $(rubyhdrdir)/vendor_ruby
30
- sitehdrdir = $(rubyhdrdir)/site_ruby
31
- rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
32
- vendorarchdir = $(vendorlibdir)/$(sitearch)
33
- vendorlibdir = $(vendordir)/$(ruby_version)
34
- vendordir = $(rubylibprefix)/vendor_ruby
35
- sitearchdir = $(sitelibdir)/$(sitearch)
36
- sitelibdir = $(sitedir)/$(ruby_version)
37
- sitedir = $(rubylibprefix)/site_ruby
38
- rubyarchdir = $(rubylibdir)/$(arch)
39
- rubylibdir = $(rubylibprefix)/$(ruby_version)
40
- sitearchincludedir = $(includedir)/$(sitearch)
41
- archincludedir = $(includedir)/$(arch)
42
- sitearchlibdir = $(libdir)/$(sitearch)
43
- archlibdir = $(libdir)/$(arch)
44
- ridir = $(datarootdir)/$(RI_BASE_NAME)
45
- mandir = $(datarootdir)/man
46
- localedir = $(datarootdir)/locale
47
- libdir = $(exec_prefix)/lib
48
- psdir = $(docdir)
49
- pdfdir = $(docdir)
50
- dvidir = $(docdir)
51
- htmldir = $(docdir)
52
- infodir = $(datarootdir)/info
53
- docdir = $(datarootdir)/doc/$(PACKAGE)
54
- oldincludedir = $(DESTDIR)/usr/include
55
- includedir = $(SDKROOT)$(prefix)/include
56
- runstatedir = $(localstatedir)/run
57
- localstatedir = $(prefix)/var
58
- sharedstatedir = $(prefix)/com
59
- sysconfdir = $(prefix)/etc
60
- datadir = $(datarootdir)
61
- datarootdir = $(prefix)/share
62
- libexecdir = $(exec_prefix)/libexec
63
- sbindir = $(exec_prefix)/sbin
64
- bindir = $(exec_prefix)/bin
65
- archdir = $(rubyarchdir)
66
-
67
-
68
- CC_WRAPPER =
69
- CC = gcc
70
- CXX = g++
71
- LIBRUBY = $(LIBRUBY_SO)
72
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
73
- LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
74
- LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework CoreFoundation $(MAINLIBS)
75
- empty =
76
- OUTFLAG = -o $(empty)
77
- COUTFLAG = -o $(empty)
78
- CSRCFLAG = $(empty)
79
-
80
- RUBY_EXTCONF_H =
81
- cflags = -fdeclspec $(optflags) $(debugflags) $(warnflags)
82
- cxxflags =
83
- optflags = -O3
84
- debugflags = -ggdb3
85
- warnflags = -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wundef
86
- cppflags =
87
- CCDLFLAGS = -fno-common
88
- CFLAGS = $(CCDLFLAGS) -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include $(cflags) -fno-common -pipe $(ARCH_FLAG)
89
- INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
90
- DEFS =
91
- CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
92
- CXXFLAGS = $(CCDLFLAGS) -fdeclspec $(ARCH_FLAG)
93
- ldflags = -L. -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -fstack-protector-strong
94
- dldflags = -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -Wl,-undefined,dynamic_lookup $(LIBRUBYARG_SHARED)
95
- ARCH_FLAG =
96
- DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
97
- LDSHARED = $(CC) -dynamic -bundle
98
- LDSHAREDXX = $(CXX) -dynamic -bundle
99
- AR = ar
100
- EXEEXT =
101
-
102
- RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
103
- RUBY_SO_NAME = ruby.3.2
104
- RUBYW_INSTALL_NAME =
105
- RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
106
- RUBYW_BASE_NAME = rubyw
107
- RUBY_BASE_NAME = ruby
108
-
109
- arch = arm64-darwin23
110
- sitearch = $(arch)
111
- ruby_version = 3.2.0
112
- ruby = $(bindir)/$(RUBY_BASE_NAME)
113
- RUBY = $(ruby)
114
- BUILTRUBY = $(bindir)/$(RUBY_BASE_NAME)
115
- 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
116
-
117
- RM = rm -f
118
- RM_RF = rm -fr
119
- RMDIRS = rmdir -p
120
- MAKEDIRS = /opt/homebrew/opt/coreutils/bin/gmkdir -p
121
- INSTALL = /opt/homebrew/opt/coreutils/bin/ginstall -c
122
- INSTALL_PROG = $(INSTALL) -m 0755
123
- INSTALL_DATA = $(INSTALL) -m 644
124
- COPY = cp
125
- TOUCH = exit >
126
-
127
- #### End of system configuration section. ####
128
-
129
- preload =
130
- libpath = . $(libdir)
131
- LIBPATH = -L. -L$(libdir)
132
- DEFFILE =
133
-
134
- CLEANFILES = mkmf.log
135
- DISTCLEANFILES =
136
- DISTCLEANDIRS =
137
-
138
- extout =
139
- extout_prefix =
140
- target_prefix = /smarter_csv
141
- LOCAL_LIBS =
142
- LIBS = $(LIBRUBYARG_SHARED) -lpthread
143
- ORIG_SRCS = smarter_csv.c
144
- SRCS = $(ORIG_SRCS)
145
- OBJS = smarter_csv.o
146
- HDRS =
147
- LOCAL_HDRS =
148
- TARGET = smarter_csv
149
- TARGET_NAME = smarter_csv
150
- TARGET_ENTRY = Init_$(TARGET_NAME)
151
- DLLIB = $(TARGET).bundle
152
- EXTSTATIC =
153
- STATIC_LIB =
154
-
155
- TIMESTAMP_DIR = .
156
- BINDIR = $(bindir)
157
- RUBYCOMMONDIR = $(sitedir)$(target_prefix)
158
- RUBYLIBDIR = $(sitelibdir)$(target_prefix)
159
- RUBYARCHDIR = $(sitearchdir)$(target_prefix)
160
- HDRDIR = $(sitehdrdir)$(target_prefix)
161
- ARCHHDRDIR = $(sitearchhdrdir)$(target_prefix)
162
- TARGET_SO_DIR =
163
- TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
164
- CLEANLIBS = $(TARGET_SO) $(TARGET_SO).dSYM
165
- CLEANOBJS = $(OBJS) *.bak
166
- TARGET_SO_DIR_TIMESTAMP = $(TIMESTAMP_DIR)/.sitearchdir.-.smarter_csv.time
167
-
168
- all: $(DLLIB)
169
- static: $(STATIC_LIB)
170
- .PHONY: all install static install-so install-rb
171
- .PHONY: clean clean-so clean-static clean-rb
172
-
173
- clean-static::
174
- clean-rb-default::
175
- clean-rb::
176
- clean-so::
177
- clean: clean-so clean-static clean-rb-default clean-rb
178
- -$(Q)$(RM_RF) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
179
-
180
- distclean-rb-default::
181
- distclean-rb::
182
- distclean-so::
183
- distclean-static::
184
- distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
185
- -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
186
- -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
187
- -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
188
-
189
- realclean: distclean
190
- install: install-so install-rb
191
-
192
- install-so: $(DLLIB) $(TARGET_SO_DIR_TIMESTAMP)
193
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
194
- clean-static::
195
- -$(Q)$(RM) $(STATIC_LIB)
196
- install-rb: pre-install-rb do-install-rb install-rb-default
197
- install-rb-default: pre-install-rb-default do-install-rb-default
198
- pre-install-rb: Makefile
199
- pre-install-rb-default: Makefile
200
- do-install-rb:
201
- do-install-rb-default:
202
- pre-install-rb-default:
203
- @$(NULLCMD)
204
- $(TARGET_SO_DIR_TIMESTAMP):
205
- $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
206
- $(Q) $(TOUCH) $@
207
-
208
- site-install: site-install-so site-install-rb
209
- site-install-so: install-so
210
- site-install-rb: install-rb
211
-
212
- .SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
213
-
214
- .cc.o:
215
- $(ECHO) compiling $(<)
216
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
217
-
218
- .cc.S:
219
- $(ECHO) translating $(<)
220
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
221
-
222
- .mm.o:
223
- $(ECHO) compiling $(<)
224
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
225
-
226
- .mm.S:
227
- $(ECHO) translating $(<)
228
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
229
-
230
- .cxx.o:
231
- $(ECHO) compiling $(<)
232
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
233
-
234
- .cxx.S:
235
- $(ECHO) translating $(<)
236
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
237
-
238
- .cpp.o:
239
- $(ECHO) compiling $(<)
240
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
241
-
242
- .cpp.S:
243
- $(ECHO) translating $(<)
244
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
245
-
246
- .c.o:
247
- $(ECHO) compiling $(<)
248
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
249
-
250
- .c.S:
251
- $(ECHO) translating $(<)
252
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
253
-
254
- .m.o:
255
- $(ECHO) compiling $(<)
256
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
257
-
258
- .m.S:
259
- $(ECHO) translating $(<)
260
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
261
-
262
- $(TARGET_SO): $(OBJS) Makefile
263
- $(ECHO) linking shared-object smarter_csv/$(DLLIB)
264
- -$(Q)$(RM) $(@)
265
- $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
266
- $(Q) $(POSTLINK)
267
-
268
-
269
-
270
- $(OBJS): $(HDRS) $(ruby_headers)