File: makefile.txt

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (29 lines) | stat: -rw-r--r-- 1,614 bytes parent folder | download | duplicates (12)
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 against 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)