aboutsummaryrefslogtreecommitdiff
path: root/share/autoinclude/general-rules.bld
diff options
context:
space:
mode:
Diffstat (limited to 'share/autoinclude/general-rules.bld')
-rw-r--r--share/autoinclude/general-rules.bld166
1 files changed, 83 insertions, 83 deletions
diff --git a/share/autoinclude/general-rules.bld b/share/autoinclude/general-rules.bld
index 6c0df30..0e4f0b4 100644
--- a/share/autoinclude/general-rules.bld
+++ b/share/autoinclude/general-rules.bld
@@ -6,151 +6,151 @@
6 6
7if CXX == null then 7if CXX == null then
8{ 8{
9 CXX = "g++"; 9 CXX = "g++";
10} 10}
11 11
12if AR == null then 12if AR == null then
13{ 13{
14 AR = "ar"; 14 AR = "ar";
15} 15}
16 16
17if CC == null then 17if CC == null then
18{ 18{
19 CC = "cc"; 19 CC = "cc";
20} 20}
21 21
22if BISON == null then 22if BISON == null then
23{ 23{
24 BISON = "bison"; 24 BISON = "bison";
25} 25}
26 26
27if FLEX == null then 27if FLEX == null then
28{ 28{
29 FLEX = "flex"; 29 FLEX = "flex";
30} 30}
31 31
32function cppToObj() 32function cppToObj()
33{ 33{
34 if OBJ_DIR == null then 34 if OBJ_DIR == null then
35 { 35 {
36 return INPUT.regex("\\.cpp$", ".o"); 36 return INPUT.regex("\\.cpp$", ".o");
37 } 37 }
38 else 38 else
39 { 39 {
40 return OBJ_DIR + "/" + INPUT.fileName().regex("\\.cpp$", ".o"); 40 return OBJ_DIR + "/" + INPUT.fileName().regex("\\.cpp$", ".o");
41 } 41 }
42 42
43} 43}
44 44
45function cToObj() 45function cToObj()
46{ 46{
47 if OBJ_DIR == null then 47 if OBJ_DIR == null then
48 { 48 {
49 return INPUT.regex("\\.c$", ".o"); 49 return INPUT.regex("\\.c$", ".o");
50 } 50 }
51 else 51 else
52 { 52 {
53 return OBJ_DIR + "/" + INPUT.fileName().regex("\\.c$", ".o"); 53 return OBJ_DIR + "/" + INPUT.fileName().regex("\\.c$", ".o");
54 } 54 }
55 55
56} 56}
57 57
58rule "exe" 58rule "exe"
59{ 59{
60 input "*.o"; 60 input "*.o";
61 profile "build" 61 profile "build"
62 { 62 {
63 INPUT = [INPUT].unique().matches("*.o"); 63 INPUT = [INPUT].unique().matches("*.o");
64 execute("${CXX} -o ${OUTPUT} ${INPUT} ${LDFLAGS}"); 64 execute("${CXX} -o ${OUTPUT} ${INPUT} ${LDFLAGS}");
65 } 65 }
66} 66}
67 67
68rule "so" 68rule "so"
69{ 69{
70 input "*.o"; 70 input "*.o";
71 profile "build" 71 profile "build"
72 { 72 {
73 INPUT = [INPUT].unique().matches("*.o"); 73 INPUT = [INPUT].unique().matches("*.o");
74 execute("${CXX} -shared -o ${OUTPUT} ${INPUT} ${LDFLAGS}"); 74 execute("${CXX} -shared -o ${OUTPUT} ${INPUT} ${LDFLAGS}");
75 } 75 }
76} 76}
77 77
78rule "lib" 78rule "lib"
79{ 79{
80 input "*.o"; 80 input "*.o";
81 profile "build" 81 profile "build"
82 { 82 {
83 INPUT = [INPUT].unique().matches("*.o"); 83 INPUT = [INPUT].unique().matches("*.o");
84 execute("${AR} cr ${OUTPUT} ${INPUT}"); 84 execute("${AR} cr ${OUTPUT} ${INPUT}");
85 } 85 }
86} 86}
87 87
88rule "cpp" 88rule "cpp"
89{ 89{
90 input "*.cpp"; 90 input "*.cpp";
91 output INPUT.cppToObj(); 91 output INPUT.cppToObj();
92 requires getMakeDeps("${CXX} ${CXXFLAGS} -M -MG ${INPUT}"); 92 requires getMakeDeps("${CXX} ${CXXFLAGS} -M -MG ${INPUT}");
93 profile "build" 93 profile "build"
94 { 94 {
95 execute("${CXX} ${CXXFLAGS} -c -o ${OUTPUT} ${INPUT}", "g++"); 95 execute("${CXX} ${CXXFLAGS} -c -o ${OUTPUT} ${INPUT}", "g++");
96 } 96 }
97} 97}
98 98
99// Heh, we're not going to use this one. 99// Heh, we're not going to use this one.
100rule "c" 100rule "c"
101{ 101{
102 input "*.c"; 102 input "*.c";
103 output INPUT.cToObj(); 103 output INPUT.cToObj();
104 requires getMakeDeps("${CC} ${CFLAGS} -M -MG ${INPUT}"); 104 requires getMakeDeps("${CC} ${CFLAGS} -M -MG ${INPUT}");
105 profile "build" 105 profile "build"
106 { 106 {
107 execute("${CC} ${CFLAGS} -c -o ${OUTPUT} ${INPUT}"); 107 execute("${CC} ${CFLAGS} -c -o ${OUTPUT} ${INPUT}");
108 } 108 }
109} 109}
110 110
111rule "bison" 111rule "bison"
112{ 112{
113 input "*.y"; 113 input "*.y";
114 output [INPUT.regex("\\.y$", ".tab.c"), INPUT.regex("\\.y$", ".tab.h")]; 114 output [INPUT.regex("\\.y$", ".tab.c"), INPUT.regex("\\.y$", ".tab.h")];
115 profile "build" 115 profile "build"
116 { 116 {
117 BASE = INPUT.regex("\\.y", ""); 117 BASE = INPUT.regex("\\.y", "");
118 execute("${BISON} -b${BASE} ${BISONFLAGS} ${INPUT}"); 118 execute("${BISON} -b${BASE} ${BISONFLAGS} ${INPUT}");
119 // if you add a -v bison will produce a .output file 119 // if you add a -v bison will produce a .output file
120 } 120 }
121} 121}
122 122
123rule "flex" 123rule "flex"
124{ 124{
125 input "*.l"; 125 input "*.l";
126 output INPUT.regex("\\.l$", ".yy.c"); 126 output INPUT.regex("\\.l$", ".yy.c");
127 output INPUT.regex("\\.l$", ".yy.h"); 127 output INPUT.regex("\\.l$", ".yy.h");
128 profile "build" 128 profile "build"
129 { 129 {
130 execute("${FLEX} ${FLEXFLAGS} ${INPUT}"); 130 execute("${FLEX} ${FLEXFLAGS} ${INPUT}");
131 } 131 }
132} 132}
133 133
134rule "jar" 134rule "jar"
135{ 135{
136 input "*.class"; 136 input "*.class";
137 profile "build" 137 profile "build"
138 { 138 {
139 if exists(OUTPUT) then 139 if exists(OUTPUT) then
140 { 140 {
141 unlink(OUTPUT); 141 unlink(OUTPUT);
142 } 142 }
143 execute("jar cf ${OUTPUT} ${INPUT}"); 143 execute("jar cf ${OUTPUT} ${INPUT}");
144 } 144 }
145} 145}
146 146
147rule "class" 147rule "class"
148{ 148{
149 input "*.java"; 149 input "*.java";
150 output INPUT.regex("\\.java", ".class"); 150 output INPUT.regex("\\.java", ".class");
151 profile "build" 151 profile "build"
152 { 152 {
153 execute("javac -cp . ${INPUT}"); 153 execute("javac -cp . ${INPUT}");
154 } 154 }
155} 155}
156 156