#
#       Makefile for system font
#
#       Copyright (C) 2000-2016 GFD Dennou Club. All rights reserved.
#

include ../../../Mkinclude

SYSFONTS	=   DCLMarker-Black.ttf DCLMarker-Bold.ttf \
              DCLMarker-Regular.ttf DCLMarker-Light.ttf

SYSFONTSMAC = DCLMarker-Black-Mac.ttf DCLMarker-Bold-Mac.ttf  \
              DCLMarker-Regular-Mac.ttf DCLMarker-Light-Mac.ttf

all:

clean :

install:
	@echo
	@echo "Finding out your OS. Some occuring errors (Directorys are not found) are negligible."
	@echo
	$(if $(mac_exists) ,$(mac-fonts))
#	$(if $(win_exists) ,$(win-fonts))
ifeq ($(USER),root)
  $(if $(deb_exists) ,$(deb-fonts))
else
	@if [ ! -d $(usrfontdir) ]; \
		then echo "mkdir -p $(usrfontdir)"; mkdir -p $(usrfontdir); \
		fi
	$(CP) $(SYSFONTS) $(usrfontdir)
	@echo
	@echo "Font cache updating. This process may take a while..."
	@echo
	fc-cache -f
endif

clean:
	$(RM) *~

distclean:
	$(RM) *~

define mac-fonts
	$(CP) $(SYSFONTSMAC) $(macfontdir)
	@echo
	@echo "NOTE: Fonts for markers (DCLMarker-*.ttf) were installed in" $(macfontdir)
	@echo
endef

define win-fonts
	$(CP) $(SYSFONTS) $(winfontdir)
	@echo
	@echo "NOTE: Fonts for markers (DCLMarker-*.ttf) were installed in" $(winfontdir)
	@echo
endef

define deb-fonts
	$(CP) $(SYSFONTS) $(debfontdir)
	fc-cache -f
	@echo
	@echo "NOTE: Fonts for markers (DCLMarker-*.ttf) were installed in" $(debfontdir)
	@echo
endef


mac_exists := $(shell find  $(macfontdir))
win_exists := $(shell find  $(winfontdir))
deb_exists := $(shell find  $(debfontdir))
