diff options
author | Brad Erickson <eosrei@gmail.com> | 2016-02-19 12:01:33 +0300 |
---|---|---|
committer | Brad Erickson <eosrei@gmail.com> | 2016-02-19 12:01:33 +0300 |
commit | 66d327a747ee38f996c8869cede45573b714018d (patch) | |
tree | 3def9939862908d76b432dac1390161b7cbefa54 /Makefile | |
parent | b206d4635e23e955e1fde80c26cacaff5f837e1b (diff) |
make: Add staging to combine two SVG sources
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 49 |
1 files changed, 35 insertions, 14 deletions
@@ -1,19 +1,29 @@ # Run with: make -j [NUMBER_OF_CPUS] -SVG_SOURCE := assets/emojione/assets/svg -SVG_FILES := $(wildcard $(SVG_SOURCE)/*.svg) -SVG_TRACE_FILES := $(patsubst $(SVG_SOURCE)/%.svg, build/svg-trace/%.svg, $(SVG_FILES)) +.PHONY: clean -# Use the default Linux ramdisk, change for other systems or testing. -TMP := /dev/shm/emojione +OUTPUT_FONT := build/EmojiOne-SVGinOT.ttf +SMFBUILD := SMFBuild/bin/smfbuild -.PHONY: build clean +TMP := /tmp +# Use Linux Shared Memory to avoid wasted disk writes. +#TMP := /dev/shm -all: EmojiOne-SVGinOT.ttf +# There are two SVG source directories to keep the emojione assets separate. +SVG_EMOJIONE := assets/emojione/assets/svg +SVG_MORE := assets/svg -EmojiOne-SVGinOT.ttf: build $(SVG_TRACE_FILES) - echo "done!" +# Create the lists of traced and color SVGs +SVG_FILES := $(wildcard $(SVG_EMOJIONE)/*.svg) $(wildcard $(SVG_MORE)/*.svg) +SVG_TRACE_FILES := $(patsubst $(SVG_EMOJIONE)/%.svg, build/svg-trace/%.svg, $(SVG_FILES)) +SVG_TRACE_FILES := $(patsubst $(SVG_MORE)/%.svg, build/svg-trace/%.svg, $(SVG_TRACE_FILES)) +SVG_COLOR_FILES := $(patsubst build/svg-trace/%.svg, build/staging/%.svg, $(SVG_TRACE_FILES)) + +all: $(OUTPUT_FONT) + +$(OUTPUT_FONT): $(SVG_TRACE_FILES) $(SVG_COLOR_FILES) + $(SMFBUILD) build/svg-trace $(OUTPUT_FONT) --color-svg-dir=build/staging --transform="translate(0 -800) scale(1.0)" # Create black SVG traces of the color SVGs to use as glyphs. # 1. Make the EmojiOne SVG into a PNG with Inkscape @@ -21,20 +31,31 @@ EmojiOne-SVGinOT.ttf: build $(SVG_TRACE_FILES) # canvas size to allow the outer "stroke" to fit. # 3. Make the BMP into a Edge Detected PGM with mkbitmap # 4. Make the PGM into a black SVG trace with potrace -build/svg-trace/%.svg: $(SVG_SOURCE)/%.svg +build/svg-trace/%.svg: build/staging/%.svg | build/svg-trace inkscape -w 1000 -h 1000 -z -e $(TMP)/$(*F).png $< - convert $(TMP)/$(*F).png -gravity center -background xc:transparent -extent 1066x1066 $(TMP)/$(*F).bmp + convert $(TMP)/$(*F).png -gravity center -extent 1066x1066 $(TMP)/$(*F).bmp rm $(TMP)/$(*F).png mkbitmap -g -s 1 -f 10 -o $(TMP)/$(*F).pgm $(TMP)/$(*F).bmp rm $(TMP)/$(*F).bmp potrace -s --height 1000pt --width 1000pt -o $@ $(TMP)/$(*F).pgm rm $(TMP)/$(*F).pgm +# Copy the files from multiple directories into one source directory +build/staging/%.svg: $(SVG_EMOJIONE)/%.svg | build/staging + cp $< $@ + +build/staging/%.svg: $(SVG_MORE)/%.svg | build/staging + cp $< $@ + # Create the build directories build: - mkdir -p $(TMP) - mkdir -p build - mkdir -p build/svg-trace + mkdir build + +build/staging: | build + mkdir build/staging + +build/svg-trace: | build + mkdir build/svg-trace clean: rm -rf build |