File: makefile.txt

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (29 lines) | stat: -rw-r--r-- 1,614 bytes parent folder | download | duplicates (15)
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
# This makefile aims to make the binaries as small as possible, for us not to
# upload huge binary blobs in the repo.
# The binary should have debug symbols because stack unwinding doesn't work
# correctly using the information in the Minidump only. Also we want to evaluate
# local variables, etc.
# Breakpad compiles as a static library, so statically linking againts it
# makes the binary huge.
# Dynamically linking to it does improve things, but we are still #include-ing
# breakpad headers (which is a lot of source code for which we generate debug
# symbols)
# So, install_breakpad.cpp does the #include-ing and defines a global function
# "InstallBreakpad" that does all the exception handler registration.
# We compile install_breakpad to object file and then link it, alongside the
# static libbreakpad, into a shared library.
# Then the binaries dynamically link to that lib.
# The other optimisation is not using the standard library (hence the _start
# instead of main). We only link dynamically to some standard libraries.
# This way we have a tiny binary (~8K) that has debug symbols and uses breakpad
# to generate a Minidump when the binary crashes/requests such.
#
CC=g++
FLAGS=-g --std=c++11
INCLUDE=-I$HOME/breakpad/src/src/
LINK=-L. -lbreakpad -lpthread -nostdlib -lc -lstdc++ -lgcc_s -fno-exceptions
all:
	$(CC) $(FLAGS) -fPIC -c install_breakpad.cpp $(INCLUDE) -o install_breakpad.o
	ld -shared install_breakpad.o libbreakpad_client.a -o libbreakpad.so
	$(CC) $(FLAGS) -o linux-x86_64 linux-x86_64.cpp $(LINK)
	$(CC) $(FLAGS) -o linux-x86_64_not_crashed linux-x86_64_not_crashed.cpp $(LINK)