First/Makefile

43 lines
900 B
Makefile

QUIET=1
all:first
OBJECT_FILES=gui.o main.o simdata.o assembly.o cpu.o
MAIN_ROM=programs/3d_renderer.rom
ROMS=test.rom ${MAIN_ROM}
make.deps: $(subst .o,.c,${OBJECT_FILES}) $(wildcard *.h)
@$(CC) -MM $(subst .o,.c,${OBJECT_FILES}) > make.deps
include make.deps
ifeq "${QUIET}" "1"
QUIET_CC = @echo ' CC '$@;
QUIET_LINK = @echo ' LINK '$@;
QUIET_FAS = @echo ' FAS '$@;
QUIET_CLEAN = @echo ' CLEAN .';
Q = @
else
Q =
endif
all:${MAIN_ROM}
first: ${OBJECT_FILES}
${QUIET_LINK}
${Q}gcc -ggdb $^ -fsanitize=address -fsanitize=undefined -fsanitize=leak -lncursesw -ltinfow -o $@
%.rom:%.asm first
$(QUIET_FAS)
${Q}./first -i $< -a $@
%.o:%.c
${QUIET_CC}
${Q}gcc -ggdb -c $< -Wall -Wextra -Werror -fsanitize=address
.PHONY: clean
clean:
${QUIET_CLEAN}
${Q} rm -f ${OBJECT_FILES} first ${ROMS}