From ff971aaa63e498a799a9ea5304ff64c3dc69ea34 Mon Sep 17 00:00:00 2001 From: Daniel Santos Date: Fri, 18 Mar 2022 22:03:33 +0000 Subject: add/update MAkefile * removed c99 as the c compiler variable * add doc rule * add build library rules for .a and .so * mem2 rule now tests for 000 arg instead of 0 * clean rule update for libraries * add numericx.h dependency to rules Signed-off-by: Daniel Santos --- Makefile | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 2e9aee2..a23289a 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,35 @@ -CC := c99 CFLAGS := -Wall -Wextra -O2 DEP := cli.c numericx.o .PHONY: all all: decimal-to-earth earth-to-decimal decimal-to-sun sun-to-decimal decimal-to-lori decimal-to-nonal_inf decimal-to-nonal lori-to-decimal nonal_inf-to-decimal nonal-to-decimal uninfinity decimal-to-binary binary-to-decimal -numericx.o: numericx.c - $(CC) $(CFLAGS) -c $^ +.PHONY: lib-dirs +lib-dirs: + @mkdir -p lib/{static,shared} +numericx.o: numericx.c numericx.h + $(CC) $(CFLAGS) -c numericx.c + +.PHONY: libnumericx.a libnumericx.so libnumericx.a: numericx.o - ar -rc libnumericx.a $^ - ranlib $@ + @make lib-dirs + ar -rcs lib/static/$@ $^ + +numericx-pic.o: numericx.c numericx.h + $(CC) $(CFLAGS) -fPIC -c numericx.c -o $@ + +libnumericx.so: numericx-pic.o + @make lib-dirs + $(CC) -shared $^ -o lib/shared/$@ + +.PHONY: libs +libs: libnumericx.a libnumericx.so -libs: libnumericx.a +.PHONY: doc +doc: + rm -Rf doc/* + doxygen decimal-to-earth: $(DEP) $(CC) $(CFLAGS) -DFROM_NUMERICALS=\"0123456789\" -DFROM_FIRST_NUMBER_VOID -DFROM_INFINITE_BASE -DTO_NUMERICALS=\"12345\" -o $@ $^ @@ -64,7 +81,7 @@ uninfinity: $(DEP) .PHONY: clean clean: - \rm -f *-to-* uninfinity *.o *.a + \rm -f *-to-* uninfinity *.o lib/static/*.a lib/shared/*.so .PHONY: run run: decimal-to-earth @@ -78,7 +95,7 @@ mem1: decimal-to-earth valgrind --leak-check=full --show-leak-kinds=all -s decimal-to-earth 999 mem2: decimal-to-earth - valgrind --leak-check=full --show-leak-kinds=all -s decimal-to-earth 0 + valgrind --leak-check=full --show-leak-kinds=all -s decimal-to-earth 000 mem3: decimal-to-earth valgrind --leak-check=full --show-leak-kinds=all -s decimal-to-earth abc -- cgit 1.4.1-2-gfad0