Skip to content

Commit e4e5dbb

Browse files
committed
build system improvements:
I) Better names for makefile variables. II) Improved documentation on build types in the md files. III) Removed redundant parameters in build.sh & Improved internal documentation
1 parent 06bb86a commit e4e5dbb

File tree

3 files changed

+30
-27
lines changed

3 files changed

+30
-27
lines changed

Makefile

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
ARCHS := x86_64 arm aarch64 powerpc mips mipsel
22
GDB_BFD_ARCHS := $(shell echo $(ARCHS) | awk '{for(i=1;i<=NF;i++) $$i=$$i"-linux"; print}' OFS=,)
33

4-
BASE_TARGETS := $(addprefix build-, $(ARCHS))
4+
BASE_BUILD_TARGETS := $(addprefix build-, $(ARCHS))
55

6-
SLIM_TARGETS := $(addsuffix -slim, $(BASE_TARGETS))
7-
FULL_TARGETS := $(addsuffix -full, $(BASE_TARGETS))
8-
ALL_TARGETS := $(SLIM_TARGETS) $(FULL_TARGETS)
6+
SLIM_BUILD_TARGETS := $(addsuffix -slim, $(BASE_BUILD_TARGETS))
7+
FULL_BUILD_TARGETS := $(addsuffix -full, $(BASE_BUILD_TARGETS))
8+
ALL_BUILD_TARGETS := $(SLIM_BUILD_TARGETS) $(FULL_BUILD_TARGETS)
99

1010
BASE_PACK_TARGETS := $(addprefix pack-, $(ARCHS))
1111

@@ -20,7 +20,7 @@ BUILD_PACKAGES_DIR := "build/packages"
2020
# This is disabled by the ci automation manually.
2121
TTY_ARG ?= -it
2222

23-
.PHONY: clean help download_packages build build-docker-image $(ALL_TARGETS) $(ALL_PACK_TARGETS)
23+
.PHONY: clean help download_packages build build-docker-image $(ALL_BUILD_TARGETS) $(ALL_PACK_TARGETS)
2424

2525
.NOTPARALLEL: build pack
2626

@@ -29,7 +29,7 @@ help:
2929
@echo " make build"
3030
@echo ""
3131

32-
@for target in $(ALL_TARGETS); do \
32+
@for target in $(ALL_BUILD_TARGETS); do \
3333
echo " $$target"; \
3434
done
3535

@@ -58,12 +58,12 @@ symlink-git-packages: build/symlink-git-packages.stamp
5858

5959
download-packages: build/download-packages.stamp
6060

61-
build: $(ALL_TARGETS)
61+
build: $(ALL_BUILD_TARGETS)
6262

63-
$(SLIM_TARGETS): build-%-slim:
63+
$(SLIM_BUILD_TARGETS): build-%-slim:
6464
@BUILD_TYPE="slim" $(MAKE) _build-$*
6565

66-
$(FULL_TARGETS): build-%-full:
66+
$(FULL_BUILD_TARGETS): build-%-full:
6767
@BUILD_TYPE="full" GDB_BFD_ARCHS=$(GDB_BFD_ARCHS) $(MAKE) _build-$*
6868

6969
_build-%: symlink-git-packages download-packages build-docker-image

README.md

+14-9
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,22 @@ This is where `gdb-static` comes in! We provide static builds of `gdb` (and `gdb
6060

6161
## Usage
6262

63-
To get started with `gdb-static`, simply download the build for your architecture from the [releases page](https://github.com/guyush1/gdb-static/releases/latest), extract the archive, and copy the binary to your desired platform.
64-
65-
> [!NOTE]
66-
> We provide two types of builds:
67-
> 1. Full builds with Python support && cross-architecture debugging, ~70MB in size. Note that we disable the simulator feature in order to enable cross-architecture debugging (since not all targets have a simulator).
68-
> 2. Slim builds, which are approximately ~10 MB in size.
69-
>
70-
> Full builds are modular - you can edit full_build_conf.sh to disable parts of the full builds.
63+
To get started with `gdb-static`, simply download the build for your architecture from the [releases page](https://github.com/guyush1/gdb-static/releases/latest), extract the archive, and copy the binary to your desired platform. <br />
7164

7265
You may choose to copy the `gdb` binary to the platform, or use `gdbserver` to debug remotely.
7366

67+
## Build types
68+
69+
We provide two types of builds:
70+
1. Slim builds, that contains most of the features, beside the ones mentioned below.
71+
2. Full builds that contains all of the slim build features, and also contains:
72+
* Python support
73+
* Cross-architecture debugging. <br />
74+
Note that in order to enable cross-architecture debugging, we have to disable the simulator feature, since not all targets have a simulator.
75+
76+
Slim builds are approximately ~10MB. Full builds are approximately ~70MB. <br />
77+
You can edit the full_build_conf.sh file to disable full build exclusive features.
78+
7479
## Development
7580

7681
> [!NOTE]
@@ -102,7 +107,7 @@ To build `gdb-static` for a specific architecture, run the following command:
102107
make build-<ARCH>-[slim/full]
103108
```
104109

105-
Where `<ARCH>` is the architecture you want to build for, and `slim/full` determines the build type (see note about builds above).
110+
Where `<ARCH>` is the architecture you want to build for, and `slim/full` determines the build type (see [here](#build-types)).
106111

107112
The resulting binary will be placed in the `build/artifacts/` directory:
108113

src/compilation/build.sh

+7-9
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,8 @@ function build_gdb() {
510510
# $4: libgmp prefix
511511
# $5: libmpfr prefix
512512
# $6: liblzma prefix
513-
# $7: whether to build gdb with all extra configurations specified in src/compilation/full_build_conf.sh
513+
# $7: build mode: slim / full.
514514
# $8: gdb cross-architecture binary format support formats (relevant for full builds only).
515-
# $9: the architecture we are compiling for.
516515
#
517516
# Echoes:
518517
# The gdb build directory
@@ -529,7 +528,6 @@ function build_gdb() {
529528
local liblzma_prefix="$6"
530529
local full_build="$7"
531530
local gdb_bfd_archs="$8"
532-
local target_arch="$9"
533531

534532
local extra_flags=()
535533
if [[ "$full_build" == "yes" ]]; then
@@ -543,10 +541,10 @@ function build_gdb() {
543541
extra_flags+=("--without-python")
544542
fi
545543

546-
local gdb_build_dir="$(realpath "$gdb_dir/build-${target_arch}_full")"
544+
local gdb_build_dir="$(realpath "$gdb_dir/build-${target_arch}-full")"
547545
else
548546
extra_flags+=("--without-python")
549-
local gdb_build_dir="$(realpath "$gdb_dir/build-${target_arch}_slim")"
547+
local gdb_build_dir="$(realpath "$gdb_dir/build-${target_arch}-slim")"
550548
fi
551549

552550
echo "$gdb_build_dir"
@@ -595,7 +593,7 @@ function install_gdb() {
595593
# $1: gdb build directory
596594
# $2: artifacts directory
597595
# $3: target architecture
598-
# $4: whether to build gdb with all extra configurations specified in src/compilation/full_build_conf.sh
596+
# $4: build mode: slim / full.
599597
#
600598
# Returns:
601599
# 0: success
@@ -643,7 +641,7 @@ function build_and_install_gdb() {
643641
# $3: libgmp prefix
644642
# $4: libmpfr prefix
645643
# $5: liblzma prefix.
646-
# $6: whether to build gdb with all extra configurations specified in src/compilation/full_build_conf.sh
644+
# $6: build mode: slim / full.
647645
# $7: gdb cross-architecture binary format support formats (relevant for full builds only).
648646
# $8: install directory
649647
# $9: target architecture
@@ -662,7 +660,7 @@ function build_and_install_gdb() {
662660
local artifacts_dir="$8"
663661
local target_arch="$9"
664662

665-
gdb_build_dir="$(build_gdb "$gdb_dir" "$target_arch" "$libiconv_prefix" "$libgmp_prefix" "$libmpfr_prefix" "$liblzma_prefix" "$full_build" "$gdb_bfd_archs" "$target_arch")"
663+
gdb_build_dir="$(build_gdb "$gdb_dir" "$target_arch" "$libiconv_prefix" "$libgmp_prefix" "$libmpfr_prefix" "$liblzma_prefix" "$full_build" "$gdb_bfd_archs")"
666664
if [[ $? -ne 0 ]]; then
667665
return 1
668666
fi
@@ -680,7 +678,7 @@ function build_gdb_with_dependencies() {
680678
# $1: target architecture
681679
# $2: build directory
682680
# $3: src directory
683-
# $4: whether to build gdb with all extra configurations specified in src/compilation/full_build_conf.sh
681+
# $4: build mode: slim / full.
684682
# $5: gdb cross-architecture binary format support formats (relevant for full builds only).
685683

686684
local target_arch="$1"

0 commit comments

Comments
 (0)