From f3e4e9d3047f18bd1c31f04d8eb9867600d7cbd9 Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Thu, 8 Apr 2021 13:53:28 +0200 Subject: Enhance Makefile --- Makefile | 27 ++++++++++++++++++++------- 1 file 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) -- cgit v1.2.3