breakout_parser 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ lex.yy.o: lex.yy.c parser.tab.h
2
+ parser.tab.o: parser.tab.c
3
+ ruby_ext.o: ruby_ext.c
4
+ yywrap.o: yywrap.c
@@ -1,10 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ windows = RUBY_PLATFORM =~ /(mswin|mingw)/i
4
+
3
5
  require 'mkmf'
4
6
  extension_name = 'breakout_parser'
5
7
 
6
8
  $defs << %[-DRUBY_VERSION=\\"#{RUBY_VERSION}\\"]
7
- $srcs = %w'lex.yy.c main.c parser.tab.c ruby_ext.c yywrap.c'
9
+ $objs = %w'lex.yy.o parser.tab.o ruby_ext.o yywrap.o'
8
10
 
9
11
  dir_config(extension_name)
10
12
  if RUBY_PLATFORM['mswin32']
@@ -12,5 +14,13 @@ if RUBY_PLATFORM['mswin32']
12
14
  end
13
15
  create_makefile(([extension_name]*2).join('/'))
14
16
 
15
- p $objs
16
- p $srcs
17
+ if !windows && File.exist?('Makefile') && find_executable('bison') && find_executable('lex')
18
+ File.open('Makefile','a') do |f|
19
+ f.puts
20
+ f.puts "parser.tab.c parser.tab.h: parser.y"
21
+ f.puts "\tbison -d parser.y"
22
+ f.puts
23
+ f.puts "lex.yy.c: parser.l"
24
+ f.puts "\tlex parser.l"
25
+ end
26
+ end