Subversion Repositories Kolibri OS

Rev

Rev 7475 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. # GNU Makefile
  2.  
  3. OUT := build
  4. GEN := generated
  5.  
  6. # --- Variables, Commands, etc... ---
  7.  
  8. default: all
  9. LDFLAGS = -Tinclude/scripts/menuetos_app_v01.ld -nostdlib -L include/lib
  10. CFLAGS += -Ifitz -Ipdf -Iscripts  -fno-stack-protector -nostdinc -fno-builtin -m32 -I include -fno-pic -w
  11. LIBS += -lfreetype2 -lpng -ljbig2dec -ljpeg -lopenjpeg -lz -lm -lc
  12.  
  13. #include Makerules
  14. #include Makethird
  15.  
  16. THIRD_LIBS := $(FREETYPE_LIB)
  17. THIRD_LIBS += $(JBIG2DEC_LIB)
  18. THIRD_LIBS += $(JPEG_LIB)
  19. THIRD_LIBS += $(OPENJPEG_LIB)
  20. THIRD_LIBS += $(ZLIB_LIB)
  21.  
  22. ifeq "$(verbose)" ""
  23. QUIET_AR = @ echo ' ' ' ' AR $@ ;
  24. QUIET_CC = @ echo ' ' ' ' CC $@ ;
  25. QUIET_GEN = @ echo ' ' ' ' GEN $@ ;
  26. QUIET_LINK = @ echo ' ' ' ' LINK $@ ;
  27. QUIET_MKDIR = @ echo ' ' ' ' MKDIR $@ ;
  28. endif
  29.  
  30. CC_CMD = $(QUIET_CC) $(CC) $(CFLAGS) -o $@ -c $<
  31. AR_CMD = $(QUIET_AR) $(AR) cru $@ $^
  32. LINK_CMD = $(QUIET_LINK) ld $(LDFLAGS) -o $@ include/stub/crt0.o $^ build/snprintf.o $(LIBS)
  33. MKDIR_CMD = $(QUIET_MKDIR) mkdir -p $@
  34.  
  35. # --- Rules ---
  36.  
  37. $(OUT) $(GEN) :
  38.         $(MKDIR_CMD)
  39.  
  40. $(OUT)/%.a :
  41.         $(AR_CMD)
  42.  
  43. $(OUT)/% : $(OUT)/%.o
  44.         $(LINK_CMD)
  45.  
  46. $(OUT)/%.o : fitz/%.c fitz/fitz.h | $(OUT)
  47.         $(CC_CMD)
  48. $(OUT)/%.o : draw/%.c fitz/fitz.h | $(OUT)
  49.         $(CC_CMD)
  50. $(OUT)/%.o : pdf/%.c fitz/fitz.h pdf/mupdf.h | $(OUT)
  51.         $(CC_CMD)
  52. $(OUT)/%.o : apps/%.c fitz/fitz.h pdf/mupdf.h | $(OUT)
  53.         $(CC_CMD)
  54. $(OUT)/%.o : scripts/%.c | $(OUT)
  55.         $(CC_CMD)
  56.  
  57. .PRECIOUS : $(OUT)/%.o # Keep intermediates from chained rules
  58.  
  59. # --- Fitz and MuPDF libraries ---
  60.  
  61. FITZ_LIB := $(OUT)/libfitz.a
  62. MUPDF_LIB := $(OUT)/libmupdf.a
  63.  
  64. FITZ_SRC := $(notdir $(wildcard fitz/*.c draw/*.c))
  65. MUPDF_SRC := $(notdir $(wildcard pdf/*.c))
  66.  
  67. $(FITZ_LIB) : $(addprefix $(OUT)/, $(FITZ_SRC:%.c=%.o))
  68. $(MUPDF_LIB) : $(addprefix $(OUT)/, $(MUPDF_SRC:%.c=%.o))
  69.  
  70. libs: $(MUPDF_LIB) $(FITZ_LIB) $(THIRD_LIBS)
  71.         @ echo MuPDF and underlying libraries built
  72.  
  73. # --- Generated CMAP and FONT files ---
  74.  
  75. CMAPDUMP := scripts/cmapdump
  76. # FONTDUMP := scripts/fontdump
  77.  
  78. CMAP_CNS_SRC := $(wildcard cmaps/cns/*)
  79. CMAP_GB_SRC := $(wildcard cmaps/gb/*)
  80. CMAP_JAPAN_SRC := $(wildcard cmaps/japan/*)
  81. CMAP_KOREA_SRC := $(wildcard cmaps/korea/*)
  82. FONT_BASE14_SRC := $(wildcard fonts/*.cff)
  83. FONT_DROID_SRC := fonts/droid/DroidSans.ttf fonts/droid/DroidSansMono.ttf
  84. FONT_CJK_SRC := fonts/droid/DroidSansFallback.ttf
  85.  
  86. $(GEN)/cmap_cns.h : $(CMAP_CNS_SRC)
  87.         $(QUIET_GEN) ./$(CMAPDUMP) $@ $(CMAP_CNS_SRC)
  88. $(GEN)/cmap_gb.h : $(CMAP_GB_SRC)
  89.         $(QUIET_GEN) ./$(CMAPDUMP) $@ $(CMAP_GB_SRC)
  90. $(GEN)/cmap_japan.h : $(CMAP_JAPAN_SRC)
  91.         $(QUIET_GEN) ./$(CMAPDUMP) $@ $(CMAP_JAPAN_SRC)
  92. $(GEN)/cmap_korea.h : $(CMAP_KOREA_SRC)
  93.         $(QUIET_GEN) ./$(CMAPDUMP) $@ $(CMAP_KOREA_SRC)
  94.  
  95. $(GEN)/font_base14.h : $(FONT_BASE14_SRC)
  96.         $(QUIET_GEN) ./$(FONTDUMP) $@ $(FONT_BASE14_SRC)
  97. $(GEN)/font_droid.h : $(FONT_DROID_SRC)
  98.         $(QUIET_GEN) ./$(FONTDUMP) $@ $(FONT_DROID_SRC)
  99. $(GEN)/font_cjk.h : $(FONT_CJK_SRC)
  100.         $(QUIET_GEN) ./$(FONTDUMP) $@ $(FONT_CJK_SRC)
  101.  
  102. CMAP_HDR := $(addprefix $(GEN)/, cmap_cns.h cmap_gb.h cmap_japan.h cmap_korea.h)
  103. FONT_HDR := $(GEN)/font_base14.h $(GEN)/font_droid.h $(GEN)/font_cjk.h
  104.  
  105. ifeq "$(CROSSCOMPILE)" ""
  106. $(CMAP_HDR) : $(CMAPDUMP) | $(GEN)
  107. $(FONT_HDR) : $(FONTDUMP) | $(GEN)
  108. endif
  109.  
  110. generate: $(CMAP_HDR) $(FONT_HDR)
  111.  
  112. $(OUT)/pdf_cmap_table.o : $(CMAP_HDR)
  113. $(OUT)/pdf_fontfile.o : $(FONT_HDR)
  114. $(OUT)/cmapdump.o : pdf/pdf_cmap.c pdf/pdf_cmap_parse.c
  115.  
  116. # --- Tools and Apps ---
  117.  
  118. PDF_APPS := $(addprefix $(OUT)/, pdfdraw pdfclean pdfextract pdfinfo pdfshow)
  119.  
  120. $(PDF_APPS) : $(MUPDF_LIB) $(FITZ_LIB) $(THIRD_LIBS)
  121.  
  122. MUPDF := $(OUT)/mupdf
  123. $(MUPDF) : $(MUPDF_LIB) $(FITZ_LIB) $(THIRD_LIBS)
  124. ifeq "$(NOX11)" ""
  125. $(MUPDF) : $(addprefix $(OUT)/, kos_main.o pdfapp.o)
  126.         $(LINK_CMD)
  127. endif
  128.  
  129. all: $(THIRD_LIBS) $(FITZ_LIB) $(PDF_APPS) $(MUPDF)
  130.