aboutsummaryrefslogtreecommitdiff
path: root/congo
blob: f64cd9bea938fedb328eb966e5d56263a9c1d375 (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
#
#  Simple build.conf test file
#
# you can have as many actions as you'd like, the one that's run by default is
# called "default action", you need a default action.
#
# Actions are filled with a comma-seperated list of commands, like "check xxx"
# to check to see if a target needs to be rebuilt
#
default action: check congo, check congod

#
# This action will only build the server program
#
server action: check congod

#
# After that, it helps to define some targets, things that commands usually
# refer to and interact with.
#

#
# "create file" will do just what it says, create a file based on some
# information and a rule.
#
# "from files in" tells us that a list of directories follows, and the input
# list for the rule should be built from these files.
#
# "using rule" tells us which rule to use to actuall create the file
#
create file congod from files in src/congod, src/shared using rule exe
create file congo from files in src/congo, src/shared using rule exe

create files "modules/db{name}.so" from directories in src/congod/db ...
	from files in "src/congod/db/{name}" using rule lib

#
# After all of that, some targets or list items may have their own additional
# dependancies, depending on the rule that built them.  You can define these
# extra dependancies using "xxx requires yyy" which will force the system to
# attempt to create yyy before xxx.
#
congod requires libcongo.a
congo requires libcongo.a

#
# There are a number of variables that the rules can use, including any in the
# environment.  Sometimes you want to modify these, to do that you can use "set"
# and the name of the variable, along with what to do to it.
#
# You can use '=' to set the value, destroying what was there, or '+=' to add
# the new text to the variable, this will assume that the text you provide is
# made up of space-delimited tokens, and will ensure spaces surround them when
# they are added.
#
set CXXFLAGS += "-Ilibbu++/src"
set LDFLAGS += "-Llibbu++ -lbu++"

#
# Sometimes individual targets or list items require special settings, this is
# easy since build maintians a seperate set of variables for any items that need
# special support.
#
# Currently you can only set, for an item, later you may be able to do more.
#
for congo set LDFLAGS += "-lreadline"

#
# Finally, no file is complete without some rules.  Rules determine how to
# fulfill target checking based on some input data.  Generally this is going to
# be creating an executable from a list of source files.
#
#
# First specify the rule name, then you can filter the input list, if desired,
# in two ways.  You can use items that match a regular expression, and execute
# the rule once for the whole list collectively, or once for each element that
# made it through the filter.
#
# Within the perform, there are several things that could go there, for now,
# just command, which takes a string, you can use {} for variable substitution.
#
rule exe matches all /(.*)\.o/ perform command ...
	"g++ {matches} {LDFLAGS} -o {target}"

rule cpp matches one /(.*)\.cpp/ produces {1}.o perform command ...
	"g++ {CXXFLAGS} -o {target} {match}"