-
-
Save KlfJoat/1329d536a6543a45f078 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAME=project | |
VERSION=0.0.1 | |
DIRS=etc lib bin sbin share | |
INSTALL_DIRS=`find $(DIRS) -type d 2>/dev/null` | |
INSTALL_FILES=`find $(DIRS) -type f 2>/dev/null` | |
DOC_FILES=*.md *.txt | |
PKG_DIR=pkg | |
PKG_NAME=$(NAME)-$(VERSION) | |
PKG=$(PKG_DIR)/$(PKG_NAME).tar.gz | |
SIG=$(PKG_DIR)/$(PKG_NAME).asc | |
PREFIX?=/usr/local | |
DOC_DIR=$(PREFIX)/share/doc/$(PKG_NAME) | |
pkg: | |
mkdir -p $(PKG_DIR) | |
$(PKG): pkg | |
git archive --output=$(PKG) --prefix=$(PKG_NAME)/ HEAD | |
build: $(PKG) | |
$(SIG): $(PKG) | |
gpg --sign --detach-sign --armor $(PKG) | |
sign: $(SIG) | |
clean: | |
rm -f $(PKG) $(SIG) | |
all: $(PKG) $(SIG) | |
test: | |
tag: | |
git tag v$(VERSION) | |
git push --tags | |
release: $(PKG) $(SIG) tag | |
install: | |
for dir in $(INSTALL_DIRS); do mkdir -p $(PREFIX)/$$dir; done | |
for file in $(INSTALL_FILES); do cp $$file $(PREFIX)/$$file; done | |
mkdir -p $(DOC_DIR) | |
cp -r $(DOC_FILES) $(DOC_DIR)/ | |
uninstall: | |
for file in $(INSTALL_FILES); do rm -f $(PREFIX)/$$file; done | |
rm -rf $(DOC_DIR) | |
.PHONY: build sign clean test tag release install uninstall all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Other good Makefile references (in order of decreasing readability :-)
http://mrbook.org/tutorials/make/
http://stackoverflow.com/questions/2481269/how-to-make-simple-c-makefile/2481326#2481326
http://www.gnu.org/software/make/manual/make.html