aboutsummaryrefslogtreecommitdiff
path: root/share/autoinclude/general-rules.bld
blob: 16217e0f750bdc20993766b945f682c6c55e3bb2 (plain)
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

rule "exe"
{
	input "*.o";
	profile "build"
	{
		execute("g++ -o ${OUTPUT} ${INPUT} ${LDFLAGS}");
	}
}

rule "lib"
{
	input "*.o";
	profile "build"
	{
		execute("ar cr ${OUTPUT} ${INPUT}");
	}
}

rule "cpp"
{
	input "*.cpp";
	output replace(".cpp", ".o");
	requires getMakeDeps("g++ ${CXXFLAGS} -M ${INPUT}");
	profile "build"
	{
		execute("g++ ${CXXFLAGS} -c -o ${OUTPUT} ${INPUT}", "g++");
	}
}

// Heh, we're not going to use this one.
rule "c"
{
	input "*.c";
	output replace(".c", ".o");
	requires getMakeDeps("gcc ${CXXFLAGS} -M ${INPUT}");
	profile "build"
	{
		execute("gcc ${CFLAGS} -c -o ${OUTPUT} ${INPUT}");
	}
}

rule "bison"
{
	input "*.y";
	output [INPUT.replace(".y", ".tab.c"), INPUT.replace(".y", ".tab.h")];
	profile "build"
	{
		BASE = INPUT.replace(".y", "");
		execute("bison -b${BASE} ${INPUT}");
		// if you add a -v bison will produce a .output file
	}
}

rule "flex"
{
	input "*.l";
	output replace(".l", ".yy.c");
	output replace(".l", ".yy.h");
	profile "build"
	{
		execute("flex ${FLEXFLAGS} ${INPUT}");
	}
}