add timestamps to commands
This commit is contained in:
parent
8f9317f751
commit
d914f2ea62
2 changed files with 40 additions and 25 deletions
63
Makefile
63
Makefile
|
|
@ -25,6 +25,20 @@
|
|||
|
||||
export PATH := $(PATH):/usr/bin:/bin
|
||||
|
||||
# -- Colors -------------------------------------------------------------------
|
||||
|
||||
GREEN := \033[1;38;2;184;187;38m
|
||||
YELLOW := \033[1;38;2;250;189;47m
|
||||
RED := \033[1;38;2;251;73;52m
|
||||
CYAN := \033[1;38;2;131;165;152m
|
||||
NC := \033[0m
|
||||
|
||||
INFO = @printf '$(GREEN)[%s INFO]$(NC) %s\n' "$$(date +%H:%M:%S)"
|
||||
WARN = @printf '$(YELLOW)[%s WARN]$(NC) %s\n' "$$(date +%H:%M:%S)"
|
||||
ERROR = @printf '$(RED)[%s ERROR]$(NC) %s\n' "$$(date +%H:%M:%S)"
|
||||
CC_ = @printf '$(CYAN)[%s CC]$(NC) %s\n' "$$(date +%H:%M:%S)"
|
||||
SHD_ = @printf '$(CYAN)[%s SHADER]$(NC) %s\n' "$$(date +%H:%M:%S)"
|
||||
|
||||
# -- Platform detection -------------------------------------------------------
|
||||
|
||||
UNAME := $(shell uname)
|
||||
|
|
@ -83,6 +97,7 @@ endif
|
|||
|
||||
ifeq ($(PLATFORM),windows)
|
||||
LIBS = -lws2_32
|
||||
LDFLAGS += -Wl,/SUBSYSTEM:CONSOLE
|
||||
PXL8_DEF = $(BUILDDIR)/pxl8.def
|
||||
EXE_EXT = .exe
|
||||
else ifeq ($(UNAME),Darwin)
|
||||
|
|
@ -252,31 +267,31 @@ DEPS_OK = lib/luajit/src/luajit.c lib/miniz/miniz.c lib/fennel/fennel.lua $(LINE
|
|||
deps: $(DEPS_OK)
|
||||
|
||||
lib/luajit/src/luajit.c:
|
||||
@echo "[INFO] Fetching LuaJIT"
|
||||
$(INFO) "Fetching LuaJIT"
|
||||
@rm -rf lib/luajit
|
||||
@git clone --quiet --branch v2.1 https://github.com/LuaJIT/LuaJIT.git lib/luajit
|
||||
|
||||
lib/linenoise/linenoise.c:
|
||||
@mkdir -p lib/linenoise
|
||||
@echo "[INFO] Fetching linenoise"
|
||||
$(INFO) "Fetching linenoise"
|
||||
@curl -sL -o lib/linenoise/linenoise.c https://raw.githubusercontent.com/antirez/linenoise/master/linenoise.c
|
||||
@curl -sL -o lib/linenoise/linenoise.h https://raw.githubusercontent.com/antirez/linenoise/master/linenoise.h
|
||||
|
||||
lib/linenoise-win32/linenoise.c:
|
||||
@echo "[INFO] Fetching linenoise-win32"
|
||||
$(INFO) "Fetching linenoise-win32"
|
||||
@rm -rf lib/linenoise-win32
|
||||
@git clone --quiet --depth 1 https://github.com/msteveb/linenoise.git lib/linenoise-win32
|
||||
|
||||
lib/miniz/miniz.c:
|
||||
@mkdir -p lib/miniz
|
||||
@echo "[INFO] Fetching miniz"
|
||||
$(INFO) "Fetching miniz"
|
||||
@curl -sL -o /tmp/miniz.zip "https://github.com/richgel999/miniz/releases/download/3.1.0/miniz-3.1.0.zip"
|
||||
@unzip -qjo /tmp/miniz.zip miniz.c miniz.h -d lib/miniz/
|
||||
@rm -f /tmp/miniz.zip
|
||||
|
||||
lib/fennel/fennel.lua:
|
||||
@mkdir -p lib/fennel
|
||||
@echo "[INFO] Fetching Fennel"
|
||||
$(INFO) "Fetching Fennel"
|
||||
@curl -sL -o lib/fennel/fennel.lua "https://fennel-lang.org/downloads/fennel-1.6.1.lua"
|
||||
|
||||
update:
|
||||
|
|
@ -285,23 +300,23 @@ update:
|
|||
$(MAKE) deps
|
||||
|
||||
vendor-sdl:
|
||||
@echo "[INFO] Fetching SDL3"
|
||||
$(INFO) "Fetching SDL3"
|
||||
@if [ -d lib/SDL/.git ]; then cd lib/SDL && git pull --quiet origin main; \
|
||||
else rm -rf lib/SDL && git clone --quiet https://github.com/libsdl-org/SDL.git lib/SDL; fi
|
||||
@echo "[INFO] Building SDL3"
|
||||
$(INFO) "Building SDL3"
|
||||
@mkdir -p lib/SDL/build && cd lib/SDL/build && \
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release && \
|
||||
cmake --build . --config Release --parallel $(NPROC)
|
||||
@echo "[INFO] Built SDL3"
|
||||
$(INFO) "Built SDL3"
|
||||
|
||||
# -- LuaJIT build ------------------------------------------------------------
|
||||
|
||||
luajit: $(LUAJIT_LIB)
|
||||
|
||||
$(LUAJIT_LIB): lib/luajit/src/luajit.c
|
||||
@echo "[INFO] Building LuaJIT"
|
||||
$(INFO) "Building LuaJIT"
|
||||
@$(LUAJIT_BUILD)
|
||||
@echo "[INFO] Built LuaJIT"
|
||||
$(INFO) "Built LuaJIT"
|
||||
|
||||
# -- Server (Rust) ------------------------------------------------------------
|
||||
|
||||
|
|
@ -309,7 +324,7 @@ server: $(SERVER)
|
|||
|
||||
$(SERVER): $(wildcard pxl8d/src/*.rs pxl8d/Cargo.toml)
|
||||
@mkdir -p $(BINDIR)
|
||||
@echo "[INFO] Building pxl8d ($(MODE) mode)"
|
||||
$(INFO) "Building pxl8d ($(MODE) mode)"
|
||||
ifeq ($(MODE),release)
|
||||
@cd pxl8d && PATH="$$(echo $$PATH | tr ':' '\n' | grep -v '/usr/bin' | tr '\n' ':')" cargo build --release --quiet
|
||||
@cp pxl8d/target/release/pxl8d$(EXE_EXT) $(SERVER)
|
||||
|
|
@ -317,7 +332,7 @@ else
|
|||
@cd pxl8d && PATH="$$(echo $$PATH | tr ':' '\n' | grep -v '/usr/bin' | tr '\n' ':')" cargo build --quiet
|
||||
@cp pxl8d/target/debug/pxl8d$(EXE_EXT) $(SERVER)
|
||||
endif
|
||||
@echo "[INFO] Built pxl8d"
|
||||
$(INFO) "Built pxl8d"
|
||||
|
||||
# -- Client (C23) -------------------------------------------------------------
|
||||
|
||||
|
|
@ -325,7 +340,7 @@ client: deps $(CLIENT)
|
|||
|
||||
$(CLIENT): $(ALL_OBJS) $(SHADER_OBJS) $(LUAJIT_LIB)
|
||||
@mkdir -p $(BINDIR)
|
||||
@echo "[INFO] Linking pxl8"
|
||||
$(INFO) "Linking pxl8"
|
||||
ifeq ($(PLATFORM),windows)
|
||||
@(echo EXPORTS && llvm-nm --defined-only $(ALL_OBJS) $(SHADER_OBJS) | grep ' T pxl8_\| T SDL' | awk '{print $$3}') > $(PXL8_DEF)
|
||||
@MSYS_NO_PATHCONV=1 $(CC) $(LDFLAGS) $(ALL_OBJS) $(SHADER_OBJS) $(LUAJIT_LIB) $(LIBS) -Wl,/DEF:$(PXL8_DEF) -o $@
|
||||
|
|
@ -333,31 +348,31 @@ ifeq ($(PLATFORM),windows)
|
|||
else
|
||||
@$(CC) $(LDFLAGS) $(ALL_OBJS) $(SHADER_OBJS) $(LUAJIT_LIB) $(LIBS) -o $@
|
||||
endif
|
||||
@echo "[INFO] Built pxl8 -> $@"
|
||||
$(INFO) "Built pxl8 -> $@"
|
||||
|
||||
# -- Compile rules ------------------------------------------------------------
|
||||
|
||||
# Lib sources (dep flags, no warnings)
|
||||
$(OBJDIR)/linenoise.o: $(LINENOISE_DIR)/linenoise.c | $(OBJDIR)
|
||||
@echo "[CC] $<"
|
||||
$(CC_) "$<"
|
||||
@$(CC) -c $(DEP_CFLAGS) $(INCLUDES) $< -o $@
|
||||
|
||||
$(OBJDIR)/stringbuf.o: $(LINENOISE_DIR)/stringbuf.c | $(OBJDIR)
|
||||
@echo "[CC] $<"
|
||||
$(CC_) "$<"
|
||||
@$(CC) -c $(DEP_CFLAGS) $(INCLUDES) $< -o $@
|
||||
|
||||
$(OBJDIR)/utf8.o: $(LINENOISE_DIR)/utf8.c | $(OBJDIR)
|
||||
@echo "[CC] $<"
|
||||
$(CC_) "$<"
|
||||
@$(CC) -c $(DEP_CFLAGS) $(INCLUDES) $< -o $@
|
||||
|
||||
$(OBJDIR)/miniz.o: lib/miniz/miniz.c | $(OBJDIR)
|
||||
@echo "[CC] $<"
|
||||
$(CC_) "$<"
|
||||
@$(CC) -c $(DEP_CFLAGS) $(INCLUDES) $< -o $@
|
||||
|
||||
# Pattern rules for pxl8 sources by directory
|
||||
define PXL8_COMPILE_RULE
|
||||
$(OBJDIR)/%.o: $(1)/%.c | $(OBJDIR)
|
||||
@echo "[CC] $$<"
|
||||
@printf '$(CYAN)[%s CC]$(NC) %s\n' "$$$$(date +%H:%M:%S)" "$$<"
|
||||
@$$(CC) -c $$(CFLAGS) $$(INCLUDES) $$< -o $$@
|
||||
endef
|
||||
|
||||
|
|
@ -369,7 +384,7 @@ $(OBJDIR)/pxl8_script.o: $(LUA_SRCS)
|
|||
|
||||
# Shader objects
|
||||
$(SHADERDIR)/obj/%.o: src/gfx/shaders/cpu/%.c | $(SHADERDIR)/obj
|
||||
@echo "[SHADER] $<"
|
||||
$(SHD_) "$<"
|
||||
@$(CC) -c -O2 $(SHADER_INCLUDES) $< -o $@
|
||||
|
||||
# -- Directory creation -------------------------------------------------------
|
||||
|
|
@ -414,7 +429,7 @@ install:
|
|||
@mkdir -p $(HOME)/.local/bin
|
||||
@cp bin/release/pxl8$(EXE_EXT) $(HOME)/.local/bin/pxl8$(EXE_EXT)
|
||||
@chmod +x $(HOME)/.local/bin/pxl8$(EXE_EXT)
|
||||
@echo "[INFO] Installed pxl8 to $(HOME)/.local/bin/pxl8$(EXE_EXT)"
|
||||
$(INFO) "Installed pxl8 to $(HOME)/.local/bin/pxl8$(EXE_EXT)"
|
||||
|
||||
# -- Aseprite tools -----------------------------------------------------------
|
||||
|
||||
|
|
@ -424,8 +439,8 @@ ase:
|
|||
# -- Profile (Linux) ----------------------------------------------------------
|
||||
|
||||
profile: client
|
||||
@if [ "$$(uname)" != "Linux" ]; then echo "[ERROR] Profiling requires Linux + perf"; exit 1; fi
|
||||
@if ! command -v perf >/dev/null 2>&1; then echo "[ERROR] perf not found"; exit 1; fi
|
||||
@if [ "$$(uname)" != "Linux" ]; then printf '$(RED)[ERROR]$(NC) %s\n' "Profiling requires Linux + perf"; exit 1; fi
|
||||
@if ! command -v perf >/dev/null 2>&1; then printf '$(RED)[ERROR]$(NC) %s\n' "perf not found"; exit 1; fi
|
||||
@if [ ! -d lib/FlameGraph ]; then \
|
||||
echo "[INFO] Fetching FlameGraph"; \
|
||||
git clone --quiet https://github.com/brendangregg/FlameGraph.git lib/FlameGraph; \
|
||||
|
|
@ -482,7 +497,7 @@ help:
|
|||
# -- compile_commands.json ----------------------------------------------------
|
||||
|
||||
compile_commands.json: $(LIB_SRCS) $(PXL8_SRCS)
|
||||
@echo "[INFO] Generating compile_commands.json"
|
||||
$(INFO) "Generating compile_commands.json"
|
||||
@echo '[' > $@.tmp
|
||||
@first=true; \
|
||||
for f in $(LIB_SRCS); do \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue