From 8e020b13432a2ca1db201d3053dc34dd1c0dad91 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 22 Mar 2025 00:02:21 -0400 Subject: [PATCH] Add some logic to check for a GCC version high enough --- Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 29bc722..31f9163 100644 --- a/Makefile +++ b/Makefile @@ -81,9 +81,19 @@ examples: examples/commands/commands examples/base64/base64 examples/ini/ini exa examples/http examples/threads examples/tomodeps examples/tomo-install examples/wrap examples/pthreads examples/colorful ./build/tomo examples/learnxiny.tm -deps: +deps: check-gcc ./install_dependencies.sh +check-gcc: + @GCC_VERSION=$$(gcc --version | awk '{print $$3;exit}'); \ + if [ "$$(printf '%s\n' "$$GCC_VERSION" "12.0.0" | sort -V | head -n 1)" = "12.0.0" ]; then \ + printf "\033[32;1mGCC version is good!\033[m\n"; \ + exit 0; \ + else \ + printf "\033[31;1mGCC version is lower than the required 12.0.0!\033[m\n" >&2; \ + exit 1; \ + fi + install: build/tomo build/libtomo.so @if ! echo "$$PATH" | tr ':' '\n' | grep -qx "$(PREFIX)/bin"; then \ printf "\033[31;1mError: '$(PREFIX)' is not in your \$$PATH variable!\033[m\n" >&2; \ @@ -103,4 +113,4 @@ uninstall: rm -rvf "$(PREFIX)/bin/tomo" "$(PREFIX)/include/tomo" "$(PREFIX)/lib/libtomo.so" "$(PREFIX)/share/tomo"; \ .SUFFIXES: -.PHONY: all clean install uninstall test tags examples deps +.PHONY: all clean install uninstall test tags examples deps check-gcc