summaryrefslogtreecommitdiff
path: root/default.bld
blob: 9a5c6376dc690f15ab0944103e92dca5e2c0b4b7 (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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/**
 * This is the default.bld file for libbu++, it pretty much handles everything
 * libbu++ related, kinda' cool, eh?  It can completely replace the old build
 * and actually does a better job with a number of things.
 */

CXXFLAGS += "-ggdb -W -Wall";

action "default"
{
	build: [targets("header-links"), "libbu++.a", targets("tools")];
}

action "pkg"
{
	build: targets("pkg");
}

action "all"
{
	build: [targets("header-links"), "libbu++.a", targets("tools"),
		targets("tests")];
}

target files("src/*.h").replace("src/", "bu/")
{
	tag "header-links";
	display "symlink";
	input OUTPUT.replace("bu/","src/");
	profile "build"
	{
		execute("ln -s ../${INPUT} ${OUTPUT}");
	}
}

target "libbu++.a"
{
	input files("src/*.cpp");
	rule "lib";
	CXXFLAGS += "-I. -fPIC";
}

//
// Tools
//

target files("src/tools/*.cpp").replace("src/tools/","").replace(".cpp","")
{
	input "src/tools/${OUTPUT}.cpp";
	rule "exe";
	requires "libbu++.a";
	tag "tools";
	CXXFLAGS += "-I.";
	LDFLAGS += "-L. -lbu++";
}

//
// General Tests
//

target files("src/tests/*.cpp").replace("src/","").replace(".cpp","")
{
	input "src/${OUTPUT}.cpp";
	rule "exe";
	requires "libbu++.a";
	tag ["tests", "general tests"];
	CXXFLAGS += "-I.";
	LDFLAGS += "-L. -lbu++";
}

// Some tests need extra libs and whatnot, that goes here.

target "tests/bzip2"
{
	LDFLAGS += "-lbz2";
}

target ["tests/itoserver", "tests/socketblock", "tests/itoheap",
	"tests/itoqueue1", "tests/itoqueue2"]
{
	LDFLAGS += "-lpthread";
}

//
// Unit tests
//

target files("src/unit/*.unit").replace("src/","").replace(".unit","")
{
	input "src/${OUTPUT}.unit";
	rule "exe";
	requires "libbu++.a";
	tag ["tests", "unit tests"];
	CXXFLAGS += "-I.";
	LDFLAGS += "-L. -lbu++";
}

target "libbu++-r$(svnversion "-n").tar.bz2"
{
	input [
		"LICENSE",
		"build.conf",
		"Doxyfile",
		"default.bld",
		"support/vim/syntax/taf.vim",
		"support/vim/ftdetect/taf.vim",
		"support/vim/ftplugin/taf.vim",
		files("*.sh"),
		files("src/*.cpp"),
		files("src/*.h"),
		files("src/tests/*.cpp"),
		files("src/tests*.h"),
		files("src/tools/*.cpp"),
		files("src/tools/*.h"),
		files("src/unit/*.unit"),
		files("src/doxy/*.dox")
		];
	rule "tarball";
	tag "pkg";
}

rule "tarball"
{
	input matches("LICENSE", "*.cpp", "*.h", "*.conf", "*.bld", "Doxyfile",
		"*.vim", "*.sh");
	profile "build"
	{
		OUTDIR = OUTPUT.replace(".tar.bz2","");
		execute("tar --transform=\"s@^@${OUTDIR}/@\" -c ${INPUT} |"
			" bzip2 -9 > ${OUTPUT}");
	}
}

rule "unit"
{
	input "*.unit";
	output INPUT.replace(".unit", ".cpp");

	profile "build"
	{
		execute("./mkunit.sh \"${INPUT}\" \"${OUTPUT}\"");
	}
}