summaryrefslogtreecommitdiff
path: root/default.bld
blob: 8302fc696941befbc92ac4453a410b8553490fa1 (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
# vim: syntax=build

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

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

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

action "all"
{
	build: [targets("header-links"), "libbu++.a", 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";
}

//
// Tests
//

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

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

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

target "libbu++-r$(svnversion "-n").tar.bz2"
{
	input [
		"LICENSE",
		"build.conf",
		"Doxyfile",
		"buildm3.conf",
		"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", "Doxyfile", "*.vim",
		"*.sh");
	profile "build"
	{
		OUTDIR = OUTPUT.replace(".tar.bz2","");
		execute("tar --transform=\"s@^@${OUTDIR}/@\" -c ${INPUT} |"
			" bzip2 -9 > ${OUTPUT}");
	}
}