Created
July 16, 2010 08:12
-
-
Save lauriro/478100 to your computer and use it in GitHub Desktop.
Makefile
This file contains 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
# | |
# Makefile for Project | |
# | |
# | |
# Tags: | |
# ===== | |
# | |
# Certain tags are used in comments to assist in indexing common issues: | |
# - TODO to indicate planned enhancements. | |
# - FIXME to mark potential problematic code that requires special | |
# attention and/or review. | |
# - BUG for founded bugs. | |
# - NOTE to document inner workings of code, indicate potential | |
# pitfalls and warn about of problematic or misguiding code. | |
# - THANKS for acknowledgments. | |
# | |
# There is a risk that tags accumulate over time; it is advisable to | |
# include the date and the tag owner in the comment to ease tracking. | |
# | |
# // TODO:2008-12-06:johnc:Add support for negative offsets. | |
# // While it is unlikely that we get a negative offset, it can | |
# // occur if the garbage collector runs out of space. | |
# | |
# THANKS: Ralf Holly - TODO or not TODO [http://www.approxion.com/?p=39] | |
# | |
# | |
# File structure: | |
# =============== | |
# | |
# Standard set of readme files: | |
# - README General information | |
# - LICENSE Copyright and licensing information | |
# - INSTALL Installation instructions | |
# | |
# Standard set of readme files generated by make: | |
# - AUTHORS Credits | |
# - THANKS Acknowledgments | |
# - ChangeLog A detailed changelog, intended for programmers | |
# - NEWS A basic changelog, intended for users | |
# - BUGS Known bugs and instructions on reporting new ones | |
# | |
# | |
OS=`uname -s` | |
all: | |
@echo "Hello $(OS)" | |
@echo "Try 'make help'" | |
# target: all - Default target. Does nothing. | |
help: | |
@grep -e "^# target:" Makefile | cut -c9- | |
# target: help - Display callable targets. | |
clean: | |
@git clean -xdf | |
# target: clean - Remove untracked files | |
doc: doc/authors doc/thanks doc/changelog doc/news doc/bugs doc/todo | |
# target: doc - generate all documentations. | |
doc/authors: | |
@echo -e "\nAuthors ordered by number of commits.\n" > AUTHORS | |
@git log --pretty="tformat:.%an <%ae>" | sort | uniq -c | sort -r | cut -d. -f2- >> AUTHORS | |
# @echo -e "\nAuthors ordered by alphabet.\n" > AUTHORS | |
# @git log --pretty='format:%an <%ae>' | sort -u >> AUTHORS | |
@cat AUTHORS | |
# target: doc/authors - generate AUTHORS file from git log. | |
doc/thanks: | |
@echo -e "\nThanks for acknowledgments ordered by alphabet.\n" > THANKS | |
@grep -rinE "(//|/\*|##*|--+)[ \t]*THANKS" * | sed 's/\([^:]*:[^:]*\)[/*# \t:-]*THANKS[: ]*\(.*\)/\2 \[\1\]/' | sort >> THANKS | |
@cat THANKS | |
# target: doc/thanks - generate THANKS file from source. | |
doc/changelog: | |
@rm ChangeLog | |
@git log --pretty="tformat:%d|%ci|%cn|%s" | while read LINE; do \ | |
REF=$${LINE%%|*}; \ | |
LINE=$${LINE#*|}; \ | |
if [ -n "$$REF" ]; then \ | |
DATE=$${LINE%%|*}; \ | |
LAST_REF=`echo "$$REF" | sed -n 's/.*v\([^, \)]*\).*/\1/p'`; \ | |
if [ -n "$$LAST_REF" ] ; then \ | |
echo -e "\n$${DATE%% *} version $$LAST_REF:\n" >> ChangeLog; \ | |
fi; \ | |
fi; \ | |
if [ -n "$$LAST_REF" ] ; then \ | |
LINE=$${LINE#*|}; \ | |
echo " * $${LINE#*|} ($${LINE%%|*})" >> ChangeLog; \ | |
fi; \ | |
done | |
@cat ChangeLog | |
# target: doc/changelog - generate ChangeLog from git log. | |
doc/news: | |
# TODO:2010-07-16:lauri:NEWS file generator not done | |
@echo "TODO" > NEWS | |
# target: doc/news - generate file NEWS from git log. | |
doc/bugs: | |
# TODO:2010-07-16:lauri:BUGS file generator not done | |
@echo "TODO" > BUGS | |
# target: doc/bugs - generate BUGS file from source. | |
doc/todo: | |
@grep -rinE "(//|/\*|##*|--+)[ \t]*+(TODO|FIXME)" * | \ | |
grep -v "# //" | \ | |
sed -e 's/\([^:]*:[^:]*\):[^/#-]*[ \t/\*#-]*\(.*\)/\2 \[\1\]/' | \ | |
sort -r > TODO | |
@cat TODO | |
# target: doc/todo - generate TODO file from source. | |
# display TODOs from comments. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment