summaryrefslogtreecommitdiff
path: root/mingw.bld
blob: f224fa09fbb01469549a3f3c12949324197d8b07 (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
#build-m3 file for fishtrax client

action "default"
{
	warning "Use the 'release' target to strip debugging and build without deps.";
	DEBUG = "true";
	build: ["stage.exe"];
}

action "release"
{
	warning "Relesae will build without deps, and will strip debugging.";
	DEBUG = "false";
	build: ["stage.exe"];
}

action "clean"
{
	clean: targets();
}

CXXFLAGS += "-ggdb";

target "stage.exe"
{
	input [
		files("src/*.cpp")
//		files("src/*.c")
		];
	rule "winexe";

	CXXFLAGS += "-O2 -frtti -fexceptions -Wall -Ilibbu++/support/windows -Isrc";

	LDFLAGS += "-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -lmingw32 -Llibbu++ -lbu++win -Llibbu++/support/windows -lbz2";

	CXXFLAGS += "-Ilibbu++";
}

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

rule "winexe"
{
	input "*.win_o";
	profile "build"
	{
		if DEBUG != "true" then
		{
			LDFLAGS += "-Wl,-s";
		}
		execute("wine C:/MinGW/bin/mingw32-g++.exe -o ${OUTPUT} ${INPUT} ${LDFLAGS}");
	}
}

function cppToWinObj()
{
	if OBJ_DIR == null then
	{
		DIR = INPUT.dirName();
	}
	else
	{
		DIR = OBJ_DIR;
	}

	return DIR + "/" + INPUT.fileName().replace(".cpp", ".win_o");
}

function cToWinObj()
{
	if OBJ_DIR == null then
	{
		DIR = INPUT.dirName();
	}
	else
	{
		DIR = OBJ_DIR;
	}

	return DIR + "/" + INPUT.fileName().replace(".c", ".win_o");
}

function winDeps( CMD )
{
	if DEBUG == "true" then
	{
		return getMakeDeps( CMD );
	}
	return [];
}

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

rule "winc"
{
	input "*.c";
	output INPUT.cToWinObj();
	requires winDeps("wine C:/MinGW/bin/g++.exe ${CXXFLAGS} -M ${INPUT}");
	profile "build"
	{
		//condition always;
		execute("wine C:/MinGW/bin/mingw32-g++.exe ${CXXFLAGS} -c -o ${OUTPUT} ${INPUT}", "g++");
	}
}