Makefile raw

   1  #
   2  #    Fennec build scripts
   3  #    Copyright (C) 2020-2024  Matías Zúñiga, Andrew Nayenko
   4  #
   5  #    This program is free software: you can redistribute it and/or modify
   6  #    it under the terms of the GNU Affero General Public License as
   7  #    published by the Free Software Foundation, either version 3 of the
   8  #    License, or (at your option) any later version.
   9  #
  10  #    This program is distributed in the hope that it will be useful,
  11  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  #    GNU Affero General Public License for more details.
  14  #
  15  #    You should have received a copy of the GNU Affero General Public License
  16  #    along with this program.  If not, see <https://www.gnu.org/licenses/>.
  17  #
  18  
  19  resdir := ../fenix-overlay/res
  20  flidir := ../fastlane/metadata/android/en-US/images
  21  images := $(foreach x,hdpi mdpi xhdpi xxhdpi xxxhdpi, \
  22                      $(resdir)/mipmap-$(x)/ic_launcher.webp \
  23                      $(resdir)/mipmap-$(x)/ic_launcher_foreground.webp \
  24                      $(resdir)/drawable-$(x)/ic_firefox.webp \
  25                      $(resdir)/drawable-$(x)/ic_logo_wordmark_normal.webp \
  26                      $(resdir)/drawable-$(x)/ic_logo_wordmark_private.webp) \
  27            $(resdir)/drawable/ic_wordmark_text_normal.webp \
  28            $(resdir)/drawable/ic_wordmark_text_private.webp \
  29            $(resdir)/drawable/ic_wordmark_logo.webp \
  30            $(flidir)/icon.png
  31  
  32  all: $(images)
  33  
  34  clean:
  35  	rm -f $(images)
  36  
  37  define rasterize
  38  mkdir -p $(dir $@)
  39  $(eval temp := $(shell mktemp).png)
  40  inkscape $< -o $(temp) --export-area=$(1) -h $(2)
  41  $(if $(filter .webp,$(suffix $@)),
  42       cwebp -quiet $(temp) -o $@,
  43       optipng -o7 -clobber -quiet -out $@ $(temp))
  44  rm $(temp)
  45  endef
  46  
  47  # Legacy non-adaptive icon
  48  
  49  $(resdir)/mipmap-mdpi/ic_launcher.webp : ic_launcher_foreground.svg
  50  	$(call rasterize,24:24:84:84,48)
  51  
  52  $(resdir)/mipmap-hdpi/ic_launcher.webp : ic_launcher_foreground.svg
  53  	$(call rasterize,24:24:84:84,72)
  54  
  55  $(resdir)/mipmap-xhdpi/ic_launcher.webp : ic_launcher_foreground.svg
  56  	$(call rasterize,24:24:84:84,96)
  57  
  58  $(resdir)/mipmap-xxhdpi/ic_launcher.webp : ic_launcher_foreground.svg
  59  	$(call rasterize,24:24:84:84,144)
  60  
  61  $(resdir)/mipmap-xxxhdpi/ic_launcher.webp : ic_launcher_foreground.svg
  62  	$(call rasterize,24:24:84:84,192)
  63  
  64  # Adaptive icon foreground
  65  
  66  $(resdir)/mipmap-mdpi/ic_launcher_foreground.webp : ic_launcher_foreground.svg
  67  	$(call rasterize,0:0:108:108,108)
  68  
  69  $(resdir)/mipmap-hdpi/ic_launcher_foreground.webp : ic_launcher_foreground.svg
  70  	$(call rasterize,0:0:108:108,162)
  71  
  72  $(resdir)/mipmap-xhdpi/ic_launcher_foreground.webp : ic_launcher_foreground.svg
  73  	$(call rasterize,0:0:108:108,216)
  74  
  75  $(resdir)/mipmap-xxhdpi/ic_launcher_foreground.webp : ic_launcher_foreground.svg
  76  	$(call rasterize,0:0:108:108,324)
  77  
  78  $(resdir)/mipmap-xxxhdpi/ic_launcher_foreground.webp : ic_launcher_foreground.svg
  79  	$(call rasterize,0:0:108:108,432)
  80  
  81  # Search widget logo
  82  
  83  $(resdir)/drawable-mdpi/ic_firefox.webp : ic_launcher_foreground.svg
  84  	$(call rasterize,28:28:80:80,48)
  85  
  86  $(resdir)/drawable-hdpi/ic_firefox.webp : ic_launcher_foreground.svg
  87  	$(call rasterize,28:28:80:80,72)
  88  
  89  $(resdir)/drawable-xhdpi/ic_firefox.webp : ic_launcher_foreground.svg
  90  	$(call rasterize,28:28:80:80,96)
  91  
  92  $(resdir)/drawable-xxhdpi/ic_firefox.webp : ic_launcher_foreground.svg
  93  	$(call rasterize,28:28:80:80,144)
  94  
  95  $(resdir)/drawable-xxxhdpi/ic_firefox.webp : ic_launcher_foreground.svg
  96  	$(call rasterize,28:28:80:80,192)
  97  
  98  # Wordmark normal
  99  
 100  $(resdir)/drawable-mdpi/ic_logo_wordmark_normal.webp : ic_logo_wordmark_normal.svg
 101  	$(call rasterize,0:0:300:46,80)
 102  
 103  $(resdir)/drawable-hdpi/ic_logo_wordmark_normal.webp : ic_logo_wordmark_normal.svg
 104  	$(call rasterize,0:0:300:46,120)
 105  
 106  $(resdir)/drawable-xhdpi/ic_logo_wordmark_normal.webp : ic_logo_wordmark_normal.svg
 107  	$(call rasterize,0:0:300:46,160)
 108  
 109  $(resdir)/drawable-xxhdpi/ic_logo_wordmark_normal.webp : ic_logo_wordmark_normal.svg
 110  	$(call rasterize,0:0:300:46,240)
 111  
 112  $(resdir)/drawable-xxxhdpi/ic_logo_wordmark_normal.webp : ic_logo_wordmark_normal.svg
 113  	$(call rasterize,0:0:300:46,320)
 114  
 115  # Wordmark private
 116  
 117  $(resdir)/drawable-mdpi/ic_logo_wordmark_private.webp : ic_logo_wordmark_private.svg
 118  	$(call rasterize,0:0:300:46,80)
 119  
 120  $(resdir)/drawable-hdpi/ic_logo_wordmark_private.webp : ic_logo_wordmark_private.svg
 121  	$(call rasterize,0:0:300:46,120)
 122  
 123  $(resdir)/drawable-xhdpi/ic_logo_wordmark_private.webp : ic_logo_wordmark_private.svg
 124  	$(call rasterize,0:0:300:46,160)
 125  
 126  $(resdir)/drawable-xxhdpi/ic_logo_wordmark_private.webp : ic_logo_wordmark_private.svg
 127  	$(call rasterize,0:0:300:46,240)
 128  
 129  $(resdir)/drawable-xxxhdpi/ic_logo_wordmark_private.webp : ic_logo_wordmark_private.svg
 130  	$(call rasterize,0:0:300:46,320)
 131  
 132  # Wordmark normal, text-only
 133  
 134  $(resdir)/drawable/ic_wordmark_text_normal.webp : ic_logo_wordmark_normal.svg
 135  	$(call rasterize,64:10:300:35,70)
 136  
 137  # Wordmark private, text-only
 138  
 139  $(resdir)/drawable/ic_wordmark_text_private.webp : ic_logo_wordmark_private.svg
 140  	$(call rasterize,64:10:300:35,70)
 141  
 142  # Wordmark logo
 143  
 144  $(resdir)/drawable/ic_wordmark_logo.webp : ic_launcher_foreground.svg
 145  	$(call rasterize,28:28:80:80,160)
 146  
 147  # Fastlane metadata icon
 148  
 149  $(flidir)/icon.png : ic_launcher_foreground.svg
 150  	$(call rasterize,24:24:84:84,512)
 151  
 152  .PNONY: all clean
 153