1
0
Fork 0
mirror of https://github.com/adobe-fonts/source-sans.git synced 2024-12-30 14:26:16 +01:00

Rework the Makefile

Closes #180 upstream

[CM-2816]

Signed-off-by: Al Nikolov <alexey.nikolov@etteplan.com>
This commit is contained in:
Al Nikolov 2019-11-05 19:11:45 +02:00 committed by Miguel Sousa
parent 9be80f4750
commit 9d27545e59
2 changed files with 14 additions and 58 deletions

1
.gitignore vendored
View file

@ -9,3 +9,4 @@ Source*.ttf
*/*/*/master.ufo/glyphs.com.adobe.type.processedGlyphs
*/*/*/master.ufo/data/com.adobe.type.processedHashMap
*/*/*/master.ufo/layercontents.plist
*~

71
Makefile Normal file → Executable file
View file

@ -1,64 +1,19 @@
# Makefile for Source Sans Pro font project directory
# See README for an overview of make commands
#!/usr/bin/make
# -*- indent-tabs-mode: t; -*-
# by Al Nikolov <root@toor.fi.eu.org>
family=SourceSansPro
romanWeights=Black Bold ExtraLight Light Regular Semibold
italicWeights=BlackIt BoldIt ExtraLightIt LightIt It SemiboldIt
dnames = $(wildcard $(addsuffix /Instances/*,Roman Italic))
fnames = $(addsuffix .otf,$(addprefix /SourceSansPro-,$(notdir $(dnames))))
wholenames = $(join $(dnames),$(fnames))
out_pat = -name \*.[ot]tf
OTF_DIR=target/OTF
TTF_DIR=target/TTF
OTFs:=$(foreach w,$(romanWeights) $(italicWeights),$(OTF_DIR)/$(family)-$w.otf)
TTFs:=$(subst OTF,TTF,$(OTFs:.otf=.ttf))
instancesRoman:=$(foreach w,$(romanWeights),Roman/$w/font.ufo)
instancesItalic:=$(foreach w,$(italicWeights),Italic/$w/font.ufo)
all: $(OTFs) $(TTFs)
# Rule below derives the prerequisites of appropriate style from the given
# target's weight. Paths of targets themselves, though, are more tricky, thus
# there are two separate rules for the two target formats:
.SECONDEXPANSION:
$(OTFs): $(OTF_DIR)/$(family)-%.otf: \
$(addprefix $$(if $$(findstring It,%),Italic,Roman)/,\
%/font.ufo %/fontinfo \
%/features %/markclasses.fea %/mark.fea %/mkmk.fea %/kern.fea \
GlyphOrderAndAliasDB family.fea) \
FontMenuNameDB tables.fea | $(OTF_DIR)
makeotf -ga -f $< -o $@
.SECONDEXPANSION:
$(TTFs): $(TTF_DIR)/$(family)-%.ttf: \
$(addprefix $$(if $$(findstring It,%),Italic,Roman)/,\
%/font.ttf %/fontinfo \
%/features %/markclasses.fea %/mark.fea %/mkmk.fea %/kern.fea \
GlyphOrderAndAliasDB family.fea) \
FontMenuNameDB tables.fea | $(TTF_DIR)
makeotf -ga -f $< -o $@
$(OTF_DIR) $(TTF_DIR):
mkdir -p $@
instances: $(instancesRoman) $(instancesItalic)
.SECONDEXPANSION:
$(instancesRoman) $(instancesItalic): %/font.ufo: \
$$(addprefix $$(subst /,,$$(dir %))Masters/,\
$(addprefix $(family)$$(if $$(findstring Italic,%),-Italic),\
.designspace _0.ufo _1.ufo))
makeInstancesUFO -d $<
all: $(wholenames)
clean:
@rm -f $(addsuffix /current.fpr,\
$(addprefix Roman/,$(romanWeights)) \
$(addprefix Italic/,$(italicWeights)))
@rm -f $(addsuffix /MutatorMath.log,RomanMasters ItalicMasters)
find $(out_pat) | xargs ${RM}
cleanall: clean
@rm -rf $(OTF_DIR) $(TTF_DIR)
cleaninstances:
@rm -rf $(instancesRoman) $(instancesItalic)
.PHONY: all clean
.SECONDEXPANSION:
%.otf: $$(shell find $$(@D) ! $(out_pat))
cd $(@D) && makeotf -r -gs -omitMacNames