43 lines
802 B
Makefile
43 lines
802 B
Makefile
.PHONY: all clean
|
|
|
|
ARCH ?= x86_64
|
|
|
|
CFLAGS := -ffreestanding -Wall -Wextra -g -fcommon
|
|
|
|
CFLAGS += -I. \
|
|
-I../limine \
|
|
-DPRINTF_INCLUDE_CONFIG_H=1
|
|
|
|
LDFLAGS := -nostdlib -static -T arch/$(ARCH)/link.ld
|
|
|
|
include arch/$(ARCH)/$(ARCH).mk
|
|
include extconf/extra.mk
|
|
|
|
SRCFILES := $(wildcard *.c) \
|
|
$(wildcard printf/*.c) \
|
|
$(wildcard bitmap/*.c) \
|
|
$(wildcard pmm/*.c) \
|
|
$(wildcard bootinfo/*.c) \
|
|
$(wildcard hal/*.c) \
|
|
$(wildcard hal/$(ARCH)/*.c) \
|
|
$(wildcard hal/$(ARCH)/*.S) \
|
|
$(wildcard *.S)
|
|
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
|
|
|