Mise en évidence des couleurs des avertissements et des erreurs Makefile

J'ai écrit un Makefile qui fonctionne très bien; je suis en train de poster la partie objet de l'enquête:

BUILD_PRINT = @echo -e "\e[1;34mBuilding $<\e[0m"
COMPILE_cpp = $(CXX) $(CFLAGS) -o $@ -c $< $(MAKEDEP) $(INCLUDES)
%.o : %.cpp
    $(BUILD_PRINT)
    $(COMPILE_cpp)
.SUFFIXES: .o .cpp

Je tiens à souligner les erreurs et avertissements donnés par le compilateur sans l'aide d'outils externes (tels que colorgcc ou CMake); j'ai pensé qu'une bonne façon de pirater c'est par "script bash astuces". En regardant la solution posté dans Comment puis-je mettre en évidence l'avertissement et d'erreur de lignes dans la sortie? j'ai essayé ce qui suit:

pathpat="(/[^/]*)+:[0-9]+"
ccred=$(echo -e "3[0;31m")
ccyellow=$(echo -e "3[0;33m")
ccend=$(echo -e "3[0m")

BUILD_PRINT = @echo -e "\e[1;34mBuilding $<\e[0m"
COMPILE_cpp = $(CXX) $(CFLAGS) -o $@ -c $< $(MAKEDEP) $(INCLUDES)
%.o : %.cpp
    $(BUILD_PRINT)
    $(COMPILE_cpp) 2>&1 | sed -e "/[Ee]rror[: ]/s%$pathpat%$ccred&$ccend%g" -e "/[Ww]arning[: ]/s%$pathpat%$ccyellow&$ccend%g" echo "${PIPESTATUS[0]}"
.SUFFIXES: .o .cpp

mais ça ne fonctionne pas. J'obtiens le résultat suivant

Building main.cpp
g++ -o main.o -c main.cpp  2>&1 | sed -e "/[Ee]rror[: ]/s%athpat%cred&cend%g" -e "/[Ww]arning[: ]/s%athpat%cyellow&cend%g" echo ""
sed: can't read echo: No such file or directory
sed: can't read : No such file or directory

Merci d'avance!

source d'informationauteur helmet_23