2021-11-04 20:26:31 +01:00
|
|
|
# Used to generated .d file that deal with header dependencies
|
|
|
|
CPPFLAGS = -MMD
|
2021-11-05 23:02:23 +01:00
|
|
|
LDFLAGS += -m elf_i386
|
|
|
|
CFLAGS += -m32 -Wall -Wextra -Werror -ffreestanding -fno-exceptions -fno-pie -fno-stack-protector -fno-tree-vectorize -nostdinc -fno-asynchronous-unwind-tables -g
|
|
|
|
LIBGCC = $(shell $(CC) -print-libgcc-file-name $(CFLAGS))
|
|
|
|
|
|
|
|
SUBDIRS := . kernel
|
|
|
|
|
|
|
|
ARCH?=x86
|
|
|
|
INCDIRS += $(foreach dir, $(SUBDIRS), -I$(dir))
|
|
|
|
CPPFLAGS += $(INCDIRS)
|
|
|
|
|
|
|
|
csrc=$(wildcard *.c)
|
|
|
|
cobj=$(csrc:%.c=%.o)
|
|
|
|
deps=$(csrc:%.c=%.d)
|
|
|
|
|
|
|
|
PROG = user
|
|
|
|
|
|
|
|
$(PROG) : $(cobj) linker.ld
|
|
|
|
$(CC) -static -Wl,--warn-common $(CFLAGS) -nostdlib -o $@ -T linker.ld $(cobj) $(LIBGCC)
|
|
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM) $(PROG) $(cobj) $(deps)
|
|
|
|
|
|
|
|
ifneq ($(MAKECMDGOALS),clean)
|
|
|
|
-include $(deps)
|
|
|
|
endif
|