Advertisement
Guest User

Untitled

a guest
Mar 28th, 2014
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. ################################################################
  2. # Targets related to creation of graphics files
  3. ################################################################
  4. # Dependency on source list file via dep check
  5. ifdef GFX_SCRIPT_LIST_FILES
  6. # include dependency file, if we generate graphics
  7. -include Makefile_gfx.dep
  8.  
  9. GIMP ?= "$(shell [ `which gimp 2>/dev/null` ] && echo "gimp" || echo "")"
  10. GIMP_FLAGS ?= -n -i -b - <
  11.  
  12. %.scm: $(SCRIPT_DIR)/gimpscript $(SCRIPT_DIR)/gimp.sed
  13. $(_E) "[GIMP-SCRIPT] $@"
  14. $(_V) cat $(SCRIPT_DIR)/gimpscript > $@
  15. $(_V) cat $(GFX_SCRIPT_LIST_FILES) | grep $(patsubst %.scm,%.png,$@) | sed -f $(SCRIPT_DIR)/gimp.sed >> $@
  16. $(_V) echo "(gimp-quit 0)" >> $@
  17.  
  18. # create the png file. And make sure it's re-created even when present in the repo
  19. %.png: %.scm
  20. $(_E) "[GIMP] $@"
  21. $(_V) $(GIMP) $(GIMP_FLAGS) $< >/dev/null
  22.  
  23. Makefile_gfx.dep: $(GFX_SCRIPT_LIST_FILES) Makefile
  24. $(_E) "[GFX-DEP] $@"
  25. $(_V) echo "GIMP := $(GIMP)" > Makefile_gfx
  26. $(_V) echo "GIMP_FLAGS := $(GIMP_FLAGS)" >> Makefile_gfx
  27. $(_V) echo "%.scm: $(SCRIPT_DIR)/gimpscript $(SCRIPT_DIR)/gimp.sed" >> Makefile_gfx
  28. $(_V) echo -e '\t$(_E) "[GIMP-SCRIPT] $@"' >> Makefile_gfx
  29. $(_V) echo -e '\t$(_V) cat $(SCRIPT_DIR)/gimpscript > $$@' >> Makefile_gfx
  30. $(_V) echo -e '\t$(_V) cat $(GFX_SCRIPT_LIST_FILES) | grep $$(patsubst %.scm,%.png,$$@) | sed -f $(SCRIPT_DIR)/gimp.sed >> $$@' >> Makefile_gfx
  31. $(_V) echo -e '\t$(_V) echo "(gimp-quit 0)" >> $$@' >> Makefile_gfx
  32. $(_V) echo -e "" >> Makefile_gfx
  33. $(_V) echo -e '%.png: %.scm' >> Makefile_gfx
  34. $(_V) echo -e '\t$(_E) [GIMP] $$@' >> Makefile_gfx
  35. $(_V) echo -e '\t$(_V) $(GIMP) $(GIMP_FLAGS) $$< >/dev/null' >> Makefile_gfx
  36. $(_V) echo -e "" >> Makefile_gfx
  37. $(_V) for j in $(GFX_SCRIPT_LIST_FILES); do for i in `cat $$j | grep "\([pP][cCnN][xXgG]\)" | grep -v "^#" | cut -d\ -f1`; do echo "gimp: $$i" >> Makefile_gfx; done; done
  38. $(_V) echo -e "`cat $(GFX_SCRIPT_LIST_FILES) | grep \"\([pP][cCnN][xXgG]\)\" | grep -v \"^#\" | $(AWK) '{print $1": "$2}'`" >> Makefile_gfx
  39. $(_V) echo -e "" > $@
  40. $(_V) for j in $(GFX_SCRIPT_LIST_FILES); do for i in `cat $$j | grep "\([pP][cCnN][xXgG]\)" | grep -v "^#" | cut -d\ -f1 | sed "s/\.\([pP][cCnN][xXgG]\)//"`; do echo "$$i.scm: $$j" >> $@; echo "$(GRF_FILE): $$i.png" >> $@; done; done
  41.  
  42.  
  43. ifeq ($(GIMP),"")
  44. gfx:
  45. $(_E) "Gimp processing required, but gimp not found nor specified"
  46. $(_V) false
  47. else
  48. gfx: Makefile_gfx.dep
  49. $(_E) "[GFX]"
  50. $(_V) make -f Makefile_gfx gimp
  51. endif
  52.  
  53. maintainer-clean::
  54. $(_E) "[MAINTAINER CLEAN GFX]"
  55. $(_V) rm -rf Makefile_gfx.dep
  56. $(_V) rm -rf Makefile_gfx
  57. $(_V) for j in $(GFX_SCRIPT_LIST_FILES); do for i in `cat $$j | grep "\([pP][cCnN][xXgG]\)" | cut -d\ -f1 | sed "s/\.\([pP][cCnN][xXgG]\)//"`; do rm -rf $$i.scm; rm -rf $$i.png; done; done
  58. else
  59. gfx:
  60. endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement