|
|
|
@ -1,4 +1,6 @@ |
|
|
|
# Variables
|
|
|
|
temp_sed_file:=$(shell mktemp).sed |
|
|
|
temp_svg_file:=$(shell mktemp).svg |
|
|
|
ifdef dark |
|
|
|
dark_color=$(dark) |
|
|
|
endif |
|
|
|
@ -9,12 +11,15 @@ ifdef middle |
|
|
|
middle_color=$(middle) |
|
|
|
endif |
|
|
|
ifneq ($(wildcard $(dark)),) |
|
|
|
dark_mime=$(shell file -bN --mime-type $(dark)) |
|
|
|
dark_color=transparent |
|
|
|
endif |
|
|
|
ifneq ($(wildcard $(light)),) |
|
|
|
light_mime=$(shell file -bN --mime-type $(light)) |
|
|
|
light_color=transparent |
|
|
|
endif |
|
|
|
ifneq ($(wildcard $(middle)),) |
|
|
|
middle_mime=$(shell file -bN --mime-type $(middle)) |
|
|
|
middle_color=transparent |
|
|
|
endif |
|
|
|
size?=1024 |
|
|
|
@ -27,20 +32,39 @@ default: build |
|
|
|
|
|
|
|
# Build process
|
|
|
|
build: clean logo.svg |
|
|
|
@cp logo.svg temp.svg |
|
|
|
@sed -i 's|fill: black|:fill1:|' temp.svg |
|
|
|
@sed -i 's|fill: white|:fill2:|' temp.svg |
|
|
|
@sed -i 's|fill: gray|:fill3:|' temp.svg |
|
|
|
@sed -i 's|:fill1:|fill: $(dark_color)|' temp.svg |
|
|
|
@sed -i 's|:fill2:|fill: $(light_color)|' temp.svg |
|
|
|
@sed -i 's|:fill3:|fill: $(middle_color)|' temp.svg |
|
|
|
@sed -i 's|dark.png|:image1:|' temp.svg |
|
|
|
@sed -i 's|light.png|:image2:|' temp.svg |
|
|
|
@sed -i 's|middle.png|:image3:|' temp.svg |
|
|
|
@sed -i 's|:image1:|$(dark)|' temp.svg |
|
|
|
@sed -i 's|:image2:|$(light)|' temp.svg |
|
|
|
@sed -i 's|:image3:|$(middle)|' temp.svg |
|
|
|
convert -background none -size $(size)x$(size) temp.svg logo.png |
|
|
|
@cp logo.svg $(temp_svg_file) |
|
|
|
@echo 's|fill: black|:fill1:|' >> $(temp_sed_file) |
|
|
|
@echo 's|fill: white|:fill2:|' >> $(temp_sed_file) |
|
|
|
@echo 's|fill: gray|:fill3:|' >> $(temp_sed_file) |
|
|
|
@echo 's|:fill1:|fill: $(dark_color)|' >> $(temp_sed_file) |
|
|
|
@echo 's|:fill2:|fill: $(light_color)|' >> $(temp_sed_file) |
|
|
|
@echo 's|:fill3:|fill: $(middle_color)|' >> $(temp_sed_file) |
|
|
|
@echo 's|dark.png|:image1:|' >> $(temp_sed_file) |
|
|
|
@echo 's|light.png|:image2:|' >> $(temp_sed_file) |
|
|
|
@echo 's|middle.png|:image3:|' >> $(temp_sed_file) |
|
|
|
ifdef dark_mime |
|
|
|
@echo -n 's|:image1:|data:$(dark_mime);base64,' >> $(temp_sed_file) |
|
|
|
@base64 -w0 < $(dark) >> $(temp_sed_file) |
|
|
|
@echo '|' >> $(temp_sed_file) |
|
|
|
else |
|
|
|
@echo 's|:image1:|$(dark)|' >> $(temp_sed_file) |
|
|
|
endif |
|
|
|
ifdef light_mime |
|
|
|
@echo -n 's|:image2:|data:$(light_mime);base64,' >> $(temp_sed_file) |
|
|
|
@base64 -w0 < $(light) >> $(temp_sed_file) |
|
|
|
@echo '|' >> $(temp_sed_file) |
|
|
|
else |
|
|
|
@echo 's|:image2:|$(light)|' >> $(temp_sed_file) |
|
|
|
endif |
|
|
|
ifdef middle_mime |
|
|
|
@echo -n 's|:image3:|data:$(middle_mime);base64,' >> $(temp_sed_file) |
|
|
|
@base64 -w0 < $(middle) >> $(temp_sed_file) |
|
|
|
@echo '|' >> $(temp_sed_file) |
|
|
|
else |
|
|
|
@echo 's|:image3:|$(middle)|' >> $(temp_sed_file) |
|
|
|
endif |
|
|
|
sed -i -f $(temp_sed_file) -- $(temp_svg_file) |
|
|
|
convert -background none -size $(size)x$(size) $(temp_svg_file) logo.png |
|
|
|
clean: |
|
|
|
@rm -f logo.png temp.svg |
|
|
|
|
|
|
|
|