Hello! Here is my Makefile:
.PHONY: all
all: build run clean
.PHONY: build
build:
@echo Bulding...
@javac -classpath .:target/dependency/* -d . *.java 2> /dev/null
.PHONY: run
run:
@echo Running...
@echo Program output:
@java -classpath .:target/dependency/* Main
.PHONY: clean
clean:
@echo Cleaning up...
@rm -rf *.class
I need to emphasize messages like Building...
, Running...
with some colors. I’ve tried to modify my code as follows but it didn’t help me:
NO_COLOR=\x1b[0m
OK_COLOR=\x1b[32;01m
ERROR_COLOR=\x1b[31;01m
WARN_COLOR=\x1b[33;01m
OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)
ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)
WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)
.PHONY: all
all: build run clean
.PHONY: build
build:
@echo $(OK_COLOR)Bulding...$(NO_COLOR)
@javac -classpath .:target/dependency/* -d . *.java 2> /dev/null
.PHONY: run
run:
@echo Running...
@echo Program output:
@java -classpath .:target/dependency/* Main
.PHONY: clean
clean:
@echo Cleaning up...
@rm -rf *.class
What am I doing wrong?