diff --git a/Makefile b/Makefile index 6fbbefef6a1..a3fe610e815 100644 --- a/Makefile +++ b/Makefile @@ -84,6 +84,3 @@ lint: .PHONY: tidy tidy: $(MAKE) --no-print-directory -C misc tidy - -gif: - TAPES_DIR=$(PWD)/docs $(MAKE) -C ./misc/gno-vhs gif.docker diff --git a/misc/gendocs/Makefile b/misc/gendocs/Makefile index 0f56d83693f..32f90d37018 100644 --- a/misc/gendocs/Makefile +++ b/misc/gendocs/Makefile @@ -11,3 +11,6 @@ clean: kill_zombies: kill -9 `lsof -t -i tcp:8080 -s TCP:LISTEN` || true + +gif: + TAPES_DIR=$(PWD)/../../docs $(MAKE) -C ../gno-vhs gif.docker diff --git a/misc/gno-vhs/Makefile b/misc/gno-vhs/Makefile index d1a97b4aea8..e74fcf10448 100644 --- a/misc/gno-vhs/Makefile +++ b/misc/gno-vhs/Makefile @@ -1,13 +1,15 @@ # Generate GIFs using VHS -# Current Makefile path -CPATH := $(PWD) +# Makefile directory +CPATH := $(abspath $(lastword $(MAKEFILE_LIST)/../)) + +# GnoRoot path +GNOROOT_DIR ?= $(abspath $(CPATH)/../../) # Specify on which directory to run TAPES_DIR ?= $(GNOROOT_DIR) # Other overwritable variables -GNOROOT_DIR ?= $(abspath $(lastword $(MAKEFILE_LIST))/../../../) BUILD_DIR ?= $(CPATH)/.build IMAGE_NAME ?= charmbracelet/vhs:local @@ -19,8 +21,9 @@ gif: find $(TAPES_DIR) -iname '*.tape' -execdir vhs {} \; -print ## Nix + gif.nix: - nix-shell -p ffmpeg ttyd vhs --run 'make gif' + nix-shell -p ffmpeg ttyd vhs --run 'TAPES_DIR=$(TAPES_DIR) make gif' ## Docker @@ -36,6 +39,7 @@ gif.docker: bins .dockerfile.build ## Extra rules to run vhs+gno in Docker bins: gnodev gno gnokey gnoland +.PHONY: bins # Build binaries for Linux Docker container gnodev: | $(BUILD_DIR) @@ -46,10 +50,7 @@ gnokey: | $(BUILD_DIR) GOOS=linux go -C $(GNOROOT_DIR)/gno.land/cmd/gnokey build -v -o $(BUILD_DIR)/gnokey . gnoland: | $(BUILD_DIR) GOOS=linux go -C $(GNOROOT_DIR)/gno.land/cmd/gnoland build -v -o $(BUILD_DIR)/gnoland . - -# Force rebuild binaries -.PHONY: $(BUILD_DIR)/gnodev $(BUILD_DIR)/gnokey $(BUILD_DIR)/gno $(BUILD_DIR)/gnoland -.PHONY: bins +.PHONY: gnodev gnokey gno gnoland # Create build directory $(BUILD_DIR): @@ -59,6 +60,7 @@ $(BUILD_DIR): docker build -t $(IMAGE_NAME) . && touch $@ ## Cleanup + clean: rm -rf $(BUILD_DIR)