#!/bin/bash mv Makefile Makefile.bak echo -e "# Autogenerated at $(date +'%d.%m.%Y %H:%M') using ${BASH_SOURCE[0]}\n" > Makefile for file in ./packs/*; do cat ${file} >> Makefile echo >> Makefile done; for file in ./install/*; do name=${file##*/} name=${name%.sh} desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file}) [ -z "$desc" ] && desc='' echo -e "##${name}: ${desc}\n${name}:\n\t@${file}\n" >> Makefile done; cat << "EOF" >> Makefile ##help: Show this help message help: Makefile @echo "Usage:" @echo "\tmake \t - Install software" @echo "\tmake +\t - Install software" @echo "\tmake ^\t - Upgrade software" @echo "\tmake @\t - Uninstall software" @echo "Available goals:" @sed -n 's/^##//p' $< | column -ts ':' | sed -e "s/^/\t/" +%: @$(MAKE) $* ^%: @./upgrade/$* @%: @./uninstall/$* EOF echo "New ./Makefile has been generated!" echo "Old one has been saved as ./Makefile.bak" echo make -s help