From 816044987ec4fbee3b88e04aabcf0a2edf83f908 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 25 Nov 2024 21:21:17 +0100 Subject: Add a make target for producing a release archive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- Makefile | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 03febb5..a408630 100644 --- a/Makefile +++ b/Makefile @@ -56,13 +56,15 @@ endif ## # Paths -SRC = $(filter-out kernel/fbos.ld.S, $(wildcard kernel/*.S kernel/*.c lib/*.c)) -OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(SRC))) -LINKER = kernel/fbos.ld -KRNL = fbos -USR = usr/bin/init usr/bin/fizz usr/bin/buzz usr/bin/fizzbuzz -INIT = usr/initramfs.cpio -TESTS = test/test_dt test/test_initrd +SRC = $(filter-out kernel/fbos.ld.S, $(wildcard kernel/*.S kernel/*.c lib/*.c)) +OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(SRC))) +LINKER = kernel/fbos.ld +KRNL = fbos +USR = usr/bin/init usr/bin/fizz usr/bin/buzz usr/bin/fizzbuzz +INIT = usr/initramfs.cpio +TESTS = test/test_dt test/test_initrd +TMP = tmp/ +ARCHIVE = fbos.tar.gz LDFLAGS += -T $(LINKER) @@ -127,6 +129,18 @@ test/%: test/%.o $(E) " TEST " $@ $(Q) $(HOSTCC) -Iinclude/ $< test/lib/*.o -o $@ +## +# Produce an archive for releases. + +.PHONY: archive +archive: all + $(Q) rm -rf $(TMP) && mkdir -p $(TMP) + $(Q) cp -r usr/ $(TMP) && rm -r $(TMP)/usr/src + $(Q) cp $(KRNL) $(TMP) + $(Q) tar czf $(ARCHIVE) $(TMP) + $(Q) rm -rf $(TMP) + $(E) " TAR $(ARCHIVE)" + ## # Hacking @@ -144,7 +158,7 @@ gdb: .PHONY: clean clean: - $(Q) rm -f $(OBJ) $(KRNL) $(LINKER) $(USR) usr/src/*.o $(INIT) test/*.o test/lib/*.o $(TESTS) + $(Q) rm -rf $(OBJ) $(KRNL) $(LINKER) $(USR) usr/src/*.o $(INIT) test/*.o test/lib/*.o $(TESTS) $(TMP) $(ARCHIVE) .PHONY: lint lint: -- cgit v1.2.3