From 9e89a656769bd54941b61013974f86d4df973e30 Mon Sep 17 00:00:00 2001 From: Daniel Santos Date: Sat, 19 Mar 2022 08:22:20 +0000 Subject: add to Makefile * change make into $(MAKE) * in compiling libraries, echo message with path * create Makefile variables: INSTALL and prefix * add rule install-lib Signed-off-by: Daniel Santos --- Makefile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a23289a..09212b9 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ CFLAGS := -Wall -Wextra -O2 DEP := cli.c numericx.o +INSTALL := install + +prefix = /usr + .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 @@ -13,19 +17,24 @@ numericx.o: numericx.c numericx.h .PHONY: libnumericx.a libnumericx.so libnumericx.a: numericx.o - @make lib-dirs + @$(MAKE) lib-dirs ar -rcs lib/static/$@ $^ + @echo Compiled successfully to ./lib/static/ numericx-pic.o: numericx.c numericx.h $(CC) $(CFLAGS) -fPIC -c numericx.c -o $@ libnumericx.so: numericx-pic.o - @make lib-dirs + @$(MAKE) lib-dirs $(CC) -shared $^ -o lib/shared/$@ + @echo Compiled successfully to ./lib/shared/ -.PHONY: libs +.PHONY: libs install-lib libs: libnumericx.a libnumericx.so +install-lib: libnumericx.so + $(INSTALL) -m 755 lib/shared/libnumericx.so $(prefix)/lib/ + .PHONY: doc doc: rm -Rf doc/* -- cgit 1.4.1-2-gfad0