Skip to content

Commit c3d0fd9

Browse files
committed
fix: resolve build issues and make clean all race condition
This fixes a race condition where 'make clean all' would delete the build directory after it was created during Makefile parsing. It also removes the deprecated syscalls.ld dependency that was removed upstream.
1 parent 5bed6cf commit c3d0fd9

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,19 @@ OBJS := $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SRCS)) $(BUILD_DIR)/syscall
1919

2020
all: $(BUILD_DIR)/$(BIN)
2121

22-
_ := $(shell mkdir -p $(BUILD_DIR))
23-
2422
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
23+
@mkdir -p $(@D)
2524
$(CC) $(CFLAGS) -c $< -o $@
2625

2726
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.S
27+
@mkdir -p $(@D)
2828
$(CC) $(CFLAGS) -c $< -o $@
2929

3030
OBJCOPY := llvm-objcopy
3131

32-
$(BUILD_DIR)/$(BIN): $(OBJS) script.ld $(BUILD_DIR)/syscalls.ld
33-
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $(BUILD_DIR)/kexp.elf -Tscript.ld -T$(BUILD_DIR)/syscalls.ld
32+
$(BUILD_DIR)/$(BIN): $(OBJS) script.ld
33+
@mkdir -p $(@D)
34+
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $(BUILD_DIR)/kexp.elf -Tscript.ld
3435
$(OBJCOPY) -O binary $(BUILD_DIR)/kexp.elf $@
3536

3637
clean:

0 commit comments

Comments
 (0)