aboutsummaryrefslogtreecommitdiff
path: root/default.bld
blob: 3b6c2139489d81e12673378ac23438318cc5253b (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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/*
 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
 *
 * This file is part of the libbu++ library and is released under the
 * terms of the license contained in the file LICENSE.
 */

/**
 * 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 -I.";

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")];
}

action "unit"
{
	build: targets("unit tests");
}

action "myriadfs"
{
	build: "myriadfs";
}

target ["src/autoconfig.h", "src/version.h"]
{
	input "autoconfig";
	display "autoconfig";
	profile "build"
	{
		execute("./autoconfig ${OUTPUT}");
	}
}

target "src/version.h"
{
	input ".svn";
}

target "autoconfig"
{
	rule "exe";
	input "autoconfig.cpp";
}

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

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

target "libbu++.a"
{
	input files("src/*.cpp", "src/compat/*.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++";
}

target "viewcsv"
{
	LDFLAGS += "-lncurses";
}

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

//
// This shouldn't be.  Basically, if you set a property on a top level target
// that has children it seems like the items should apply to the children.
// I'm honestly not 100% sure what the policy should be yet, but this seems like
// I shouldn't have to do it this way.
//
target "src/extra/myriadfs.o"
{
	CXXFLAGS += "-D_FILE_OFFSET_BITS=64";
}

target "myriadfs"
{
	LDFLAGS += "-lfuse";
}

//
// 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", "tests/streamstack"]
{
	LDFLAGS += "-lbz2";
}

target ["tests/itoserver", "tests/socketblock", "tests/itoheap",
	"tests/itoqueue1", "tests/itoqueue2", "tests/conduit"]
{
	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",
		"Doxyfile",
		files("*.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"),
		files("src/compat/*.cpp"),
		files("src/compat/*.h")
		];
	rule "tarball";
	tag "pkg";
}

rule "tarball"
{
	input matches("LICENSE", "*.cpp", "*.h", "*.conf", "*.bld", "Doxyfile",
		"*.vim", "*.sh", "*.unit");
	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 \"${INPUT}\" \"${OUTPUT}\"");
	}
}