pizza-gauntlet/makefile

47 lines
1021 B
Makefile
Raw Normal View History

2024-10-14 01:29:17 +00:00
# Set the project name here
NAME = gauntlet
OUTPUTDIR = output
TOOLCHAIN_ARCH := v810
TOOLCHAIN_DIR := $(HOME)/llvm-v810
# The rest of the Makefile should not need changing ...
BINDIR = $(TOOLCHAIN_DIR)/bin
INCDIR = $(TOOLCHAIN_DIR)/include
LIBDIR = $(TOOLCHAIN_DIR)/lib
AS = $(BINDIR)/llvm-mc
CC = $(BINDIR)/clang
LD = $(BINDIR)/ld.lld
OBJCOPY = $(BINDIR)/llvm-objcopy
ASFLAGS += --triple v810-unknown-vb -mcpu=vb --filetype=obj -g
LDFLAGS += -target v810-unknown-vb -mcpu=vb --ld-path=$(LD) -L$(LIBDIR) -Tvb.ld -nolibc -flto
SFILES := $(foreach dir,./,$(notdir $(wildcard $(dir)/*.s)))
SOBJS := $(OUTPUTDIR)/$(SFILES:.s=.o)
OFILES := $(SOBJS)
ELFFILES := $(OUTPUTDIR)/$(NAME).elf
VBFILES := $(OUTPUTDIR)/$(NAME).vb
.PHONY: all clean distclean
all: $(VBFILES)
$(VBFILES): $(ELFFILES)
@$(OBJCOPY) -S -O binary $< $@
$(ELFFILES): $(OFILES)
@$(CC) $(OFILES) $(LDFLAGS) -o $@
$(SOBJS): $(SFILES)
@$(AS) $(ASFLAGS) -o $@ $<
clean:
# @rm -f $(OFILES) $(VBFILES) $(ELFFILES)
@rm -f output/*
distclean: clean