Subversion Repositories Kolibri OS

Rev

Rev 7621 | 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. THIRD_LIBS := $(FREETYPE_LIB) $(JBIG2DEC_LIB) $(JPEG_LIB) $(OPENJPEG_LIB) $(ZLIB_LIB)
  14.  
  15. ifeq "$(verbose)" ""
  16. QUIET_AR = @ echo ' ' ' ' AR $@ ;
  17. QUIET_CC = @ echo ' ' ' ' CC $@ ;
  18. QUIET_GEN = @ echo ' ' ' ' GEN $@ ;
  19. QUIET_LINK = @ echo ' ' ' ' LINK $@ ;
  20. QUIET_MKDIR = @ echo ' ' ' ' MKDIR $@ ;
  21. endif
  22.  
  23. CC_CMD = $(QUIET_CC) $(CC) $(CFLAGS) -o $@ -c $<
  24. AR_CMD = $(QUIET_AR) $(AR) cru $@ $^
  25. LINK_CMD = $(QUIET_LINK) ld $(LDFLAGS) -o $@ include/stub/crt0.o $^ build/snprintf.o $(LIBS)
  26. MKDIR_CMD = $(QUIET_MKDIR) mkdir -p $@
  27.  
  28. # --- Rules ---
  29.  
  30. $(OUT) $(GEN) :
  31.         $(MKDIR_CMD)
  32.  
  33. $(OUT)/%.a :
  34.         $(AR_CMD)
  35.  
  36. $(OUT)/% : $(OUT)/%.o
  37.         $(LINK_CMD)
  38.  
  39. $(OUT)/%.o : fitz/%.c fitz/fitz.h | $(OUT)
  40.         $(CC_CMD)
  41. $(OUT)/%.o : draw/%.c fitz/fitz.h | $(OUT)
  42.         $(CC_CMD)
  43. $(OUT)/%.o : pdf/%.c fitz/fitz.h pdf/mupdf.h | $(OUT)
  44.         $(CC_CMD)
  45. $(OUT)/%.o : apps/%.c fitz/fitz.h pdf/mupdf.h | $(OUT)
  46.         $(CC_CMD)
  47. $(OUT)/%.o : scripts/%.c | $(OUT)
  48.         $(CC_CMD)
  49.  
  50. # --- Fitz and MuPDF libraries ---
  51.  
  52. FITZ_LIB := $(OUT)/libfitz.a
  53. MUPDF_LIB := $(OUT)/libmupdf.a
  54.  
  55. FITZ_SRC := $(notdir $(wildcard fitz/*.c draw/*.c))
  56. MUPDF_SRC := $(notdir $(wildcard pdf/*.c))
  57.  
  58. $(FITZ_LIB) : $(addprefix $(OUT)/, $(FITZ_SRC:%.c=%.o))
  59. $(MUPDF_LIB) : $(addprefix $(OUT)/, $(MUPDF_SRC:%.c=%.o))
  60.  
  61. libs: $(MUPDF_LIB) $(FITZ_LIB) $(THIRD_LIBS)
  62.  
  63. # --- Generated CMAP and FONT files ---
  64.  
  65. CMAPDUMP := scripts/cmapdump
  66.  
  67. CMAP_CNS_SRC := $(wildcard cmaps/cns/*)
  68. CMAP_GB_SRC := $(wildcard cmaps/gb/*)
  69. CMAP_JAPAN_SRC := $(wildcard cmaps/japan/*)
  70. CMAP_KOREA_SRC := $(wildcard cmaps/korea/*)
  71. FONT_BASE14_SRC := $(wildcard fonts/*.cff)
  72. FONT_DROID_SRC := fonts/droid/DroidSans.ttf fonts/droid/DroidSansMono.ttf
  73. FONT_CJK_SRC := fonts/droid/DroidSansFallback.ttf
  74.  
  75. $(GEN)/cmap_cns.h : $(CMAP_CNS_SRC)
  76.         $(QUIET_GEN) ./$(CMAPDUMP) $@ $(CMAP_CNS_SRC)
  77. $(GEN)/cmap_gb.h : $(CMAP_GB_SRC)
  78.         $(QUIET_GEN) ./$(CMAPDUMP) $@ $(CMAP_GB_SRC)
  79. $(GEN)/cmap_japan.h : $(CMAP_JAPAN_SRC)
  80.         $(QUIET_GEN) ./$(CMAPDUMP) $@ $(CMAP_JAPAN_SRC)
  81. $(GEN)/cmap_korea.h : $(CMAP_KOREA_SRC)
  82.         $(QUIET_GEN) ./$(CMAPDUMP) $@ $(CMAP_KOREA_SRC)
  83.  
  84. $(GEN)/font_base14.h : $(FONT_BASE14_SRC)
  85.         $(QUIET_GEN) ./$(FONTDUMP) $@ $(FONT_BASE14_SRC)
  86. $(GEN)/font_droid.h : $(FONT_DROID_SRC)
  87.         $(QUIET_GEN) ./$(FONTDUMP) $@ $(FONT_DROID_SRC)
  88. $(GEN)/font_cjk.h : $(FONT_CJK_SRC)
  89.         $(QUIET_GEN) ./$(FONTDUMP) $@ $(FONT_CJK_SRC)
  90.  
  91. CMAP_HDR := $(addprefix $(GEN)/, cmap_cns.h cmap_gb.h cmap_japan.h cmap_korea.h)
  92. FONT_HDR := $(GEN)/font_base14.h $(GEN)/font_droid.h $(GEN)/font_cjk.h
  93.  
  94. ifeq "$(CROSSCOMPILE)" ""
  95. $(CMAP_HDR) : $(CMAPDUMP) | $(GEN)
  96. $(FONT_HDR) : $(FONTDUMP) | $(GEN)
  97. endif
  98.  
  99. generate: $(CMAP_HDR) $(FONT_HDR)
  100.  
  101. $(OUT)/pdf_cmap_table.o : $(CMAP_HDR)
  102. $(OUT)/pdf_fontfile.o : $(FONT_HDR)
  103. $(OUT)/cmapdump.o : pdf/pdf_cmap.c pdf/pdf_cmap_parse.c
  104.  
  105. # --- Tools and Apps ---
  106.  
  107. MUPDF := $(OUT)/mupdf
  108. $(MUPDF) : $(MUPDF_LIB) $(FITZ_LIB) $(THIRD_LIBS)
  109. ifeq "$(NOX11)" ""
  110. $(MUPDF) : $(addprefix $(OUT)/, kos_main.o pdfapp.o)
  111.         $(LINK_CMD)
  112. endif
  113.  
  114. all: $(THIRD_LIBS) $(FITZ_LIB) $(PDF_APPS) $(MUPDF)
  115.