Build system: Added basic support for profiling
This commit is contained in:
parent
af71b6e75e
commit
783a8bac23
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
||||
first
|
||||
*.rom
|
||||
make.deps
|
||||
gmon.out
|
||||
|
20
Makefile
20
Makefile
@ -1,4 +1,6 @@
|
||||
QUIET=1
|
||||
PROFILING=1
|
||||
ADDRESS_SANITIZE=1
|
||||
|
||||
all:first
|
||||
|
||||
@ -22,11 +24,23 @@ else
|
||||
Q =
|
||||
endif
|
||||
|
||||
ifeq "${PROFILING}" "1"
|
||||
CFLAGS += -pg
|
||||
LDFLAGS += -pg
|
||||
endif
|
||||
ifeq "${ADDRESS_SANITIZE}" "1"
|
||||
CFLAGS += -fsanitize=address -ggdb
|
||||
LDFLAGS += -fsanitize=address -fsanitize=undefined -fsanitize=leak
|
||||
endif
|
||||
|
||||
all:${MAIN_ROM}
|
||||
|
||||
first: ${OBJECT_FILES}
|
||||
${QUIET_LINK}
|
||||
${Q}gcc -ggdb $^ -fsanitize=address -fsanitize=undefined -fsanitize=leak -lncursesw -ltinfow -lm -o $@
|
||||
${Q}gcc -ggdb $^ -lncursesw -ltinfow -lm -o $@ ${LDFLAGS}
|
||||
|
||||
gprof:
|
||||
gprof first -b|less
|
||||
|
||||
%.rom:%.asm first
|
||||
$(QUIET_FAS)
|
||||
@ -34,9 +48,9 @@ first: ${OBJECT_FILES}
|
||||
|
||||
%.o:%.c
|
||||
${QUIET_CC}
|
||||
${Q}gcc -ggdb -c $< -Wall -Wextra -Werror -fsanitize=address
|
||||
${Q}gcc -c $< -Wall -Wextra -Werror ${CFLAGS}
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
${QUIET_CLEAN}
|
||||
${Q} rm -f ${OBJECT_FILES} first ${ROMS}
|
||||
${Q} rm -f ${OBJECT_FILES} first ${ROMS} gmon.out
|
||||
|
Loading…
Reference in New Issue
Block a user