1 # This makefile aims to make the binaries as small as possible, for us not to
2 # upload huge binary blobs in the repo.
3 # The binary should have debug symbols because stack unwinding doesn't work
4 # correctly using the information in the Minidump only. Also we want to evaluate
5 # local variables, etc.
6 # Breakpad compiles as a static library, so statically linking against it
7 # makes the binary huge.
8 # Dynamically linking to it does improve things, but we are still #include-ing
9 # breakpad headers (which is a lot of source code for which we generate debug
11 # So, install_breakpad.cpp does the #include-ing and defines a global function
12 # "InstallBreakpad" that does all the exception handler registration.
13 # We compile install_breakpad to object file and then link it, alongside the
14 # static libbreakpad, into a shared library.
15 # Then the binaries dynamically link to that lib.
16 # The other optimisation is not using the standard library (hence the _start
17 # instead of main). We only link dynamically to some standard libraries.
18 # This way we have a tiny binary (~8K) that has debug symbols and uses breakpad
19 # to generate a Minidump when the binary crashes/requests such.
24 INCLUDE=-I$HOME/breakpad/src/src/
25 LINK=-L. -lbreakpad -lpthread -nostdlib -lc -lstdc++ -lgcc_s -fno-exceptions
27 $(CC) $(FLAGS) -fPIC -c install_breakpad.cpp $(INCLUDE) -o install_breakpad.o
28 ld -shared install_breakpad.o libbreakpad_client.a -o libbreakpad.so
29 $(CC) $(FLAGS) -o linux-x86_64 linux-x86_64.cpp $(LINK)
30 $(CC) $(FLAGS) -o linux-x86_64_not_crashed linux-x86_64_not_crashed.cpp $(LINK)