aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorMarvin Borner2021-12-30 17:23:51 +0100
committerMarvin Borner2021-12-30 17:23:51 +0100
commit028755c57007c3241e287b9927c6810814eecde1 (patch)
treec4c5a8826390f651f975425f96e275395db43c19 /makefile
parent6236c3d88ccba4429cbb4020ea0ed02816282451 (diff)
Makemake crakecrake
Diffstat (limited to 'makefile')
-rw-r--r--makefile15
1 files changed, 9 insertions, 6 deletions
diff --git a/makefile b/makefile
index c05d506..899ffb8 100644
--- a/makefile
+++ b/makefile
@@ -22,16 +22,19 @@ compile: all sync
clean:
@rm -rf $(BUILD)/*
-run: compile $(BUILD) $(BUILD)/disk.img
+clean_disk:
+ @rm -rf $(BUILD)/*.img
+
+run: compile $(BUILD) clean_disk $(BUILD)/disk.img
sync: # Ugly hack
- @$(MAKE) --always-make --dry-run | grep -wE 'gcc' | grep -w '\-c' | jq -nR '[inputs|{directory: match("/marfs/build/[^.]+").string[14:], command: ., file: match(" [^ ]+$$").string[1:]}]' >compile_commands.json &
+ @$(MAKE) --always-make --dry-run | grep -wE 'gcc' | jq -nR '[inputs|{directory: ".", command: ., file: match(" [^ ]+$$").string[1:]}]' >compile_commands.json &
@$(TG) -R --exclude=.git --exclude=build . &
$(BUILD)/%.c.o: %.c
- @$(CC) $(CFLAGS) $< -o $(patsubst $(BUILD)/$(SRC)/%.c.o,$(BUILD)/%,$@)
+ @$(CC) $(CFLAGS) $< -o $(patsubst $(BUILD)/$(SRC)/%.c.o,$(BUILD)/marfs_%,$@)
-.PHONY: all run compile clean sync
+.PHONY: all run compile clean clean_disk sync
$(BUILD):
@mkdir -p $@
@@ -40,6 +43,6 @@ $(BUILD):
@dd if=/dev/zero of=$@ bs=1k count=32k status=none
@DEV=$$($(SU) losetup --find --partscan --show $@) && \
PART="p1" && \
- $(SU) parted -s "$$DEV" mklabel msdos mkpart primary ext2 32k 100% -a minimal set 1 boot on && \
- echo Formatting... && \
+ $(SU) parted -s "$$DEV" mklabel msdos mkpart primary 32k 100% -a minimal set 1 boot on && \
+ $(SU) ./build/marfs_mkfs "$$DEV$$PART" && \
$(SU) losetup -d "$$DEV"