Skip to content

Commit b63f541

Browse files
committed
Add submodules to build/packages
Using symlinks the submodules are added to appear just like any downloaded unpacked tar. Also added a Makefile clean rule to clean the submodules, which includes Reseting the submodules to the origin branch state, including ignored files.
1 parent a0105a6 commit b63f541

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

Makefile

+17-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
ARCHS := x86_64 arm aarch64 powerpc mips mipsel
22
TARGETS := $(addprefix build-, $(ARCHS))
33
PACK_TARGETS := $(addprefix pack-, $(ARCHS))
4+
SUBMODULE_PACKAGES := $(wildcard src/submodule_packages/*)
5+
BUILD_PACKAGES_DIR := "build/packages"
46

57
.PHONY: clean help download_packages build build-docker-image $(TARGETS) $(PACK_TARGETS)
68

@@ -23,22 +25,28 @@ build/build-docker-image.stamp: Dockerfile
2325

2426
build-docker-image: build/build-docker-image.stamp
2527

26-
build/download-packages.stamp: build/build-docker-image.stamp src/download_packages.sh
27-
mkdir -p build/packages
28+
build/download-packages.stamp: build/build-docker-image.stamp src/compilation/download_packages.sh
29+
mkdir -p $(BUILD_PACKAGES_DIR)
2830
docker run --user $(shell id -u):$(shell id -g) \
2931
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
30-
/app/gdb/src/download_packages.sh /app/gdb/build/packages
32+
/app/gdb/src/compilation/download_packages.sh /app/gdb/$(BUILD_PACKAGES_DIR)/
3133
touch build/download-packages.stamp
3234

35+
build/symlink-git-packages.stamp: $(SUBMODULE_PACKAGES)
36+
mkdir -p $(BUILD_PACKAGES_DIR)
37+
ln -sf $(addprefix /app/gdb/, $(SUBMODULE_PACKAGES)) $(BUILD_PACKAGES_DIR)/
38+
39+
symlink-git-packages: build/symlink-git-packages.stamp
40+
3341
download-packages: build/download-packages.stamp
3442

3543
build: $(TARGETS)
3644

37-
$(TARGETS): build-%: download-packages build-docker-image
45+
$(TARGETS): build-%: symlink-git-packages download-packages build-docker-image
3846
mkdir -p build
3947
docker run --user $(shell id -u):$(shell id -g) \
4048
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
41-
/app/gdb/src/build.sh $* /app/gdb/build/ /app/gdb/src
49+
/app/gdb/src/compilation/build.sh $* /app/gdb/build/ /app/gdb/src
4250

4351
pack: $(PACK_TARGETS)
4452

@@ -47,7 +55,10 @@ $(PACK_TARGETS): pack-%: build-%
4755
tar -czf "build/artifacts/gdb-static-$*.tar.gz" -C "build/artifacts/$*" .; \
4856
fi
4957

50-
clean:
58+
clean-git-packages:
59+
git submodule foreach '[[ ! "$$sm_path" == src/submodule_packages/* ]] || git clean -xffd'
60+
61+
clean: clean-git-packages
5162
rm -rf build
5263
# Kill and remove all containers of image gdb-static
5364
docker ps -a | grep -P "^[a-f0-9]+\s+gdb-static\s+" | awk '{print $$1}' | xargs docker rm -f 2>/dev/null || true
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)