diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-11-27 16:30:00 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-11-27 16:30:00 +0100 |
| commit | 45fa70a9c9892c980561785db323016e6080177d (patch) | |
| tree | e1bc1958cd59a9891f2af1295aef900c90ca268c | |
| parent | b0ea42e4a95478197d4d7e73791dae012cda6a4a (diff) | |
| download | fbos-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>
| -rw-r--r-- | Makefile | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -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: |
