all repos — 3ByteBadVM @ 26457be29042435c16fecfca6a769791e0de512b

3ByteBadVM

Makefile

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
# 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

# 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