-
-
Save suhovius/0f42fff048226b318e061cc8bf3470c8 to your computer and use it in GitHub Desktop.
Automatically include/compile all Ruby C extension source files (including subdirectories) using mkmf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "mkmf" | |
ext_name = 'my_extension' | |
excluded = ['x86', 'x64'] | |
dir_config(ext_name) | |
$srcs = Dir.glob("#{$srcdir}/**/*.c").map { |path| File.basename(path) } | |
Dir.glob("#{$srcdir}/*/") do |path| | |
dir = File.basename(path) | |
next if excluded.include?(dir) | |
$VPATH << "$(srcdir)/#{dir}" | |
$INCFLAGS << " -I$(srcdir)/#{dir}" | |
end | |
create_makefile(ext_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment