3ByteBadVM/Makefile

40 lines
795 B
Makefile
Raw Normal View History

2021-04-21 04:08:19 +00:00
# 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
2021-04-27 06:20:19 +00:00
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
# TODO: add rule to make rom.h
bin/%.o: src/%.c
$(CC) $(CFLAGS) -o $@ -c $^
bin/vm.o:
bin/main.o:
hard: bin/main.o bin/vm.o
$(CC) $(CFLAGS) -o bin/$@$(TRACE_SUFFIX) $^
clean: cleano
rm -f bin/hard bin/hard-trace
cleano:
rm -f bin/main.o bin/vm.o
.PHONY: all trace clean
2021-04-21 04:08:19 +00:00