Commits

Trammell Hudson committed dfbbfe1

Support building transparent black/white images

Comments (0)

Files changed (1)

 
 # Helper macros
 map = $(foreach f,$2,$(call $1,$f))
-uppercase = $(shell echo $(basename $(notdir $1)) | tr '[a-z]-.' '[A-Z]__')
+uppercase = $(shell echo $1 | tr '[a-z]-.' '[A-Z]__')
+ucfile = $(call uppercase,$(basename $(notdir $1)))
 
 
 #
 mkfont_rules = \
 	$(eval F := $(word 1,$1)) \
 	$(eval S := $(word 2,$1)) \
-	$(eval N := FONT_$(call uppercase,$F)_$S) \
+	$(eval N := FONT_$(call ucfile,$F)_$S) \
 	$(eval R := $O/$N.$S.pfo) \
 	$(eval $R: $F) \
 	$(eval RESOURCES += $R) \
 
 #
 # Images are converted to pbi format
+# If ":white" or ":black" are included, generate separate
+# resources for the two of them.
 #
+$O/%_white.pbi:
+	$(PYTHON) $(PEBBLE_HOME)/tools/bitmapgen.py \
+		white_trans_pbi \
+		$< \
+		$@ \
+
+$O/%_black.pbi:
+	$(PYTHON) $(PEBBLE_HOME)/tools/bitmapgen.py \
+		black_trans_pbi \
+		$< \
+		$@ \
+
 $O/%.pbi:
 	$(PYTHON) $(PEBBLE_HOME)/tools/bitmapgen.py \
 		pbi \
 		$< \
 		$@ \
 
-mkimage = \
-	$(eval N := IMAGE_$(call uppercase,$1)) \
-	$(eval R := $O/$N.pbi) \
-	$(eval $R: $1) \
+
+mkimage_rules = \
+	$(eval F := $(word 1,$1)) \
+	$(eval T := $(word 2,$1)) \
+	$(eval T := $(if $T,_$T,)) \
+	$(eval N := IMAGE_$(call ucfile,$F)$(call uppercase,$T)) \
+	$(eval R := $O/$N$T.pbi) \
+	$(eval $R: $F) \
 	$(eval RESOURCES += $R) \
 	$(eval RESOURCE_LIST += $R $N) \
 
+mkimage = \
+	$(call mkimage_rules,$(subst :, ,$1)) \
+
 $(eval $(call map,mkimage,$(IMAGES)))