Permalink
Browse files

Rewrite preprocess.mk to be bundler-based.

1 parent 8a3d2ff commit 5ae93dc8254079f067c968206d4aef8c79d5c377 @moriyoshi moriyoshi committed Apr 3, 2011
Showing with 13 additions and 45 deletions.
  1. +3 −0 idl/Gemfile
  2. +0 −20 idl/Makefile.am
  3. +10 −25 idl/preprocess.mk
View
3 idl/Gemfile
@@ -0,0 +1,3 @@
+source :rubygems
+gem "mplex"
+gem "treetop"
View
20 idl/Makefile.am
@@ -35,24 +35,6 @@ LANG_DIST = \
$(RUBY_DIST) \
$(JAVA_DIST)
-RUBYLIB = \
- rubylib/treetop.rb \
- rubylib/treetop/README.md \
- rubylib/treetop/LICENSE \
- rubylib/treetop/runtime.rb \
- rubylib/treetop/ruby_extensions.rb \
- rubylib/treetop/ruby_extensions/string.rb \
- rubylib/treetop/runtime/compiled_parser.rb \
- rubylib/treetop/runtime/interval_skip_list.rb \
- rubylib/treetop/runtime/syntax_node.rb \
- rubylib/treetop/runtime/terminal_parse_failure.rb \
- rubylib/treetop/runtime/terminal_parse_failure_debug.rb \
- rubylib/treetop/runtime/terminal_syntax_node.rb \
- rubylib/treetop/runtime/interval_skip_list/head_node.rb \
- rubylib/treetop/runtime/interval_skip_list/interval_skip_list.rb \
- rubylib/treetop/runtime/interval_skip_list/node.rb \
- rubylib/rubygems
-
msgpack-idl:
echo '#!$(RUBY_PATH)' > $@
echo '$$LOAD_PATH.unshift("$(pkgdatadir)/rubylib")' >> $@
@@ -67,7 +49,6 @@ msgpack_idldir = $(pkgdatadir)
nobase_msgpack_idl_DATA = \
$(LANG_DIST) \
- $(RUBYLIB) \
command.rb
corelibdir = $(pkgdatadir)/rubylib
@@ -79,7 +60,6 @@ corelib_DATA = \
EXTRA_DIST = \
$(LANG_DIST) \
- $(RUBYLIB) \
$(DOC_FILES) \
$(corelib_DATA) \
command.rb
View
35 idl/preprocess.mk
@@ -1,37 +1,22 @@
-RUBY=ruby
-TTVER=treetop-1.4.8
+BUNDLE=bundle
+VENDOR_BUNDLE_DIR=vendor/bundle
all: parser.rb
-TTURL = http://rubygems.org/downloads/$(TTVER).gem
+$(VENDOR_BUNDLE_DIR): Gemfile
+ $(BUNDLE) install --path $(VENDOR_BUNDLE_DIR)
-$(TTVER).gem:
- wget $(TTURL) || curl -O $(TTURL) || fetch $(TTURL)
+parser.tt: parser.tt.mpl mplex.rb $(VENDOR_BUNDLE_DIR)
+ $(BUNDLE) exec mplex -o $@ $<
-$(TTVER)/bin/tt: $(TTVER).gem
- mkdir -p $(TTVER)
- cd $(TTVER) && tar xvf ../$(TTVER).gem
- cd $(TTVER) && tar zxvf data.tar.gz
- touch $@
-
-rubylib/rubygems: $(TTVER)/bin/tt
- mkdir -p rubylib
- cp -rf $(TTVER)/lib/* rubylib/
- cp -rf $(TTVER)/README.md rubylib/treetop/
- cp -rf $(TTVER)/LICENSE rubylib/treetop/
- echo "# dummy" > $@
-
-parser.tt: parser.tt.mpl mplex.rb
- $(RUBY) -rmplex -e 'Mplex.write("parser.tt.mpl", "$@")'
-
-parser.rb: $(TTVER)/bin/tt parser.tt rubylib/rubygems
- $(RUBY) -I$(TTVER)/lib $(TTVER)/bin/tt -o $@ parser.tt
+parser.rb: parser.tt $(VENDOR_BUNDLE_DIR)
+ $(BUNDLE) exec tt -o $@ parser.tt
clean:
- rm -rf $(TTVER) rubylib parser.tt parser.rb
+ rm -rf parser.tt parser.rb
distclean: clean
- rm -rf $(TTVER).gem
+ rm -rf $(VENDOR_BUNDLE_DIR)
.PHONY: all clean distclean

0 comments on commit 5ae93dc

Please sign in to comment.