Makefile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. # Copyright (c) 2009 Openmoko Inc.
  2. #
  3. # This program is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 3 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. # +++START_UPDATE_MAKEFILE: Start of auto included code
  16. # The text between the +++ and --- tags is copied by the
  17. # UpdateMakefiles script. Do not remove or change these tags.
  18. # ---
  19. # Autodetect root directory
  20. define FIND_ROOT_DIR
  21. while : ; do \
  22. d=$$(pwd) ; \
  23. [ -d "$${d}/samo-lib" ] && echo $${d} && exit 0 ; \
  24. [ X"/" = X"$${d}" ] && echo ROOT_DIRECTORY_NOT_FOUND && exit 1 ; \
  25. cd .. ; \
  26. done
  27. endef
  28. ROOT_DIR := $(shell ${FIND_ROOT_DIR})
  29. # Directory of Makefile includes
  30. MK_DIR := ${ROOT_DIR}/samo-lib/Mk
  31. # Include the initial Makefile setup
  32. include ${MK_DIR}/definitions.mk
  33. # ---END_UPDATE_MAKEFILE: End of auto included code
  34. $(call REQUIRED_BINARY, bdftopcf, xfonts-utils)
  35. $(call REQUIRED_BINARY, xz, xz-utils)
  36. BDFTOPCF = $(shell which bdftopcf)
  37. PCFTOBMF = ${HOST_TOOLS}/pcf2bmf/pcf2bmf
  38. DECOMPRESS = xz --decompress --stdout
  39. COMPRESS = xz --compress --stdout
  40. TARGETS = title.bmf
  41. TARGETS += subtitle.bmf
  42. TARGETS += texti.bmf
  43. #TARGETS += textbi.bmf
  44. TARGETS += text.bmf
  45. #TARGETS += textb.bmf
  46. #TARGETS += small.bmf
  47. TARGETS += textall.bmf
  48. #TARGETS += textallb.bmf
  49. TARGETS += titleall.bmf
  50. TARGETS += subtlall.bmf
  51. COMPRESSED_FONTS = textall.pcf.xz
  52. COMPRESSED_FONTS += titleall.pcf.xz
  53. COMPRESSED_FONTS += subtlall.pcf.xz
  54. .PHONY: all
  55. all: stamp-fonts
  56. # use a lock to avoid multiple parallel builds of this program
  57. stamp-fonts:
  58. ${LOCKF} "$@" ${MAKE} ${TARGETS}
  59. ${TOUCH} "$@"
  60. .PHONY: install
  61. install: all
  62. @if [ ! -d "${DESTDIR}" ] ; then echo DESTDIR: "'"${DESTDIR}"'" is not a directory ; exit 1; fi
  63. ${COPY} *.bmf "${DESTDIR}"/
  64. build:
  65. ${MKDIR} "$@"
  66. .PHONY: compress
  67. compress: ${COMPRESSED_FONTS}
  68. # rebuild the all fonts from source and create compressed fonts
  69. .PHONY: rebuild
  70. rebuild:
  71. ${RM} *.xz
  72. ${MAKE} clean compress all
  73. .PHONY: clean
  74. clean:
  75. ${RM} -r build ${TARGETS} *.bmf *.pcf stamp-*
  76. # fonts
  77. %.pcf: %.bdf
  78. ${BDFTOPCF} "$<" -o "$@"
  79. %.bmf: %.pcf
  80. ${PCFTOBMF} -f "$<" -o "$@" -c 1152
  81. %.bmf: %.pcf.xz
  82. ${DECOMPRESS} "$<" | ${PCFTOBMF} -f - -o "$@"
  83. %.pcf.xz : %.bdf
  84. ${RM} "$@.temp"
  85. ${BDFTOPCF} "$<" -o "$@.temp"
  86. ${COMPRESS} < "$@.temp" > "$@"
  87. ${RM} "$@.temp"
  88. include ${MK_DIR}/rules.mk