44 lines
956 B
Makefile
44 lines
956 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
|
||
|
DEBUG = -g -ggdb -D DEBUG -lreadline
|
||
|
#HEADERS = vm.h
|
||
|
SRCS = main.c
|
||
|
ROM = rom.bin
|
||
|
OUT = hard
|
||
|
|
||
|
all: $(OUT)
|
||
|
|
||
|
# Useful for some projects
|
||
|
#%.o: %c %.h
|
||
|
# $(CC) $(CLFAGS) -c $^
|
||
|
|
||
|
$(OUT): ./src/$(SRCS)
|
||
|
./bin/ass.sh ./src/rom.asm ./src/zeropage.incbin
|
||
|
xxd -i ./src/$(ROM) > ./src/rom.h
|
||
|
$(CC) $(CFLAGS) -o ./bin/$@ $^
|
||
|
strip ./bin/$@
|
||
|
|
||
|
debug: ./src/$(SRCS)
|
||
|
./bin/ass.sh ./src/rom.asm ./src/zeropage.incbin
|
||
|
xxd -i ./src/$(ROM) > ./src/rom.h
|
||
|
$(CC) $(CFLAGS) $(DEBUG) -o ./bin/$(OUT)-$@ $^
|
||
|
|
||
|
disass: ./src/disass.c
|
||
|
$(CC) $(CFLAGS) $(DEBUG) -o ./bin/$@ $^
|
||
|
|
||
|
.PHONY: clean
|
||
|
clean:
|
||
|
rm -f ./bin/$(BIN)*
|
||
|
rm -f ./bin/disass
|
||
|
|