build: Add make dist target
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 6dc23d5b..c404cb2b 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -96,11 +96,8 @@ jobs:
- name: Cleanup source tree
run: git checkout $TAG_NAME && rm -rf * && git checkout .
- - name: Burn version number
- run: echo "$TAG_NAME" > version
-
- name: Package release tarball
- run: cd .. && cp -r limine "limine-$TAG_NAME" && rm -rf "limine-$TAG_NAME/.git" && tar -Jcf "limine/limine-$TAG_NAME.tar.xz" "limine-$TAG_NAME"
+ run: make dist
- name: Create release notes
run: echo "Binary release can be found at https://github.com/limine-bootloader/limine/tree/$TAG_NAME-binary" > rel_notes.txt
diff --git a/.gitignore b/.gitignore
index 97c570a4..8bd952f0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@
/**/*.EFI
/**/*.bin
/**/*.bin.gz
+/**/*.tar.xz
/**/*.elf
/**/*.hdd
/**/*.iso
diff --git a/Makefile b/Makefile
index f12bbfcf..3525690f 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,10 @@ export PATH := $(shell pwd)/toolchain/bin:$(PATH)
NCPUS := $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 1)
+export LIMINE_VERSION := $(shell cat ../version 2>/dev/null || ( git describe --exact-match --tags `git log -n1 --pretty='%h'` 2>/dev/null || git log -n1 --pretty='%h' ) )
+
+export LIMINE_COPYRIGHT := $(shell grep Copyright LICENSE.md)
+
TOOLCHAIN ?= limine
TOOLCHAIN_CC ?= $(TOOLCHAIN)-gcc
@@ -121,13 +125,27 @@ limine-uefi-clean: stage23-uefi-clean
.PHONY: limine-uefi32-clean
limine-uefi32-clean: stage23-uefi32-clean
-.PHONY: distclean2
-distclean2: clean test-clean
- rm -rf toolchain ovmf* gnu-efi
+.PHONY: dist
+dist:
+ rm -rf "limine-$(LIMINE_VERSION)"
+ LIST="$$(ls -A)"; mkdir "limine-$(LIMINE_VERSION)" && cp -r $$LIST "limine-$(LIMINE_VERSION)/"
+ rm -rf "limine-$(LIMINE_VERSION)/"*.tar*
+ $(MAKE) -C "limine-$(LIMINE_VERSION)" repoclean
+ $(MAKE) -C "limine-$(LIMINE_VERSION)" gnu-efi stivale
+ rm -rf "limine-$(LIMINE_VERSION)/gnu-efi/.git"
+ rm -rf "limine-$(LIMINE_VERSION)/stivale/.git"
+ rm -rf "limine-$(LIMINE_VERSION)/.git"
+ echo "$(LIMINE_VERSION)" > "limine-$(LIMINE_VERSION)/version"
+ tar -Jcf "limine-$(LIMINE_VERSION).tar.xz" "limine-$(LIMINE_VERSION)"
+ rm -rf "limine-$(LIMINE_VERSION)"
.PHONY: distclean
-distclean: distclean2
- rm -rf stivale
+distclean: clean test-clean
+ rm -rf toolchain ovmf*
+
+.PHONY: repoclean
+repoclean: distclean
+ rm -rf stivale gnu-efi *.tar.xz
stivale:
git clone https://github.com/stivale/stivale.git
diff --git a/README.md b/README.md
index 07248803..44b61fc9 100644
--- a/README.md
+++ b/README.md
@@ -86,7 +86,7 @@ make toolchain # (or gmake where applicable)
### Building Limine
In order to build Limine, the following packages have to be installed:
-`GNU make`, `git`, `nasm`, `mtools` (optional, necessary to build
+`GNU make`, `nasm`, `mtools` (optional, necessary to build
`limine-eltorito-efi.bin`).
Furthermore, either the toolchain must have been built in the previous
paragraph, or `gcc` or `llvm/clang` must also be installed.
diff --git a/stage23/Makefile b/stage23/Makefile
index cecf4051..03d85e3f 100644
--- a/stage23/Makefile
+++ b/stage23/Makefile
@@ -51,8 +51,6 @@ COM_OUTPUT = false
E9_OUTPUT = false
BUILD_ID := $(shell dd if=/dev/urandom count=8 bs=1 2>/dev/null | od -An -t x4 | sed 's/^ /0x/g;s/ //g')
-LIMINE_VERSION := $(shell cat ../version 2>/dev/null || ( git describe --exact-match --tags `git log -n1 --pretty='%h'` 2>/dev/null || ( git log -n1 --pretty='%h' && echo -n "(`git branch --show-current`)" ) ) )
-LIMINE_COPYRIGHT := $(shell grep Copyright ../LICENSE.md)
WERROR = -Werror
CFLAGS ?= -O3 -g -pipe -Wall -Wextra $(WERROR)
