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>
This commit is contained in:
parent
f5421e7612
commit
9e89a65676
15
Makefile
15
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/*
|
||||
|
|
Loading…
Reference in New Issue