summaryrefslogtreecommitdiff
path: root/mingw.bld
blob: 69be44ee54dfa1112576e7f78b4b0795d1da873f (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
/*
 * 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 just like default.bld, but for mingw...crazy, eh?
 */

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

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

for base in ["stable", "unstable", "experimental"] do
{
	target files("src/${base}/*.h").replace("src/${base}/", "bu/")
	{
		tag "header-links";
		display "symlink";
		input OUTPUT.replace("bu/","src/${base}/");
		profile "build"
		{
			DIR = OUTPUT.dirName();
			execute("mkdir -p ${DIR}; 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 ["bu/config.h", "bu/autoconfig.h", "bu/version.h", "bu/signals.h"]
{
	tag "header-links";
	display "symlink";
	input OUTPUT.replace("bu/","src/");
	profile "build"
	{
		DIR = OUTPUT.dirName();
		execute("mkdir -p ${DIR}; ln -s ../${INPUT} ${OUTPUT}");
	}
}

target "libbu++win.a"
{
	input files("src/stable/*.cpp", "src/unstable/*.cpp",
		"src/experimental/*.cpp", "src/compat/*.cpp");
	rule "lib";
	CXXFLAGS += "-I. -Isupport/windows";
}

target ["src/stable/lzma.win_o", "src/experimental/cachestorefiles.win_o", "src/experimental/regex.win_o"]
{
	profile "build"
	{
		execute("rm -f ${OUTPUT} && touch ${OUTPUT} && echo NOT BUILDING PROCESS RIGHT NOW!!!");
	}
}

function cppToWinObj()
{
	if OBJ_DIR == null then
	{
		return INPUT.regex("\\.cpp$", ".win_o");
	}
	else
	{
		return OBJ_DIR + "/" + INPUT.fileName().regex("\\.cpp$", ".win_o");
	}

}

rule "lib"
{
	input "*.win_o";
	profile "build"
	{
		execute("wine C:/MinGW/bin/ar.exe cr ${OUTPUT} ${INPUT}");
	}
}

rule "wincpp"
{
	input "*.cpp";
	output INPUT.cppToWinObj();
	//requires getMakeDeps("wine C:/MinGW/bin/g++.exe ${CXXFLAGS} -M ${INPUT}");
	profile "build"
	{
		execute("wine C:/MinGW/bin/g++.exe ${CXXFLAGS} -c -o ${OUTPUT} ${INPUT}", "g++");
	}
}