iTranslated by AI
The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
💭
Editing Makefiles in extconf.rb
When you call create_makefile(libname) within extconf.rb, a Makefile is generated. When I wanted to edit it, I had always been opening the file with File.open("Makefile", "a") to make changes, but it turns out you can pass a block to create_makefile and edit it within that block.
extconf.rb
create_makefile libname do |conf|
# conf is the content of the Makefile. The return value is used as the Makefile content.
conf << <<~EOS
# append some code
EOS
end
I submitted a pull request to Rurema: https://github.com/rurema/doctree/pull/2957
Discussion