2024-01-29 13:03:43 +00:00
|
|
|
QUIET=1
|
2024-02-20 02:12:57 +00:00
|
|
|
PROFILING=1
|
|
|
|
ADDRESS_SANITIZE=1
|
2024-01-29 13:03:43 +00:00
|
|
|
|
2024-01-22 12:11:07 +00:00
|
|
|
all:first
|
|
|
|
|
2024-02-03 22:54:20 +00:00
|
|
|
OBJECT_FILES=gui.o main.o simdata.o assembly.o cpu.o
|
2024-02-16 18:11:58 +00:00
|
|
|
MAIN_ROM=programs/3d_renderer.rom
|
|
|
|
ROMS=test.rom ${MAIN_ROM}
|
2024-02-03 22:54:20 +00:00
|
|
|
|
|
|
|
make.deps: $(subst .o,.c,${OBJECT_FILES}) $(wildcard *.h)
|
|
|
|
@$(CC) -MM $(subst .o,.c,${OBJECT_FILES}) > make.deps
|
|
|
|
|
|
|
|
include make.deps
|
|
|
|
|
2024-01-29 13:03:43 +00:00
|
|
|
|
|
|
|
ifeq "${QUIET}" "1"
|
|
|
|
QUIET_CC = @echo ' CC '$@;
|
|
|
|
QUIET_LINK = @echo ' LINK '$@;
|
2024-02-03 18:03:37 +00:00
|
|
|
QUIET_FAS = @echo ' FAS '$@;
|
2024-01-29 13:03:43 +00:00
|
|
|
QUIET_CLEAN = @echo ' CLEAN .';
|
|
|
|
Q = @
|
|
|
|
else
|
|
|
|
Q =
|
|
|
|
endif
|
|
|
|
|
2024-02-20 02:12:57 +00:00
|
|
|
ifeq "${PROFILING}" "1"
|
|
|
|
CFLAGS += -pg
|
|
|
|
LDFLAGS += -pg
|
|
|
|
endif
|
|
|
|
ifeq "${ADDRESS_SANITIZE}" "1"
|
|
|
|
CFLAGS += -fsanitize=address -ggdb
|
|
|
|
LDFLAGS += -fsanitize=address -fsanitize=undefined -fsanitize=leak
|
|
|
|
endif
|
|
|
|
|
2024-02-16 18:11:58 +00:00
|
|
|
all:${MAIN_ROM}
|
2024-02-03 18:03:37 +00:00
|
|
|
|
2024-01-29 13:03:43 +00:00
|
|
|
first: ${OBJECT_FILES}
|
|
|
|
${QUIET_LINK}
|
2024-02-20 02:12:57 +00:00
|
|
|
${Q}gcc -ggdb $^ -lncursesw -ltinfow -lm -o $@ ${LDFLAGS}
|
|
|
|
|
|
|
|
gprof:
|
|
|
|
gprof first -b|less
|
2024-01-22 12:11:07 +00:00
|
|
|
|
2024-02-03 18:03:37 +00:00
|
|
|
%.rom:%.asm first
|
|
|
|
$(QUIET_FAS)
|
2024-02-16 17:06:27 +00:00
|
|
|
${Q}./first -i $< -a $@
|
2024-02-03 18:03:37 +00:00
|
|
|
|
2024-01-22 12:11:07 +00:00
|
|
|
%.o:%.c
|
2024-01-29 13:03:43 +00:00
|
|
|
${QUIET_CC}
|
2024-02-20 02:12:57 +00:00
|
|
|
${Q}gcc -c $< -Wall -Wextra -Werror ${CFLAGS}
|
2024-01-22 12:11:07 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2024-01-29 13:03:43 +00:00
|
|
|
${QUIET_CLEAN}
|
2024-02-20 02:12:57 +00:00
|
|
|
${Q} rm -f ${OBJECT_FILES} first ${ROMS} gmon.out
|