Skip to content

Instantly share code, notes, and snippets.

@lucmann
Created October 9, 2024 09:06
Show Gist options
  • Save lucmann/3a30f9cc06bb8773a77aa5ccc945c3e5 to your computer and use it in GitHub Desktop.
Save lucmann/3a30f9cc06bb8773a77aa5ccc945c3e5 to your computer and use it in GitHub Desktop.
Convert json to svg by a tool named bit-field
SRCS := $(wildcard *.json)
OBJS := $(patsubst %.json,%.svg, $(SRCS))
all: $(OBJS)
$(OBJS): %.svg: %.json
npx bit-field --hspace 1800 --lanes $(shell echo $< | grep -o -E '[0-9]*') --vflip --hflip -i $< > $@
clean:
rm -f $(OBJS)
.PHONY: all clean
@lucmann
Copy link
Author

lucmann commented Oct 9, 2024

At first, I'd like to define a function variable like this

get_lanes := $(shell echo $(1) | grep -o -E '[0-9]*')

and the command in the rule will looks like

npx bit-field --hspace 1800 --lanes $(call get_lanes, $<) --vflip --hflip -i $< > $@

Unfortunately, it doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment