dist: stop using --show-toplevel for speed up

Dist folder struct is very stable now, no need to use git for retrieving
top dir path.

This alse clean up git usage so dist will be able to build out of repo
in the future.

Signed-off-by: Kairui Song <kasong@tencent.com>
This commit is contained in:
Kairui Song 2024-05-24 16:42:26 +08:00
parent 54f6658540
commit 7c237644c8
2 changed files with 3 additions and 6 deletions

7
dist/Makefile vendored
View File

@ -3,12 +3,9 @@
# A simple and clean build system initially inspired by Fedora ARK Kernel and Tencent Linux Kernel public.
#
TOPDIR := $(shell git rev-parse --show-toplevel)
ifeq ("$(TOPDIR)", "")
TOPDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..)
endif
# Dist Makefile must be in /dist and kernel source code requires no space in path
DISTPATH = dist
TOPDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..)
DISTDIR := $(TOPDIR)/$(DISTPATH)
ifeq ("$(abspath $(DISTDIR)/Makefile)", "$(lastword $(MAKEFILE_LIST))")
$(error Can't detect Makefile, aborting)

2
dist/scripts/lib.sh vendored
View File

@ -114,7 +114,7 @@ get_dist_makefile_var() {
cat_repo_file "dist/Makefile" "$_gitref" | get_makefile_var "$1"
}
[ "$TOPDIR" ] || TOPDIR=$(git rev-parse --show-toplevel 2>/dev/null)
# This lib must stay in dist/scripts/
[ "$TOPDIR" ] || TOPDIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
[ "$DISTPATH" ] || DISTPATH=$(get_dist_makefile_var DISTPATH)