comparison src/luan/modules/mmake.luan @ 1385:4d6c1bb8f975

fix mmake
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 22 Aug 2019 11:56:25 -0600
parents 1a68fc55a80c
children b82767112d8e
comparison
equal deleted inserted replaced
1384:f5368cd8c056 1385:4d6c1bb8f975
1 local Luan = require "luan:Luan.luan" 1 local Luan = require "luan:Luan.luan"
2 local ipairs = Luan.ipairs 2 local ipairs = Luan.ipairs
3 local Table = require "luan:Table.luan" 3 local Table = require "luan:Table.luan"
4 local Io = require "luan:Io.luan" 4 local Io = require "luan:Io.luan"
5 local print = Io.print 5 local print = Io.print
6 local output_to = Io.output_to
6 local String = require "luan:String.luan" 7 local String = require "luan:String.luan"
7 local Time = require "luan:Time.luan" 8 local Time = require "luan:Time.luan"
8 9
9 10
10 local compiler = Table.concat( { "javac -g -encoding UTF8", ... }, " " ) 11 local compiler = Table.concat( { "javac -g -encoding UTF8", ... }, " " )
11 12
12 13
13 local function header() 14 local function header()
14 return %> 15 %>
15 # Makefile created on <%=Time.format(Time.now())%> by Mmake 16 # Makefile created on <%=Time.format(Time.now())%> by Mmake
16 17
17 .SUFFIXES: .java .class 18 .SUFFIXES: .java .class
18 19
19 .java.class: 20 .java.class:
37 end 38 end
38 if #javas == 0 and #dirs == 0 then 39 if #javas == 0 and #dirs == 0 then
39 return false; 40 return false;
40 end 41 end
41 local out = dir.child("Makefile").text_writer() 42 local out = dir.child("Makefile").text_writer()
42 out.write( header() ) 43 output_to(out,header)
43 for _, s in ipairs(javas) do 44 for _, s in ipairs(javas) do
44 s = String.gsub(s,[[\$]],[[\$\$]]) 45 s = String.gsub(s,[[\$]],[[\$\$]])
45 out.write( "\\\n\t\t", s , ".class" ) 46 out.write( "\\\n\t\t", s , ".class" )
46 end 47 end
47 for _, s in ipairs(dirs) do 48 for _, s in ipairs(dirs) do