Populate repository from old progress; massive cleanup and fixes
This commit is contained in:
59
makefile
Normal file
59
makefile
Normal file
@@ -0,0 +1,59 @@
|
||||
# Makefile for CHIBI PC-09 Firmware
|
||||
|
||||
.PHONY: generate all clean
|
||||
.IGNORE: clean
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Project Defaults & Folders
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
TARGET := boot
|
||||
TARGREC := $(TARGET).s19
|
||||
TARGROM := $(TARGET).bin
|
||||
SRCDIR := src/
|
||||
BUILDDIR := build/
|
||||
GENS := $(SRCDIR)version.s
|
||||
SRCS := $(wildcard $(SRCDIR)*.s)
|
||||
OBJS := $(patsubst $(SRCDIR)%.s,$(BUILDDIR)%.o,$(SRCS))
|
||||
INCS := $(wildcard $(SRCDIR)*.inc)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Toolchain Definitions
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
AS := lwasm
|
||||
LD := lwlink
|
||||
FIX := objcopy
|
||||
|
||||
ASFLAGS := -f obj
|
||||
LDFLAGS := -f srec -m map.txt -s linkscript
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Rules and Phony Targets
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
all: $(TARGROM)
|
||||
|
||||
# Fix srec into flashable bin file
|
||||
$(TARGROM): $(TARGREC)
|
||||
$(FIX) -I srec -O binary $< $@
|
||||
|
||||
# Link objects
|
||||
$(TARGREC): $(OBJS)
|
||||
$(LD) $(LDFLAGS) -o $@ $^
|
||||
|
||||
# Assemble objects
|
||||
$(OBJS): $(BUILDDIR)%.o : $(SRCDIR)%.s
|
||||
-@mkdir -p $(BUILDDIR)
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
generate: $(GENS)
|
||||
|
||||
$(GENS):
|
||||
./genver.sh
|
||||
|
||||
clean:
|
||||
@echo 'Cleaning up intermediary files...'
|
||||
@rm -rv $(TARGROM) $(TARGREC) map.txt $(BUILDDIR)
|
||||
@rm -rv $(GENS)
|
||||
Reference in New Issue
Block a user