aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-11-27 16:30:00 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-11-27 16:30:00 +0100
commit45fa70a9c9892c980561785db323016e6080177d (patch)
treee1bc1958cd59a9891f2af1295aef900c90ca268c /Makefile
parentb0ea42e4a95478197d4d7e73791dae012cda6a4a (diff)
downloadfbos-45fa70a9c9892c980561785db323016e6080177d.tar.gz
fbos-45fa70a9c9892c980561785db323016e6080177d.zip
Use mktemp when generating the archive
Instead of manually making a temporary directory, do it through 'mktemp', which feels cleaner. Moreover, the base directory will now by named 'fbos' instead of the cryptic 'tmp' one. This is quite relevant when you uncompress the archive into another machine. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 5 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index bf27042..70000a1 100644
--- a/Makefile
+++ b/Makefile
@@ -63,7 +63,6 @@ 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)
@@ -134,11 +133,10 @@ test/%: test/%.o
.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)
+ $(Q) $(eval DIR := $(shell mktemp -d))
+ $(Q) mkdir -p $(DIR)/fbos && cp $(KRNL) $(INIT) $(DIR)/fbos/
+ $(Q) cd $(DIR) && tar czf $(ARCHIVE) fbos/
+ $(Q) cp $(DIR)/$(ARCHIVE) .
$(E) " TAR $(ARCHIVE)"
##
@@ -158,7 +156,7 @@ gdb:
.PHONY: clean
clean:
- $(Q) rm -rf $(OBJ) $(KRNL) $(LINKER) $(USR) usr/src/*.o $(INIT) test/*.o test/lib/*.o $(TESTS) $(TMP) $(ARCHIVE)
+ $(Q) rm -rf $(OBJ) $(KRNL) $(LINKER) $(USR) usr/src/*.o $(INIT) test/*.o test/lib/*.o $(TESTS) $(ARCHIVE)
.PHONY: lint
lint: