From eba3d5e1058c86decdf7c2332775499b84317662 Mon Sep 17 00:00:00 2001 From: Paulo Chaves Date: Fri, 18 Jul 2025 09:51:44 -0300 Subject: [PATCH] Set tailwindcss binary file name depending on current os (#125) * Download tailwindcss arm64 binary if on macOS * add tailwind binary download for macos x64 or arm64 --- Makefile | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 57fc115..5cb8712 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,22 @@ -# The Tailwind CSS CLI package to install (pick the one that matches your OS: https://github.com/tailwindlabs/tailwindcss/releases/latest) -TAILWIND_PACKAGE = tailwindcss-linux-x64 +# Get the OS name in lowercase (linux, darwin) +OS_SYSNAME := $(shell uname -s | tr A-Z a-z) +# Get the machine architecture (x86_64, arm64) +OS_MACHINE := $(shell uname -m) + +# If mac OS, use `macos-arm64` or `macos-x64` +ifeq ($(OS_SYSNAME),darwin) + OS_SYSNAME = macos + ifneq ($(OS_MACHINE),arm64) + OS_MACHINE = x64 + endif +endif + +# If Linux, use `linux-x64` +ifeq ($(OS_SYSNAME),linux) + OS_MACHINE = x64 +endif + +TAILWIND_PACKAGE = tailwindcss-$(OS_SYSNAME)-$(OS_MACHINE) .PHONY: help help: ## Print make targets @@ -59,4 +76,4 @@ css: ## Build and minify Tailwind CSS .PHONY: build build: css ## Build CSS and compile the application binary - go build -o ./tmp/main ./cmd/web \ No newline at end of file + go build -o ./tmp/main ./cmd/web