-
Notifications
You must be signed in to change notification settings - Fork 0
/
remake.r
executable file
·105 lines (87 loc) · 1.88 KB
/
remake.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
REBOL [
Title: "Generate the Makefile"
Author: "Gabriele Santilli"
]
conf: context [
rebol: rebview: none
]
if exists? %.conf [
attempt [conf: construct/with load %.conf conf]
]
.hgignore: {.*~$
.*\.swp$
^^index.(rlp|html)$
^^Makefile$
^^output.r$
^^test.html$
^^.conf$
^^tools/last-file.tmp$
^^tests/data/[ab]$
^^benchs/results
}
ask-default: func [question default] [
question: ask join question [" [" default "]: "]
either empty? question [default] [question]
]
unless conf/rebol [
conf/rebol: ask "Path to REBOL: "
]
unless conf/rebview [
conf/rebview: ask-default "Path to REBOL/View" conf/rebol
]
files: [ ]
collect-rlps: func [dir] [
foreach file read dir [
file: dir/:file
either dir? file [
collect-rlps file
] [
if %.rlp = suffix? file [append files copy/part file skip tail file -4]
]
]
]
foreach dir read %./ [
if dir? dir [
collect-rlps dir
]
]
foreach file sort files [
repend .hgignore [
#"^^" file ".html$" newline
#"^^" file ".r$" newline
]
]
write %.hgignore .hgignore
makefile: {# Makefile generated by remake.r
}
repend makefile [
{REBOL = "} conf/rebol {"} newline
{REBVIEW = "} conf/rebview {"} newline
"WETAN = ${REBVIEW} -qws tools/wetan-test.r" newline
newline
]
append makefile {all:}
foreach file files [append makefile reduce [#" " file %.r]]
append makefile { index.html
Makefile: */*.rlp */*/*.rlp remake.r
${REBOL} -qws remake.r
index.html: index.rlp
${WETAN} `pwd`/index.rlp
index.rlp: */*.rlp */*/*.rlp mkindex.r index-template.rlp
${REBOL} -qws mkindex.r
tests: all
${REBVIEW} -qws tests/run.r
all-tests: all
${REBVIEW} -qws tests/run.r force
benchs: all
${REBVIEW} -qws benchs/run.r
}
foreach file files [
append makefile reduce [
file {.r: } file {.rlp} newline
tab {${WETAN} `pwd`/} file {.rlp} newline
newline
]
]
write %Makefile makefile
save/all %.conf third conf