aboutsummaryrefslogtreecommitdiff
path: root/default.bld
blob: 6309518b390d188fe1685e34d18d5770a0e32b54 (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
#
# default.bld for build mark 3.  This guy does it all, so watch out!
# :)
#

CXXFLAGS += "-fPIC -rdynamic";
LDFLAGS += "-fPIC -rdynamic -Wl,-export-dynamic";
CXXFLAGS += "-ggdb -W -Wall";

CC = CXX; // We actually want to use c++ to compile our c files.

action "default"
{
//	build: "build";
	build: ["build", targets("plugins")];
}

action "man"
{
	build: targets("all");
}

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

action "clean"
{
	clean: "build";
}

action "devinstall"
{
	if "$(id -u)" != "0" then
	{
		error "You can only install as the root user, su then run this.";
	}
	install: targets("devinstall");
}

action "viminstall"
{
	if "$(id -u)" != "0" then
	{
		error "You can only install as the root user, su then run this.";
	}
	install: targets("viminstall");
}

target "build"
{
	input [files("src/*.y"), files("src/*.l"), files("src/*.cpp")];
	rule "exe";
	LDFLAGS += "-Llibbu++ -lbu++ -ldl";
	CXXFLAGS += "-Ilibbu++";
	CFLAGS = CXXFLAGS;
	tag "tools";
}

for IN in files("src/plugins/*.cpp") do
{
	target IN.replace("src/","").replace(".cpp", ".so")
	{
		input IN;
		rule "so";
		LDFLAGS += "-Llibbu++ -lbu++ -ldl";
		CXXFLAGS += "-Ilibbu++ -Isrc";
		tag "plugins";
	}
}

target "build-r$(svnversion "-n").tar.bz2"
{
	input [
		"build.conf",
		"Doxyfile",
		"default.bld",
		"docs/build.1",
		"docs/build.7",
		"support/vim/syntax/build.vim",
		"support/vim/ftdetect/build.vim",
		"support/vim/ftplugin/build.vim",
		files("src/*.y"),
		files("src/*.l"),
		files("src/*.cpp"),
		files("src/*.h"),
		files("share/autoinclude/*"),
		files("share/include/*")
		];
	rule "tarball";
	tag "pkg";
}

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

target "/usr/share/build"
{
	input "$(echo -n $PWD)/share";
	tag "devinstall";
	display "symlink";
	profile "install"
	{
		execute("ln -fsv \"${INPUT}\" \"${OUTPUT}\"");
	}
}

target "/usr/lib/build"
{
	input "$(echo -n $PWD)/plugins";
	tag "devinstall";
	display "symlink";
	profile "install"
	{
		execute("ln -fsv \"${INPUT}\" \"${OUTPUT}\"");
	}
}

for vimdir in dirs("/usr/share/vim/vim*") do
{
	for ftype in ["ftplugin/build.vim", "ftdetect/build.vim",
		"syntax/build.vim"] do
	{
		target vimdir + "/" + ftype
		{
			input "support/vim/" + ftype;
			tag "viminstall";
			display "install";
			profile "install"
			{
				DIR = OUTPUT.dirName();
				execute("mkdir -p ${DIR}");
				execute("cp -f ${INPUT} ${OUTPUT}");
			}
		}
	}
}