Improve Makefile
This commit is contained in:
parent
795e68ba21
commit
cdb60c8eca
1 changed files with 24 additions and 16 deletions
40
Makefile
40
Makefile
|
@ -1,38 +1,46 @@
|
|||
TAILWIND_URL=https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-macos-arm64
|
||||
TAILWIND_TARGET=tailwindcss-macos-arm64
|
||||
BIN_DIR=./bin
|
||||
TAILWIND_BIN=$(BIN_DIR)/tailwindcss
|
||||
TW_VERSION=4.1.3
|
||||
TW_BIN=./bin/tailwindcss
|
||||
STYLE_SRC=./static/style/global.css
|
||||
STYLE_DIST=./static/style/dist.css
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
TW_PLATFORM := macos-arm64
|
||||
else ifeq ($(UNAME_S),Linux)
|
||||
TW_PLATFORM := linux-x64
|
||||
else
|
||||
$(error "Unsupported OS: $(UNAME_S)")
|
||||
endif
|
||||
|
||||
all: install
|
||||
|
||||
install: ## Download TailwindCSS binary and install other dependencies
|
||||
@echo "Creating bin directory if it doesn't exist..."
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p ./bin
|
||||
@echo "Downloading TailwindCSS binary..."
|
||||
curl -sLO $(TAILWIND_URL)
|
||||
curl -sLo $(TW_BIN) https://github.com/tailwindlabs/tailwindcss/releases/download/v$(TW_VERSION)/tailwindcss-$(TW_PLATFORM)
|
||||
@echo "Making TailwindCSS binary executable..."
|
||||
chmod +x $(TAILWIND_TARGET)
|
||||
@echo "Moving TailwindCSS binary to $(BIN_DIR)..."
|
||||
mv $(TAILWIND_TARGET) $(TAILWIND_BIN)
|
||||
@echo "TailwindCSS is ready in $(BIN_DIR)/"
|
||||
chmod +x $(TW_BIN)
|
||||
@echo "TailwindCSS is ready in $(TW_BIN)"
|
||||
@echo "Installing qlot dependencies..."
|
||||
@qlot install
|
||||
|
||||
watch: ## Start TailwindCSS in watch mode for automatic rebuilds
|
||||
@$(TAILWIND_BIN) -i $(STYLE_SRC) -o $(STYLE_DIST) --watch=always
|
||||
@$(TW_BIN) -i $(STYLE_SRC) -o $(STYLE_DIST) --watch=always
|
||||
|
||||
build: ## Generate the final CSS output
|
||||
@$(TAILWIND_BIN) -i $(STYLE_SRC) -o $(STYLE_DIST)
|
||||
@$(TW_BIN) -i $(STYLE_SRC) -o $(STYLE_DIST)
|
||||
|
||||
help: ## Display available commands and their descriptions
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
|
||||
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
clean: ## Remove the bin directory and clean up generated files
|
||||
@echo "Removing $(BIN_DIR)..."
|
||||
rm -rf $(BIN_DIR)
|
||||
@echo "Removing ./bin..."
|
||||
rm -rf ./bin
|
||||
@echo "Removing qlot dependencies..."
|
||||
rm -rf ./.qlot/
|
||||
|
||||
lem: ## Open Lem with TailwindCSS server
|
||||
@echo "Starting TailwindCSS server in background..."
|
||||
|
@ -42,8 +50,8 @@ lem: ## Open Lem with TailwindCSS server
|
|||
lem; \
|
||||
kill $$WATCH_PID
|
||||
|
||||
docker-build:
|
||||
docker-build: ## Build docker image
|
||||
docker build -t hp .
|
||||
|
||||
docker-run:
|
||||
docker-run: ## Run docker container
|
||||
docker run -p 3000:3000 hp
|
Loading…
Add table
Add a link
Reference in a new issue