makefile: Add percent complete calculation and display.
This commit is contained in:
parent
9dedd7b837
commit
452292a943
13
Makefile
13
Makefile
|
@ -9,6 +9,11 @@
|
||||||
|
|
||||||
VERSION := 0.5.0
|
VERSION := 0.5.0
|
||||||
|
|
||||||
|
# a bit of a hack to make sure this runs before any rules
|
||||||
|
ifneq ($(CALCULATING),yes)
|
||||||
|
TOTAL := $(shell $(MAKE) CALCULATING=yes -n | sed -n 's/^.*Compiling: \([^"]\+\)"/\1/p' > .files )
|
||||||
|
endif
|
||||||
|
|
||||||
all: make.conf FL Timeline
|
all: make.conf FL Timeline
|
||||||
|
|
||||||
make.conf: configure
|
make.conf: configure
|
||||||
|
@ -30,8 +35,14 @@ INCLUDES := -I. -Iutil -IFL
|
||||||
|
|
||||||
include scripts/colors
|
include scripts/colors
|
||||||
|
|
||||||
|
ifneq ($(CALCULATING),yes)
|
||||||
|
COMPILING="$(BOLD)$(BLACK)[$(SGR0)$(CYAN)`scripts/percent-complete .files "$<"`$(SGR0)$(BOLD)$(BLACK)]$(SGR0) Compiling: $(BOLD)$(YELLOW)$<$(SGR0)"
|
||||||
|
else
|
||||||
|
COMPILING="Compiling: $<"
|
||||||
|
endif
|
||||||
|
|
||||||
.C.o:
|
.C.o:
|
||||||
@ echo "Compiling: $(BOLD)$(YELLOW)$<$(SGR0)"
|
@ echo $(COMPILING)
|
||||||
@ $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
|
@ $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
|
||||||
|
|
||||||
%.C : %.fl
|
%.C : %.fl
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# May 2008 Jonathan Moore Liles
|
||||||
|
#
|
||||||
|
# Given the name of a file containing a list of files and a filename
|
||||||
|
# from that list, return the percentage of the distance from the
|
||||||
|
# beginning of the list.
|
||||||
|
|
||||||
|
[ $# -ne 2 ] && exit
|
||||||
|
|
||||||
|
MATCH="`grep -nFx \"$2\" \"$1\"`"
|
||||||
|
MATCH=${MATCH%%:*}
|
||||||
|
TOTAL="`cat \"$1\" | wc -l`"
|
||||||
|
|
||||||
|
if [ -z "$MATCH" ]
|
||||||
|
then
|
||||||
|
echo "0%"
|
||||||
|
else
|
||||||
|
printf "%3s%%" $(( $MATCH * 100 / $TOTAL ))
|
||||||
|
fi
|
Loading…
Reference in New Issue