Created
October 3, 2018 18:42
-
-
Save ForeverZer0/2bec871e61c3fc6be59969b1b02459c5 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