Improved build commands

This commit is contained in:
2022-01-02 20:19:53 +01:00
parent e0979ed357
commit 271ab8860f
8 changed files with 54 additions and 29 deletions

View File

@@ -1,5 +1,8 @@
ifeq ($(BUILDROOT),)
$(error BUILDROOT IS NOT SET!)
endif
CC := x86_64-elf-gcc
CC := ${TARGET}-gcc
SRC := $(wildcard **/*.[cS])
OBJ := $(patsubst %, %.o, $(basename $(SRC)))
@@ -13,6 +16,7 @@ LDFLAGS := -n -nostdlib -lgcc -T Link.ld
kernel: $(OBJ)
$(LINK.c) $^ -o $@
# Automatic dependency tracking
DEP := $(OBJ:.o=.d)
DEPFLAGS = -MT $@ -MMD -MP -MF $*.d
$(OBJ): CPPFLAGS += $(DEPFLAGS)
@@ -30,4 +34,5 @@ clean:
.PHONY: install
# Include automatic dependency rules
include $(DEP)