about summary refs log tree commit diff stats
path: root/Makefile
diff options
context:
space:
mode:
authorDaniel Santos <dacs.git@brilhante.top>2022-03-19 08:22:20 +0000
committerDaniel Santos <dacs.git@brilhante.top>2022-03-19 08:22:20 +0000
commit9e89a656769bd54941b61013974f86d4df973e30 (patch)
tree1b62bce9598e7379058828de27f44d7710b211d1 /Makefile
parentf5421e76128a30138b0298e2ec29ad5a0f07249c (diff)
downloadnumericx-c-9e89a656769bd54941b61013974f86d4df973e30.tar.gz
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 <dacs.git@brilhante.top>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files 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/*