summary refs log tree commit diff stats
path: root/c/two-fer/makefile
blob: f34535afd3f368f0f29d88830b33498cdd57593b (plain) (blame)
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
### If you wish to use extra libraries (math.h for instance),
### add their flags here (-lm in our case) in the "LIBS" variable.

LIBS = -lm

###
CFLAGS  = -std=c99
CFLAGS += -g
CFLAGS += -Wall
CFLAGS += -Wextra
CFLAGS += -pedantic
CFLAGS += -Werror
CFLAGS += -Wmissing-declarations
CFLAGS += -DUNITY_SUPPORT_64

ASANFLAGS  = -fsanitize=address
ASANFLAGS += -fno-common
ASANFLAGS += -fno-omit-frame-pointer

.PHONY: test
test: tests.out
	@./tests.out

.PHONY: memcheck
memcheck: test/*.c src/*.c src/*.h
	@echo Compiling $@
	@$(CC) $(ASANFLAGS) $(CFLAGS) src/*.c test/vendor/unity.c test/*.c -o memcheck.out $(LIBS)
	@./memcheck.out
	@echo "Memory check passed"

.PHONY: clean
clean:
	rm -rf *.o *.out *.out.dSYM

tests.out: test/*.c src/*.c src/*.h
	@echo Compiling $@
	@$(CC) $(CFLAGS) src/*.c test/vendor/unity.c test/*.c -o tests.out $(LIBS)
registers 50/push-eax 51/push-ecx # { 81 7/subop/compare *Really-debug-print 0/imm32/false 74/jump-if-= break/disp8 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 *(ebp+8) *(ebp+0xc) *(ebp+0x10)) # clear the screen and continue if we got too close to the bottom (cursor-position 0) # => eax, ecx 81 7/subop/compare %ecx 0x28/imm32 75/jump-if-!= break/disp8 (clear-screen 0) (set-cursor-position 0 0 0) } $debug-print:end: # . restore registers 59/pop-to-ecx 58/pop-to-eax # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return debug-print?: # -> _/eax: boolean # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # 8b/-> *Really-debug-print 0/r32/eax $debug-print?:end: # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return turn-on-debug-print: # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # c7 0/subop/copy *Really-debug-print 1/imm32/true $turn-on-debug-print:end: # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return turn-off-debug-print: # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # c7 0/subop/copy *Really-debug-print 0/imm32/false $turn-off-debug-print:end: # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return == data Really-debug-print: 0/imm32/false #? 1/imm32/true