summary refs log tree commit diff stats
path: root/c/square-root/makefile
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2021-08-25 20:09:09 +0530
committerAndinus <andinus@nand.sh>2021-08-25 20:09:09 +0530
commit7ec482f4126a6ac5bff7fffaa16c84210df13fac (patch)
treedcc70acb77a9d0a95fa4e6718a8bea687b96f03c /c/square-root/makefile
parent61d8d8a336ca9a74eaf0e77e6ec9ab59f8bccddb (diff)
downloadexercism-7ec482f4126a6ac5bff7fffaa16c84210df13fac.tar.gz
C: Add square-root exercise
Diffstat (limited to 'c/square-root/makefile')
-rw-r--r--c/square-root/makefile37
1 files changed, 37 insertions, 0 deletions
diff --git a/c/square-root/makefile b/c/square-root/makefile
new file mode 100644
index 0000000..f34535a
--- /dev/null
+++ b/c/square-root/makefile
@@ -0,0 +1,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)