summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-02-06 11:18:14 -0800
committerBen Longbons <b.r.longbons@gmail.com>2014-02-06 11:18:37 -0800
commit0177b97ba96407e00636711b1aa71b8ddf3f9ed6 (patch)
treecbaf245899610d609094ab087d8b9586376cb2b7
parent9215c35975be745628e8188473154c7e476add55 (diff)
downloadtmwa-0177b97ba96407e00636711b1aa71b8ddf3f9ed6.tar.gz
tmwa-0177b97ba96407e00636711b1aa71b8ddf3f9ed6.tar.bz2
tmwa-0177b97ba96407e00636711b1aa71b8ddf3f9ed6.tar.xz
tmwa-0177b97ba96407e00636711b1aa71b8ddf3f9ed6.zip
Add a little color
-rw-r--r--Makefile.in35
-rwxr-xr-xtools/colorize39
2 files changed, 60 insertions, 14 deletions
diff --git a/Makefile.in b/Makefile.in
index 64b0c27..9871843 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -46,6 +46,8 @@ ENABLE_CYGWIN_HACKS = @ENABLE_CYGWIN_HACKS@
ENABLE_COMPAT_SYMLINKS = @ENABLE_COMPAT_SYMLINKS@
ENABLE_DEBUG = @ENABLE_DEBUG@
+TESTER =
+TEST_ARGS =
## real.make - The One Makefile that builds them all.
@@ -143,6 +145,11 @@ $(info The Road goes ever on and on ...)
endif
endif
+c = @colorize 6: 2:$< 3:$@ :
+ifneq '$c' ''
+l = @colorize 6: $(patsubst %,2:%,$^) 3:$@ :
+endif
+
.SUFFIXES:
# make 3.81 doesn't support 'undefine' and Debian hasn't shipped it yet
# even though all the related bugs have already been fixed.
@@ -273,19 +280,19 @@ s: ${ASSEMBLED}
o: ${OBJECTS}
mostlyclean:
- rm -rf obj conf-raw
+ $c rm -rf obj conf-raw
clean: mostlyclean
- rm -rf bin
+ $c rm -rf bin
distclean: clean gen-clean
gen-clean:
- rm -f ${GEN_SOURCES} ${GEN_HEADERS}
+ $c rm -f ${GEN_SOURCES} ${GEN_HEADERS}
%.cpp: %.lpp
$(MKDIR_FIRST)
- ${FLEX} -o $@ $<
+ $c ${FLEX} -o $@ $<
%.cpp %.hpp: %.ypp
$(MKDIR_FIRST)
- ${BISON} -d -o $*.cpp $<
+ $c ${BISON} --defines=$*.hpp -o $*.cpp $<
ifndef MAKE_RESTARTS
# prevent errors if missing header
obj/%.d: src/%.cpp
@@ -300,19 +307,19 @@ endif
# the above SRC_DIR replacement is not really safe, but it works okayish.
obj/%.ii: src/%.cpp
$(MKDIR_FIRST)
- ${CXX} ${CPPFLAGS} -E -o $@ $<
+ $c ${CXX} ${CPPFLAGS} -E -o $@ $<
obj/%.ll: src/%.cpp
$(MKDIR_FIRST)
- ${CXX} ${CPPFLAGS} ${CXXFLAGS} -S -emit-llvm -o $@ $<
+ $c ${CXX} ${CPPFLAGS} ${CXXFLAGS} -S -emit-llvm -o $@ $<
obj/%.bc: src/%.cpp
$(MKDIR_FIRST)
- ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -emit-llvm -o $@ $<
+ $c ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -emit-llvm -o $@ $<
obj/%.s: src/%.cpp
$(MKDIR_FIRST)
- ${CXX} ${CPPFLAGS} ${CXXFLAGS} -S -o $@ $<
+ $c ${CXX} ${CPPFLAGS} ${CXXFLAGS} -S -o $@ $<
obj/%.o: src/%.cpp
$(MKDIR_FIRST)
- ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<
+ $c ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<
obj/%/autolist.d: $(filter-out %/autolist.d,${DEPENDS})
echo $@: $(filter %_test.d,$^) > $@
@@ -323,7 +330,7 @@ include ${DEPENDS}
# doesn't need to be rebuilt. For release, the version forces rebuild.
bin/%:
$(MKDIR_FIRST)
- ${CXX} ${LDFLAGS} $^ ${LDLIBS} -o $@
+ $l ${CXX} ${LDFLAGS} $^ ${LDLIBS} -o $@
cat ${SRC_DIR}/src/main-gdb-head.py \
$(wildcard $(patsubst obj/%.o,${SRC_DIR}/src/%.py,$^)) \
${SRC_DIR}/src/main-gdb-tail.py \
@@ -336,11 +343,11 @@ $(filter %_test.o,${OBJECTS}) obj/gtest-all.o: override CPPFLAGS += -DGTEST_HAS_
obj/gtest-all.o: override WARNINGS :=
obj/gtest-all.o: ${GTEST_DIR}/src/gtest-all.cc
$(MKDIR_FIRST)
- ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<
+ $c ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<
test: $(patsubst bin/%,.run-%,${TEST_BINARIES})
.run-%: bin/%
- $<
+ ${TESTER} $< ${TEST_ARGS}
install := install --backup=${ENABLE_BACKUPS_DURING_INSTALL}
install_exe := ${install}
@@ -383,7 +390,7 @@ else
endif
tags: ${SOURCES} ${HEADERS}
- ctags --totals -h .tcc --langmap=C++:+.tcc --c-kinds=+px -f $@ $^
+ $l ctags --totals -h .tcc --langmap=C++:+.tcc --c-kinds=+px -f $@ $^
Makefile: ${SRC_DIR}/Makefile.in
@echo Makefile.in updated, reconfiguring ...
diff --git a/tools/colorize b/tools/colorize
new file mode 100755
index 0000000..ae4cb56
--- /dev/null
+++ b/tools/colorize
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+
+import os
+import sys
+
+def color(i):
+ if 0 <= i < 8:
+ return '\x1b[%dm' % (30 + i)
+ if 8 <= i < 16:
+ return '\x1b[%dm' % (90 + (i - 8))
+
+def main(argv):
+ colors = {}
+ while argv:
+ arg0 = argv[0]
+ del argv[0]
+ if arg0 == ':':
+ break
+ if ':' not in arg0:
+ continue
+ c, w = arg0.split(':', 1)
+ colors[w] = color(int(c))
+ if 1:
+ arg = argv[0]
+ c = colors.get('', '')
+ e = c and '\x1b[m'
+ print(c, arg, e, sep='', end=''),
+ for arg in argv[1:]:
+ c = colors.get(arg, '')
+ e = c and '\x1b[m'
+ print(' ', c, arg, e, sep='', end=''),
+ print()
+ sys.stdout.flush()
+ os.execvp(argv[0], argv)
+
+if __name__ == '__main__':
+ main(sys.argv[:])