aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Iezzi <aiezzi@alessandroiezzi.it>2021-04-08 13:53:28 +0200
committerAlessandro Iezzi <aiezzi@alessandroiezzi.it>2021-04-08 13:53:28 +0200
commitf3e4e9d3047f18bd1c31f04d8eb9867600d7cbd9 (patch)
tree38326ec49baf2abe2c9323f7d32f97c1d7634c96
parent847f67c0057e870df68fc0a69af8679d3d7fe19c (diff)
downloadacme-scripts-f3e4e9d3047f18bd1c31f04d8eb9867600d7cbd9.tar.gz
acme-scripts-f3e4e9d3047f18bd1c31f04d8eb9867600d7cbd9.zip
Enhance Makefile
-rw-r--r--Makefile27
1 files changed, 20 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 69868ce..644a361 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,23 @@
-all:
- echo "Usage: make install"
+INSTALL_DIR=~/bin/acme
+BUILD_DIR=build
-install: uninstall
- chmod +x *sh
- find `pwd` -type f -name "*.sh" -exec ln -s {} ~/bin/acme/ ';'
- find ~/bin/acme/ -type l -name "*.sh" -exec renamex -s/.sh// '{}' \;
+.SUFFIXES: .sh .o
+
+SOURCES!=ls *.sh
+OBJECTS=${SOURCES:.sh=}
+D!=echo $(OBJECTS) | sed "s|^|$(INSTALL_DIR)/|g" | sed "s| | $(INSTALL_DIR)/|g"
+
+.sh:
+ chmod +x ${.IMPSRC}
+ ln -s ${.CURDIR}/${.IMPSRC} ${.TARGET}
+
+build: $(OBJECTS)
+
+clean:
+ find ${.CURDIR} -type l -exec rm -f '{}' \;
+
+install: build
+ find ${.CURDIR} -type l -exec cp -R -P '{}' ${INSTALL_DIR}/ \;
uninstall:
- rm -f ~/bin/acme/*
+ rm -f $(D)