summaryrefslogtreecommitdiff
path: root/build.conf
blob: b29809d02a40799ed38633498845dc143c5baaf4 (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
# Build config file for libbu++
#
# Copyright (C) 2007-2008 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.

default action: check group "lnhdrs", check "libbu++.a", check group "tools"
"tests" action: check group "lnhdrs", check group "tests"
"all" action: check group "lnhdrs", check targets()
"optparser" action: check "tests/optparser"

set "CXXFLAGS" += "-ggdb -W -Wall"
#set "CXXFLAGS" += "-O2 -Wall"

# set "CXXFLAGS" += "-pg"
# set "LDFLAGS" += "-pg"

filesIn("src") filter regexp("^src/(.*)\\.h$", "bu/{re:1}.h"):
	rule "hln",
	group "lnhdrs",
	target file,
	input "src/{re:1}.h"

"libbu++.a":
	rule "lib",
	target file,
	set "CXXFLAGS" += "-I. -fPIC",
	input filesIn("src") filter regexp("^.*\\.cpp$")

#"libbu++.so":
#	rule "so",
#	target file,
#	set "CXXFLAGS" += "-I. -fPIC",
#	set "LDFLAGS" += "-lpthread -lbz2",
#	input filesIn("src") filter regexp("^.*\\.cpp$")


directoriesIn("src/tests","tests/"):
	rule "exe",
	target file,
	group "tests",
	requires "libbu++.a",
	set "CXXFLAGS" += "-I.",
	set "LDFLAGS" += "-L. -lbu++",
	input filesIn("{fulldir}") filter regexp("^.*\\.cpp$")

filesIn("src/tests") filter regexp("^src/tests/(.*)\\.cpp$", "tests/{re:1}"):
	rule "exe",
	target file,
	group "tests",
	requires "libbu++.a",
	set "CXXFLAGS" += "-I.",
	set "LDFLAGS" += "-L. -lbu++",
	input "src/{target}.cpp"

filesIn("src/tools") filter regexp("^src/tools/(.*)\\.cpp$", "{re:1}"):
	rule "exe",
	target file,
	group "tools",
	requires "libbu++.a",
	set "CXXFLAGS" += "-I.",
	set "LDFLAGS" += "-L. -lbu++",
	input "src/tools/{target}.cpp"

["tests/itoqueue1", "tests/itoqueue2", "tests/socketblock", "tests/itoserver",
 "tests/itoheap"]:
	set "LDFLAGS" += "-lpthread"

filesIn("src/unit") filter regexp("^src/unit/(.*)\\.unit$", "unit/{re:1}"):
	rule "exe",
	target file,
	group "tests",
	group "unit",
	requires "libbu++.a",
	set "CXXFLAGS" += "-I.",
	set "LDFLAGS" += "-L. -lbu++",
	input "src/{target}.unit"

"tests/plugin": set "LDFLAGS" += "-ldl"

"tests/bzip2": set "LDFLAGS" += "-lbz2"

rule "exe":
	matches regexp("(.*)\\.o$"),
	aggregate toString(" "),
	perform command("g++ -o {target} {match} {LDFLAGS}")

rule "lib":
	matches regexp("(.*)\\.o$"),
	aggregate toString(" "),
	perform command("ar cr {target} {match}")

rule "so":
	matches regexp("(.*)\\.o$"),
	aggregate toString(" "),
	perform command("g++ -shared -o {target} {match} {LDFLAGS}")
#	perform command("ld -G -o {target} {match}")

rule "cpp":
	matches regexp("(.*)\\.cpp$"),
	produces "{re:1}.o",
	requires commandToList("g++ -M {CXXFLAGS} {match}", "make"),
	perform command("g++ {CXXFLAGS} -c -o {target} {match}")

rule "unit":
	matches regexp("(.*)\\.unit$"),
	produces "{re:1}.cpp",
	requires "mkunit.sh",
	perform command("./mkunit.sh \"{match}\" \"{target}\"")

rule "hln":
	matches regexp("src/(.*)\\.h"),
	produces "bu/{re:1}.h",
	perform command("ln -s ../src/{re:1}.h {target}")