72 lines
1.5 KiB
Makefile
72 lines
1.5 KiB
Makefile
.PHONY: all clean
|
|
|
|
ARCH ?= x86_64
|
|
PUTCHAR_ ?= fb
|
|
|
|
CFLAGS := -ffreestanding -Wall -Wextra -g -fcommon -nostdinc
|
|
|
|
CFLAGS += -I. \
|
|
-I../limine \
|
|
-I./std/include \
|
|
-I./flanterm/src \
|
|
-DPRINTF_INCLUDE_CONFIG_H=1 \
|
|
-DLFS_NO_ASSERT \
|
|
-DLFS_NO_DEBUG \
|
|
-DLFS_NO_WARN \
|
|
-DLFS_NO_ERROR
|
|
|
|
ifeq ($(PUTCHAR_),fb)
|
|
CFLAGS += -DPUTCHAR_=PUTCHAR_FB
|
|
else
|
|
CFLAGS += -DPUTCHAR_=PUTCHAR_SERIAL
|
|
endif
|
|
|
|
include arch/$(ARCH)/$(ARCH).mk
|
|
include extconf/extra.mk
|
|
|
|
LDFLAGS := -nostdlib -static -T arch/$(ARCH)/link.ld $(shell $(CC) -print-libgcc-file-name)
|
|
|
|
SRCFILES := $(wildcard *.c) \
|
|
$(wildcard printf/*.c) \
|
|
$(wildcard bitmap/*.c) \
|
|
$(wildcard pmm/*.c) \
|
|
$(wildcard bootinfo/*.c) \
|
|
$(wildcard spinlock/*.c) \
|
|
$(wildcard term/*.c) \
|
|
$(wildcard vmm/*.c) \
|
|
$(wildcard dlmalloc/*.c) \
|
|
$(wildcard vfs/*.c) \
|
|
$(wildcard storedev/*.c) \
|
|
$(wildcard util/*.c) \
|
|
$(wildcard fs/kvfs/*.c) \
|
|
$(wildcard fs/littlefs/*.c) \
|
|
$(wildcard fs/portlfs/*.c) \
|
|
$(wildcard baseimg/*.c) \
|
|
$(wildcard hal/*.c) \
|
|
$(wildcard hal/$(ARCH)/*.c) \
|
|
$(wildcard hal/$(ARCH)/*.S) \
|
|
$(wildcard paging/$(ARCH)/*.c) \
|
|
$(wildcard paging/*.c) \
|
|
$(wildcard *.S) \
|
|
$(wildcard std/*.c) \
|
|
$(wildcard flanterm/src/*.c) \
|
|
$(wildcard flanterm/src/flanterm_backends/*.c)
|
|
CFILES := $(filter %.c,$(SRCFILES))
|
|
ASFILES := $(filter %.S,$(SRCFILES))
|
|
OBJ := $(patsubst %.c,%.o,$(CFILES)) $(patsubst %.S,%.o,$(ASFILES))
|
|
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
%.o: %.S
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
all: mop2
|
|
|
|
mop2: $(OBJ)
|
|
$(LD) $^ $(LDFLAGS) -o $@
|
|
|
|
clean:
|
|
rm -f $(OBJ) mop2
|
|
|