diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-12-21 18:59:32 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-12-21 18:59:32 +0000 |
commit | 8ebc3f17961ef6a0cf708cc6bdca948d77817ee0 (patch) | |
tree | bab53e5e249dc4eab4904a5a4519b372245eee53 /share/autoinclude/general-rules.bld | |
parent | 0bcd7aeb48055e74203332851ce51ea55335d135 (diff) | |
download | build-8ebc3f17961ef6a0cf708cc6bdca948d77817ee0.tar.gz build-8ebc3f17961ef6a0cf708cc6bdca948d77817ee0.tar.bz2 build-8ebc3f17961ef6a0cf708cc6bdca948d77817ee0.tar.xz build-8ebc3f17961ef6a0cf708cc6bdca948d77817ee0.zip |
Wow, it's much more general now, I like that.
Diffstat (limited to 'share/autoinclude/general-rules.bld')
-rw-r--r-- | share/autoinclude/general-rules.bld | 80 |
1 files changed, 70 insertions, 10 deletions
diff --git a/share/autoinclude/general-rules.bld b/share/autoinclude/general-rules.bld index 16217e0..46720c6 100644 --- a/share/autoinclude/general-rules.bld +++ b/share/autoinclude/general-rules.bld | |||
@@ -1,10 +1,68 @@ | |||
1 | // | ||
2 | // Really, variables here should default to something that's platform dependant, | ||
3 | // but for now, we use linux, I'll default them to gnu/linux | ||
4 | // | ||
5 | |||
6 | |||
7 | if CXX == null then | ||
8 | { | ||
9 | CXX = "g++"; | ||
10 | } | ||
11 | |||
12 | if AR == null then | ||
13 | { | ||
14 | AR = "ar"; | ||
15 | } | ||
16 | |||
17 | if CC == null then | ||
18 | { | ||
19 | CC = "cc"; | ||
20 | } | ||
21 | |||
22 | if BISON == null then | ||
23 | { | ||
24 | BISON = "bison"; | ||
25 | } | ||
26 | |||
27 | if FLEX == null then | ||
28 | { | ||
29 | FLEX = "flex"; | ||
30 | } | ||
31 | |||
32 | function cppToObj() | ||
33 | { | ||
34 | if OBJ_DIR == null then | ||
35 | { | ||
36 | DIR = INPUT.dirName(); | ||
37 | } | ||
38 | else | ||
39 | { | ||
40 | DIR = OBJ_DIR; | ||
41 | } | ||
42 | |||
43 | return DIR + "/" + INPUT.fileName().replace(".cpp", ".o"); | ||
44 | } | ||
45 | |||
46 | function cToObj() | ||
47 | { | ||
48 | if OBJ_DIR == null then | ||
49 | { | ||
50 | DIR = INPUT.dirName(); | ||
51 | } | ||
52 | else | ||
53 | { | ||
54 | DIR = OBJ_DIR; | ||
55 | } | ||
56 | |||
57 | return DIR + "/" + INPUT.fileName().replace(".c", ".o"); | ||
58 | } | ||
1 | 59 | ||
2 | rule "exe" | 60 | rule "exe" |
3 | { | 61 | { |
4 | input "*.o"; | 62 | input "*.o"; |
5 | profile "build" | 63 | profile "build" |
6 | { | 64 | { |
7 | execute("g++ -o ${OUTPUT} ${INPUT} ${LDFLAGS}"); | 65 | execute("${CXX} -o ${OUTPUT} ${INPUT} ${LDFLAGS}"); |
8 | } | 66 | } |
9 | } | 67 | } |
10 | 68 | ||
@@ -13,18 +71,19 @@ rule "lib" | |||
13 | input "*.o"; | 71 | input "*.o"; |
14 | profile "build" | 72 | profile "build" |
15 | { | 73 | { |
16 | execute("ar cr ${OUTPUT} ${INPUT}"); | 74 | execute("${AR} cr ${OUTPUT} ${INPUT}"); |
17 | } | 75 | } |
18 | } | 76 | } |
19 | 77 | ||
20 | rule "cpp" | 78 | rule "cpp" |
21 | { | 79 | { |
22 | input "*.cpp"; | 80 | input "*.cpp"; |
23 | output replace(".cpp", ".o"); | 81 | output cppToObj(); |
24 | requires getMakeDeps("g++ ${CXXFLAGS} -M ${INPUT}"); | 82 | // output replace(".cpp", ".o"); |
83 | requires getMakeDeps("${CXX} ${CXXFLAGS} -M ${INPUT}"); | ||
25 | profile "build" | 84 | profile "build" |
26 | { | 85 | { |
27 | execute("g++ ${CXXFLAGS} -c -o ${OUTPUT} ${INPUT}", "g++"); | 86 | execute("${CXX} ${CXXFLAGS} -c -o ${OUTPUT} ${INPUT}", "g++"); |
28 | } | 87 | } |
29 | } | 88 | } |
30 | 89 | ||
@@ -32,11 +91,12 @@ rule "cpp" | |||
32 | rule "c" | 91 | rule "c" |
33 | { | 92 | { |
34 | input "*.c"; | 93 | input "*.c"; |
35 | output replace(".c", ".o"); | 94 | output cToObj(); |
36 | requires getMakeDeps("gcc ${CXXFLAGS} -M ${INPUT}"); | 95 | // output replace(".c", ".o"); |
96 | requires getMakeDeps("${CC} ${CFLAGS} -M ${INPUT}"); | ||
37 | profile "build" | 97 | profile "build" |
38 | { | 98 | { |
39 | execute("gcc ${CFLAGS} -c -o ${OUTPUT} ${INPUT}"); | 99 | execute("${CC} ${CFLAGS} -c -o ${OUTPUT} ${INPUT}"); |
40 | } | 100 | } |
41 | } | 101 | } |
42 | 102 | ||
@@ -47,7 +107,7 @@ rule "bison" | |||
47 | profile "build" | 107 | profile "build" |
48 | { | 108 | { |
49 | BASE = INPUT.replace(".y", ""); | 109 | BASE = INPUT.replace(".y", ""); |
50 | execute("bison -b${BASE} ${INPUT}"); | 110 | execute("${BISON} -b${BASE} ${INPUT}"); |
51 | // if you add a -v bison will produce a .output file | 111 | // if you add a -v bison will produce a .output file |
52 | } | 112 | } |
53 | } | 113 | } |
@@ -59,6 +119,6 @@ rule "flex" | |||
59 | output replace(".l", ".yy.h"); | 119 | output replace(".l", ".yy.h"); |
60 | profile "build" | 120 | profile "build" |
61 | { | 121 | { |
62 | execute("flex ${FLEXFLAGS} ${INPUT}"); | 122 | execute("${FLEX} ${FLEXFLAGS} ${INPUT}"); |
63 | } | 123 | } |
64 | } | 124 | } |