File: makefile.txt

package info (click to toggle)
llvm-toolchain-6.0 1%3A6.0.1-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 598,080 kB
  • sloc: cpp: 3,046,253; ansic: 595,057; asm: 271,965; python: 128,926; objc: 106,554; sh: 21,906; lisp: 10,191; pascal: 6,094; ml: 5,544; perl: 5,265; makefile: 2,227; cs: 2,027; xml: 686; php: 212; csh: 117
file content (29 lines) | stat: -rw-r--r-- 1,614 bytes parent folder | download | duplicates (16)
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)