-
Notifications
You must be signed in to change notification settings - Fork 8
/
pbuild.list
137 lines (112 loc) · 2.88 KB
/
pbuild.list
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
msGeneralOptions='-nologo'
msSubsystem='console'
msLinkFlags="@ms.cmd"
msCFlags="@ms.cmd"
msLinkLibs='kernel32.lib user32.lib gdi32.lib'
CWD=$(pwd)
CFLAGS="-I."
LDFLAGS=""
compile()
{
TARGET=$1
shift
gcc $CFLAGS -o "$TARGET" -c $@
return $?
}
assemble()
{
TARGET=$1
shift
as -o "$TARGET" $@
return $?
}
link()
{
TARGET=$1
shift
#libs="-luser32 -lkernel32 -lmsvcrt -lwhook"
#libs="-L/c/python24/libs -lkernel32 -luser32 -lmsvcrt -lpython24"
libs=""
gcc -L. $libs -o "$TARGET" $@
return $?
}
dll()
{
TARGET=$1
shift
basename=$(basename "$TARGET" .dll)
libs="-luser32 -lkernel32 -lmsvcrt"
# ld $libs -shared --compat-implib --out-implib "lib$TARGET.a" -o "$TARGET" $@
gcc -Wl,-out-implib,"lib$basename.a",-compat-implib $libs -shared -o "$TARGET" $@
return $?
}
elf2coff()
{
TARGET=$1
SOURCE=$2
shift
shift
objcopy --input-target=elf32-i386 --output-target=coff-i386 "$SOURCE" "$TARGET"
test -e "$TARGET"
return $?
}
mscompile()
{
TARGET=$1
shift
cl.exe -c -Fo$TARGET $msGeneralOptions $msCFlags $@
return $?
}
mslibrary()
{
TARGET=$1
shift
lib.exe -subsystem:$msSubsystem "-out:$TARGET" $msGeneralOptions $msLinkFlags $@
return $?
}
mslink()
{
TARGET=$1
shift
rm -f "$TARGET"
echo link.exe -subsystem:$msSubsystem "-out:$TARGET" $msGeneralOptions $msLinkFlags $msLinkLibs $@
link.exe -subsystem:$msSubsystem "-out:$TARGET" $msGeneralOptions $msLinkFlags $msLinkLibs $@
return $?
}
build()
{
TARGET=$1
shift
echo "[$TARGET] Successfully built:"
for target in $@; do
echo " $target"
done
return 1
}
alltargets()
{
for i in $( echo "$LIST" | cut -d ':' -f 1 ); do
if $( test -e "$i" ); then
echo "Removing \"$i\""
rm -i "$i"
fi
done
return 1
}
#resolve obj/blah.o compile blah.c
#resolve blah.exe link obj/blah.o libwhook.a
resolve obj/python-stub.o assemble src/python-stub.s
resolve obj/python-stub.obj elf2coff obj/python-stub.o
#resolve test/python-stub.exe link obj/python-stub.o
resolve obj/python-stub.exe mslink obj/python-stub.obj
resolve obj/inject-helper.o assemble src/inject-helper.s
resolve obj/inject-helper.obj elf2coff obj/inject-helper.o
resolve obj/inject-test.obj mscompile src/inject-test.c
resolve inject-test.exe mslink obj/inject-test.obj obj/inject-helper.obj
resolve obj/stackless.o assemble src/stackless.s
resolve obj/python-test.obj mscompile src/test.c
resolve python-test.exe mslink obj/python-test.obj
resolve obj/test.obj mscompile src/test.c
resolve obj/test.lib mslibrary obj/test.obj
#resolve all build test/thread-test-gui.exe test/thread-test-console.exe test/inject-stub.exe
resolve clean alltargets