50 lines
969 B
Makefile
50 lines
969 B
Makefile
# TODO: enforce c99
|
|
# eventually add -Wextra
|
|
|
|
# Personal makefile notes:
|
|
# '$@' gets replaced with the target name
|
|
# '$^' gets replaced with the target's dependencies (to right of target name)
|
|
# For more, check out https://youtu.be/G5dNorAoeCM
|
|
|
|
# Note: I understand this makefile is not as optimal as it could/should be
|
|
|
|
CC = gcc
|
|
CFLAGS ?= -Wall -Wpedantic -Wextra -std=c99
|
|
ROM = rom.bin
|
|
TRACE_SUFFIX =
|
|
|
|
all: hard
|
|
|
|
trace: CFLAGS += -g -ggdb -DTRACE -lreadline
|
|
trace: TRACE_SUFFIX = -trace
|
|
trace: hard
|
|
|
|
|
|
disass: CFLAGS += -DTRACE -lreadline
|
|
disass: bin/disass.o bin/vm.o
|
|
$(CC) $(CFLAGS) -o bin/$@ $^
|
|
|
|
bin/%.o: src/%.c
|
|
$(CC) $(CFLAGS) -o $@ -c $^
|
|
|
|
bin/vm.o:
|
|
bin/main.o:
|
|
bin/disass.o:
|
|
|
|
rom: rom.bin
|
|
xxd -i src/$^ > src/$@.h
|
|
|
|
rom.bin: src/rom.asm src/zeropage.incbin
|
|
./ass.sh src/rom.asm src/zeropage.incbin
|
|
|
|
hard: bin/main.o bin/vm.o
|
|
$(CC) $(CFLAGS) -o bin/$@$(TRACE_SUFFIX) $^
|
|
|
|
clean:
|
|
rm -f bin/*
|
|
cleano:
|
|
rm -f bin/*.o
|
|
|
|
.PHONY: all trace clean clean
|
|
|