# nmake -f makefile.msvc
# Arguments:
# CFG=dbg|rel (default: dbg)
# EXTLIBSDIR=<directory where zlib/freetype/jpeg lib live in ext dir> (default: empty)
#  e.g. ..\sumatrapdf\
# EXB=rm (default: no setting) This is an EXternal Build, i.e. not base SumatraPDF.
# EXTCFLAGS=$CFLAGS

# Set default configuration
!if "$(CFG)"==""
CFG=dbg
!endif

# set to use openjpeg, unset to use jasper
JPEG2=openjpeg

# O is directory where object and binary files go
!if "$(EXB)"=="rm"
O = obj-rm-$(CFG)
!else
O = obj-$(CFG)
!endif

# To over-ride location of fitz/mupdf sources, define FITZ_DIR
# e.g.:
#FITZ_DIR=..\mupdf

!if "$(FITZ_DIR)"==""
FITZ_DIR=mupdf
!endif

ZLIB_DIR=$(EXTLIBSDIR)ext\zlib-1.2.3
FREETYPE_DIR=$(EXTLIBSDIR)ext\freetype-2.3.9
JPEG_DIR=$(EXTLIBSDIR)ext\jpeg6b
JASPER_DIR=$(EXTLIBSDIR)ext\jasper\src\libjasper
OPENJPEG_DIR=$(EXTLIBSDIR)ext\openjpeg-1.3\libopenjpeg
JBIG2_DIR=$(EXTLIBSDIR)ext\jbig2dec

CC = cl.exe

#CFLAGS = $(CFLAGS) /showIncludes
#CFLAGS = $(CFLAGS) /analyze

CFLAGS = $(CFLAGS) /nologo /c
# standard windows defines
CFLAGS = $(CFLAGS) /D "WIN32"  /D "_WIN32"
#CFLAGS = $(CFLAGS) /D "_WIN32_WINNT=0x0500"
#CFLAGS = $(CFLAGS) /D "WIN32_LEAN_AND_MEAN"
CFLAGS = $(CFLAGS) /D "_SCL_SECURE_NO_DEPRECATE" /D "_CRT_SECURE_NO_DEPRECATE"

# disable "warning C4244: 'argument' : conversion from 'foo' to 'bar', possible loss of data"
CFLAGS = $(CFLAGS) /wd4244 /wd4996
# 4995 - 'sprintf': name was marked as #pragma deprecated
CFLAGS = $(CFLAGS) /wd4995

CFLAGS = $(CFLAGS) /W3 /GR- /Zi /GS /Gy

!if "$(CFG)"=="rel"
CFLAGS = $(CFLAGS) /Os /Ox /GL /D "NDEBUG"
LDFLAGS = $(LDFLAGS) /LTCG
CFLAGS = $(CFLAGS) /EHs-c- 
!else
CFLAGS = $(CFLAGS) /Od /RTCs /RTCu 
# exception handling must be activated to enable memory leak detection
CFLAGS = $(CFLAGS) /MDd /EHsc
!endif

# external build settings not part of core SumatraPDF
!if "$(EXB)"=="rm"
CFLAGS = $(CFLAGS) /D "BUILD_RM_VERSION"
!endif

# zlib flags
ZLIB_CFLAGS = $(CFLAGS)

# freetype flags
FT_CFLAGS = $(CFLAGS) /TC /I$(FREETYPE_DIR)/include \
	/D "FT2_BUILD_LIBRARY" /D "FT_OPTION_AUTOFIT2"

# jbig2 flags
JBIG2_CFLAGS = $(CFLAGS) /TC /D "HAVE_STRING_H=1" /I$(JBIG2_DIR) /wd4018

# jasper flags
JASPER_CFLAGS = $(CFLAGS) /I$(JASPER_DIR)/include \
	/D "EXCLUDE_MIF_SUPPORT" /D "EXCLUDE_PNM_SUPPORT" \
	/D "EXCLUDE_BMP_SUPPORT" /D "EXCLUDE_RAS_SUPPORT" \
	/D "EXCLUDE_JPG_SUPPORT"

# openjpeg flags
OPENJPEG_CFLAGS = $(CFLAGS) /TC /D "OPJ_STATIC" /D "OPJ_EXPORTS" /I$(OPENJPEG_DIR)

# libjpeg Flags
JPEG_CFLAGS = $(CFLAGS) /I$(JPEG_DIR)

# fitz flags
FITZ_CFLAGS = $(CFLAGS) /TC \
	/D "NEED_MATH" \
	/D "NEED_GETTIMEOFDAY" /D "HAVE_JBIG2DEC" /D "USE_HINTING"

!if "$(JPEG2)"=="openjpeg"
FITZ_CFLAGS = $(FITZ_CFLAGS) /D "HAVE_OPENJPEG" /D "OPJ_STATIC" /I$(OPENJPEG_DIR)
!else
FITZ_CFLAGS = $(FITZ_CFLAGS) /D "HAVE_JASPER" /I$(JASPER_DIR)/include
!endif

FITZ_CFLAGS = $(FITZ_CFLAGS) /I$(FITZ_DIR)/fitz /I$(FITZ_DIR)/mupdf \
	/I$(FITZ_DIR)/apps \
	/I$(FREETYPE_DIR)/include /I$(JPEG_DIR) /I$(ZLIB_DIR) \
	/I$(JBIG2_DIR)

SUMATRA_CFLAGS = $(CFLAGS) /Ibaseutils /Ibaseutils/msvc \
	/I$(FITZ_DIR)\fitz /I$(FITZ_DIR)\mupdf \
	/I$(ZLIB_DIR) /Isrc /IDialogSizer 

SUMATRA_CFLAGS = $(SUMATRA_CFLAGS) /D "_WINDOWS"
SUMATRA_CFLAGS = $(SUMATRA_CFLAGS) /D "UNICODE" /D "_UNICODE"
SUMATRA_CFLAGS = $(SUMATRA_CFLAGS) $(EXTCFLAGS)
# Flag for TeX enhancements
SUMATRA_CFLAGS = $(SUMATRA_CFLAGS) /D "SYNCTEX_FEATURE"
!if "$(TEXBUILD)"=="1"
SUMATRA_CFLAGS = $(SUMATRA_CFLAGS) /D "_TEX_ENHANCEMENT" /D "SUMATRA_UPDATE_INFO_URL=_T(\"http://william.famille-blum.org/software/sumatra/sumpdftex-latest.txt\")" /D "SVN_UPDATE_LINK=_T(\"http://william.famille-blum.org/software/sumatra/\")" /D "CURR_VERSION=\"$(VERSION)\""
!endif

LIBS = $(LIBS) advapi32.lib kernel32.lib user32.lib gdi32.lib \
	comdlg32.lib shell32.lib comctl32.lib Msimg32.lib Winspool.lib \
	wininet.lib ole32.lib shlwapi.lib

LD = link.exe
LDFLAGS = $(LDFLAGS) /nologo /DEBUG
LDFLAGS = $(LDFLAGS) /STACK:2097152

!if "$(CFG)"=="dbg"
SUMATRA_CFLAGS = $(SUMATRA_CFLAGS) /D "DEBUG" /D "_DEBUG"
!endif

!if "$(CFG)"=="rel"
LDFLAGS = $(LDFLAGS) /opt:ref /opt:icf
!if "$(EXB)"=="rm"
SUMATRA_CFLAGS = $(SUMATRA_CFLAGS) /GL /MT /O2
!endif
!endif

SUMATRA_RES = $(O)\sumtrapdf.res
SUMATRA_MANIFEST = $(O)\sumtrapdf.manifest.res

FT_OBJS = \
	$(O)\ftdebug.obj $(O)\ftsystem.obj $(O)\ftglyph.obj $(O)\ftbitmap.obj $(O)\ftinit.obj $(O)\ftxf86.obj \
	$(O)\autofit.obj $(O)\ftbase.obj $(O)\bdf.obj $(O)\ftcache.obj $(O)\cff.obj $(O)\cffparse.obj \
	$(O)\type1cid.obj $(O)\gxvalid.obj $(O)\otvalid.obj $(O)\pcf.obj $(O)\pfr.obj $(O)\pfrsbit.obj \
	$(O)\psaux.obj $(O)\pshinter.obj $(O)\psnames.obj $(O)\raster.obj $(O)\sfnt.obj \
	$(O)\smooth.obj $(O)\truetype.obj $(O)\type1.obj $(O)\type42.obj $(O)\winfnt.obj

ZLIB_OBJS = \
	$(O)\adler32.obj $(O)\crc32.obj $(O)\inflate.obj $(O)\zutil.obj \
	$(O)\inffast.obj $(O)\inftrees.obj $(O)\deflate.obj $(O)\compress.obj \
	$(O)\trees.obj \
	$(O)\gzio.obj

JPEG_OBJS = \
	$(O)\jcapimin.obj $(O)\jcapistd.obj $(O)\jccoefct.obj $(O)\jccolor.obj $(O)\jcdctmgr.obj $(O)\jchuff.obj \
	$(O)\jcinit.obj $(O)\jcmainct.obj $(O)\jcmarker.obj $(O)\jcmaster.obj $(O)\jcomapi.obj $(O)\jcparam.obj \
	$(O)\jcphuff.obj $(O)\jcprepct.obj $(O)\jcsample.obj $(O)\jctrans.obj $(O)\jdapimin.obj $(O)\jdapistd.obj \
	$(O)\jdatadst.obj $(O)\jdatasrc.obj $(O)\jdcoefct.obj $(O)\jdcolor.obj $(O)\jddctmgr.obj $(O)\jdhuff.obj \
	$(O)\jdinput.obj $(O)\jdmainct.obj $(O)\jdmarker.obj $(O)\jdmaster.obj $(O)\jdmerge.obj $(O)\jdphuff.obj \
	$(O)\jdpostct.obj $(O)\jdsample.obj $(O)\jdtrans.obj $(O)\jerror.obj $(O)\jfdctflt.obj $(O)\jfdctfst.obj \
	$(O)\jfdctint.obj $(O)\jidctflt.obj $(O)\jidctfst.obj $(O)\jidctint.obj $(O)\jidctred.obj $(O)\jquant1.obj \
	$(O)\jquant2.obj $(O)\jutils.obj $(O)\jmemmgr.obj \
	$(O)\jmemnobs.obj # should I use jmemansi.obj or jmemname.obj ?

JBIG2_OBJS = \
	$(O)\jbig2.obj $(O)\jbig2_arith.obj \
	$(O)\jbig2_arith_iaid.obj $(O)\jbig2_arith_int.obj $(O)\jbig2_huffman.obj \
	$(O)\jbig2_generic.obj $(O)\jbig2_refinement.obj $(O)\jbig2_image.obj \
	$(O)\jbig2_segment.obj $(O)\jbig2_symbol_dict.obj $(O)\jbig2_text.obj \
	$(O)\jbig2_mmr.obj $(O)\jbig2_page.obj $(O)\jbig2_metadata.obj
# jbig2_image_pbm$(OBJ) jbig2dec$(OBJ) sha1$(OBJ)

JASPER_OBJS = \
	$(O)\jas_cm.obj $(O)\jas_debug.obj $(O)\jas_icc.obj \
	$(O)\jas_iccdata.obj $(O)\jas_image.obj $(O)\jas_init.obj $(O)\jas_malloc.obj \
	$(O)\jas_seq.obj $(O)\jas_stream.obj $(O)\jas_string.obj $(O)\jas_tvp.obj \
	$(O)\jas_version.obj \
	$(O)\jp2_cod.obj $(O)\jp2_dec.obj $(O)\jp2_enc.obj \
	$(O)\jpc_bs.obj $(O)\jpc_cs.obj $(O)\jpc_dec.obj $(O)\jpc_enc.obj \
	$(O)\jpc_math.obj $(O)\jpc_mct.obj $(O)\jpc_mqcod.obj $(O)\jpc_mqdec.obj \
	$(O)\jpc_mqenc.obj $(O)\jpc_qmfb.obj $(O)\jpc_t1cod.obj $(O)\jpc_t1dec.obj \
	$(O)\jpc_t1enc.obj $(O)\jpc_t2cod.obj $(O)\jpc_t2dec.obj $(O)\jpc_t2enc.obj \
	$(O)\jpc_tagtree.obj $(O)\jpc_tsfb.obj $(O)\jpc_util.obj \
	$(O)\pgx_cod.obj $(O)\pgx_dec.obj $(O)\pgx_enc.obj

OPENJPEG_OBJS = \
	$(O)\bio.obj $(O)\cio.obj $(O)\dwt.obj $(O)\event.obj $(O)\image.obj \
	$(O)\j2k.obj $(O)\j2k_lib.obj $(O)\jp2.obj $(O)\jpt.obj $(O)\mct.obj \
	$(O)\mqc.obj $(O)\openjpeg.obj $(O)\pi.obj $(O)\raw.obj $(O)\t1.obj \
	$(O)\t2.obj $(O)\tcd.obj $(O)\tgt.obj

FITZ_DRAW_OBJS = \
	$(O)\archx86.obj $(O)\blendmodes.obj $(O)\imagescale.obj $(O)\pathfill.obj $(O)\pixmap.obj \
	$(O)\glyphcache.obj $(O)\imageunpack.obj $(O)\pathscan.obj $(O)\porterduff.obj \
	$(O)\imagedraw.obj $(O)\meshdraw.obj $(O)\pathstroke.obj $(O)\render.obj

FITZ_OBJS = \
	$(O)\base_memory.obj $(O)\base_error.obj $(O)\base_hash.obj $(O)\base_matrix.obj \
	$(O)\base_rect.obj $(O)\base_unicode.obj $(O)\base_string.obj \
	$(O)\util_getopt.obj $(O)\util_gettimeofday.obj \
	$(O)\base_cpudep.obj \
	$(O)\node_misc1.obj $(O)\node_misc2.obj $(O)\node_optimize.obj $(O)\node_path.obj \
	$(O)\node_text.obj $(O)\node_toxml.obj $(O)\node_tree.obj $(O)\res_colorspace.obj \
	$(O)\res_font.obj $(O)\res_image.obj $(O)\res_shade.obj \
	$(O)\crypt_aes.obj $(O)\crypt_arc4.obj $(O)\crypt_crc32.obj $(O)\crypt_md5.obj $(O)\filt_a85d.obj \
	$(O)\filt_a85e.obj $(O)\filt_aes.obj $(O)\filt_ahxd.obj $(O)\filt_ahxe.obj $(O)\filt_arc4.obj \
	$(O)\filt_faxd.obj $(O)\filt_faxdtab.obj $(O)\filt_faxe.obj $(O)\filt_faxetab.obj \
	$(O)\filt_flate.obj $(O)\filt_lzwd.obj $(O)\filt_lzwe.obj $(O)\filt_null.obj \
	$(O)\filt_pipeline.obj $(O)\filt_predict.obj $(O)\filt_rld.obj $(O)\filt_rle.obj \
	$(O)\obj_array.obj $(O)\obj_dict.obj $(O)\obj_parse.obj $(O)\obj_print.obj \
	$(O)\obj_simple.obj $(O)\stm_buffer.obj $(O)\stm_filter.obj $(O)\stm_misc.obj \
	$(O)\stm_open.obj $(O)\stm_read.obj $(O)\filt_dctd.obj \
	$(O)\filt_dcte.obj $(O)\filt_jbig2d.obj

!if "$(JPEG2)"=="openjpeg"
FITZ_OBJS = $(FITZ_OBJS) $(O)\filt_jpxd_opj.obj 
!else
FITZ_OBJS = $(FITZ_OBJS) $(O)\filt_jpxd_jas.obj
!endif

MUPDF_OBJS = \
	$(O)\pdf_annot.obj $(O)\pdf_build.obj $(O)\pdf_cmap.obj $(O)\pdf_colorspace1.obj \
	$(O)\pdf_colorspace2.obj $(O)\pdf_crypt.obj $(O)\pdf_debug.obj \
	$(O)\pdf_font.obj $(O)\pdf_fontagl.obj $(O)\pdf_fontenc.obj $(O)\pdf_fontmtx.obj $(O)\pdf_function.obj \
	$(O)\pdf_image.obj $(O)\pdf_interpret.obj $(O)\pdf_lex.obj $(O)\pdf_nametree.obj \
	$(O)\pdf_open.obj $(O)\pdf_outline.obj $(O)\pdf_page.obj $(O)\pdf_pagetree.obj \
	$(O)\pdf_parse.obj $(O)\pdf_pattern.obj $(O)\pdf_repair.obj $(O)\pdf_resources.obj \
	$(O)\pdf_shade.obj $(O)\pdf_shade1.obj $(O)\pdf_shade4.obj \
	$(O)\pdf_store.obj $(O)\pdf_stream.obj $(O)\pdf_type3.obj $(O)\pdf_unicode.obj \
	$(O)\pdf_xobject.obj $(O)\pdf_xref.obj $(O)\pdf_fontfilems.obj \
	$(O)\pdf_cmap_load.obj $(O)\pdf_cmap_parse.obj $(O)\pdf_cmap_table.obj

FONT_OBJS = \
	$(O)\font_misc.obj \
	$(O)\font_mono.obj \
	$(O)\font_sans.obj \
	$(O)\font_serif.obj

#$(O)\font_cjk.obj \

CMAP_OBJS = \
	$(O)\cmap_chinese_s.obj \
	$(O)\cmap_chinese_t.obj \
	$(O)\cmap_japanese.obj \
	$(O)\cmap_korean.obj

LIBS_OBJS = \
	$(ZLIB_OBJS) \
	$(FT_OBJS) \
	$(JPEG_OBJS) \
	$(JBIG2_OBJS) \
	$(FITZ_DRAW_OBJS) \
	$(FITZ_OBJS) \
	$(MUPDF_OBJS) \
	$(FONT_OBJS) \
	$(CMAP_OBJS)

!if "$(JPEG2)"=="openjpeg"
LIBS_OBJS = $(LIBS_OBJS) $(OPENJPEG_OBJS)
!else
LIBS_OBJS = $(LIBS_OBJS) $(JASPER_OBJS)
!endif

PDFAPP_OBJS = $(LIBS_OBJS) $(O)\pdfapp.obj $(O)\winmain.obj

PDFAPP_APP = $(O)\pdfapp.exe
PDFAPP_PDB = $(O)\pdfapp.pdb
PDFAPP_MAP = $(O)\pdfapp.map

PDFBENCH_OBJS = $(LIBS_OBJS) $(O)\pdfbench.obj
PDFBENCH_APP = $(O)\pdfbench.exe
PDFBENCH_PDB = $(O)\pdfbench.pdb
PDFBENCH_MAP = $(O)\pdfbench.map

PDFDRAW_OBJS = $(LIBS_OBJS) $(O)\pdftool.obj $(O)\pdfdraw.obj
PDFDRAW_APP = $(O)\pdfdraw.exe
PDFDRAW_PDB = $(O)\pdfdraw.pdb
PDFDRAW_MAP = $(O)\pdfdraw.map

PDFSHOW_OBJS = $(LIBS_OBJS) $(O)\pdftool.obj $(O)\pdfshow.obj
PDFSHOW_APP = $(O)\pdfshow.exe
PDFSHOW_PDB = $(O)\pdfshow.pdb
PDFSHOW_MAP = $(O)\pdfshow.map

PDFCLEAN_OBJS = $(LIBS_OBJS) $(O)\pdftool.obj $(O)\pdfclean.obj
PDFCLEAN_APP = $(O)\pdfclean.exe
PDFCLEAN_PDB = $(O)\pdfclean.pdb
PDFCLEAN_MAP = $(O)\pdfclean.map

PDFINFO_OBJS = $(LIBS_OBJS) $(O)\pdftool.obj $(O)\pdfinfo.obj
PDFINFO_APP = $(O)\pdfinfo.exe
PDFINFO_PDB = $(O)\pdfinfo.pdb
PDFINFO_MAP = $(O)\pdfinfo.map

PDFEXTRACT_OBJS = $(LIBS_OBJS) $(O)\pdftool.obj $(O)\pdfextract.obj
PDFEXTRACT_APP = $(O)\pdfextract.exe
PDFEXTRACT_PDB = $(O)\pdfextract.pdb
PDFEXTRACT_MAP = $(O)\pdfextract.map

CMAPDUMP_OBJS = $(O)\base_error.obj $(O)\base_memory.obj \
	$(O)\stm_read.obj $(O)\stm_buffer.obj $(O)\stm_filter.obj \
	$(O)\stm_open.obj $(O)\base_string.obj \
	$(O)\cmapdump.obj

CMAPDUMP_APP = $(O)\cmapdump.exe
CMAPDUMP_PDB = $(O)\cmapdump.pdb
CMAPDUMP_MAP = $(O)\cmapdump.map

FONTDUMP_OBJS = $(O)\fontdump.obj
FONTDUMP_APP = $(O)\fontdump.exe
FONTDUMP_PDB = $(O)\fontdump.pdb
FONTDUMP_MAP = $(O)\fontdump.map

SUMATRA_OBJS = \
	$(O)\AppPrefs.obj $(O)\base_util.obj $(O)\benc_util.obj $(O)\DisplayModel.obj \
	$(O)\DisplayState.obj $(O)\MemSegment.obj \
	$(O)\dstring.obj $(O)\file_util.obj $(O)\FileHistory.obj $(O)\geom_util.obj \
	$(O)\PdfEngine.obj $(O)\PdfSearch.obj $(O)\str_util.obj $(O)\strlist_util.obj \
	$(O)\SumatraDialogs.obj $(O)\SumatraPDF.obj $(O)\translations.obj \
	$(O)\translations_txt.obj $(O)\utf_util.obj $(O)\win_util.obj $(O)\WinUtil.obj \
	$(O)\wstr_util.obj $(O)\LangMenuDef.obj $(O)\FileWatch.obj $(O)\PdfSync.obj \
	$(O)\dialogsizer_set.obj $(O)\synctex_parser.obj $(O)\synctex_parser_utils.obj \
	$(SUMATRA_RES)

# Don't include a manifest in Debug builds (it could override the external manifest)
!if "$(CFG)"=="rel"
SUMATRA_OBJS = $(SUMATRA_OBJS) $(SUMATRA_MANIFEST)
!endif

SUMATRA_APP = $(O)\SumatraPDF.exe
SUMATRA_PDB = $(O)\SumatraPDF.pdb
SUMATRA_MAP = $(O)\SumatraPDF.map

all: $(O) $(CMAPDUMP_APP) $(SUMATRA_APP)

# $(PDFBENCH_APP) $(PDFDRAW_APP) $(PDFSHOW_APP) $(PDFCLEAN_APP) $(PDFINFO_APP) $(PDFEXTRACT_APP) 

rebuild: clean all

clean: force
	-rmdir /S /Q $(O)

## Note: the following command does not work on Windows
cleanall: force
	-rmdir /S /Q obj-*

$(O): force
	@if not exist $(O) mkdir $(O)

$(SUMATRA_RES): src\SumatraPDF.rc
	rc /r /fo$(SUMATRA_RES) src\SumatraPDF.rc

$(SUMATRA_MANIFEST): src\SumatraPDF.manifest.rc
	rc /r /fo$(SUMATRA_MANIFEST) src\SumatraPDF.manifest.rc

$(O)\font_misc.obj: $(O)\font_misc.c
$(O)\font_mono.obj: $(O)\font_mono.c
$(O)\font_serif.obj: $(O)\font_serif.c
$(O)\font_sans.obj: $(O)\font_sans.c

$(O)\cmap_chinese_s.obj: $(O)\cmap_chinese_s.c
$(O)\cmap_chinese_t.obj: $(O)\cmap_chinese_t.c
$(O)\cmap_japanese.obj: $(O)\cmap_japanese.c
$(O)\cmap_korean.obj: $(O)\cmap_korean.c

$(O)\cmap_chinese_s.c: $(CMAPDUMP_APP)
	$(CMAPDUMP_APP) $(O)\cmap_chinese_s.c $(FITZ_DIR)\cmaps\chinese_s\Adobe-GB1-4 \
	$(FITZ_DIR)\cmaps\chinese_s\Adobe-GB1-UCS2 $(FITZ_DIR)\cmaps\chinese_s\GB-EUC-H \
	$(FITZ_DIR)\cmaps\chinese_s\GB-EUC-V $(FITZ_DIR)\cmaps\chinese_s\GBK-EUC-H \
	$(FITZ_DIR)\cmaps\chinese_s\GBK-EUC-UCS2 $(FITZ_DIR)\cmaps\chinese_s\GBK-EUC-V \
	$(FITZ_DIR)\cmaps\chinese_s\GBK2K-H $(FITZ_DIR)\cmaps\chinese_s\GBK2K-V $(FITZ_DIR)\cmaps\chinese_s\GBKp-EUC-H \
	$(FITZ_DIR)\cmaps\chinese_s\GBKp-EUC-V $(FITZ_DIR)\cmaps\chinese_s\GBT-EUC-H $(FITZ_DIR)\cmaps\chinese_s\GBT-EUC-V \
	$(FITZ_DIR)\cmaps\chinese_s\GBpc-EUC-H $(FITZ_DIR)\cmaps\chinese_s\GBpc-EUC-UCS2 \
	$(FITZ_DIR)\cmaps\chinese_s\GBpc-EUC-UCS2C $(FITZ_DIR)\cmaps\chinese_s\GBpc-EUC-V \
	$(FITZ_DIR)\cmaps\chinese_s\UniGB-UCS2-H $(FITZ_DIR)\cmaps\chinese_s\UniGB-UCS2-V

$(O)\cmap_chinese_t.c: $(CMAPDUMP_APP)
	$(CMAPDUMP_APP) $(O)\cmap_chinese_t.c $(FITZ_DIR)\cmaps\chinese_t\Adobe-CNS1-3 \
	$(FITZ_DIR)\cmaps\chinese_t\Adobe-CNS1-UCS2 $(FITZ_DIR)\cmaps\chinese_t\B5pc-H \
	$(FITZ_DIR)\cmaps\chinese_t\B5pc-UCS2 $(FITZ_DIR)\cmaps\chinese_t\B5pc-UCS2C \
	$(FITZ_DIR)\cmaps\chinese_t\B5pc-V $(FITZ_DIR)\cmaps\chinese_t\CNS-EUC-H \
	$(FITZ_DIR)\cmaps\chinese_t\CNS-EUC-V $(FITZ_DIR)\cmaps\chinese_t\ETen-B5-H \
	$(FITZ_DIR)\cmaps\chinese_t\ETen-B5-UCS2 $(FITZ_DIR)\cmaps\chinese_t\ETen-B5-V \
	$(FITZ_DIR)\cmaps\chinese_t\ETenms-B5-H $(FITZ_DIR)\cmaps\chinese_t\ETenms-B5-V \
	$(FITZ_DIR)\cmaps\chinese_t\HKscs-B5-H $(FITZ_DIR)\cmaps\chinese_t\HKscs-B5-V \
	$(FITZ_DIR)\cmaps\chinese_t\UniCNS-UCS2-H $(FITZ_DIR)\cmaps\chinese_t\UniCNS-UCS2-V

$(O)\cmap_japanese.c: $(CMAPDUMP_APP)
	$(CMAPDUMP_APP) $(O)\cmap_japanese.c $(FITZ_DIR)\cmaps\japanese\83pv-RKSJ-H \
	$(FITZ_DIR)\cmaps\japanese\90ms-RKSJ-H $(FITZ_DIR)\cmaps\japanese\90ms-RKSJ-UCS2 \
	$(FITZ_DIR)\cmaps\japanese\90ms-RKSJ-V $(FITZ_DIR)\cmaps\japanese\90msp-RKSJ-H \
	$(FITZ_DIR)\cmaps\japanese\90msp-RKSJ-V $(FITZ_DIR)\cmaps\japanese\90pv-RKSJ-H \
	$(FITZ_DIR)\cmaps\japanese\90pv-RKSJ-UCS2 $(FITZ_DIR)\cmaps\japanese\90pv-RKSJ-UCS2C \
	$(FITZ_DIR)\cmaps\japanese\Add-RKSJ-H $(FITZ_DIR)\cmaps\japanese\Add-RKSJ-V \
	$(FITZ_DIR)\cmaps\japanese\Adobe-Japan1-4 $(FITZ_DIR)\cmaps\japanese\Adobe-Japan1-UCS2 \
	$(FITZ_DIR)\cmaps\japanese\EUC-H $(FITZ_DIR)\cmaps\japanese\EUC-V \
	$(FITZ_DIR)\cmaps\japanese\Ext-RKSJ-H $(FITZ_DIR)\cmaps\japanese\Ext-RKSJ-V \
	$(FITZ_DIR)\cmaps\japanese\H $(FITZ_DIR)\cmaps\japanese\UniJIS-UCS2-H \
	$(FITZ_DIR)\cmaps\japanese\UniJIS-UCS2-HW-H $(FITZ_DIR)\cmaps\japanese\UniJIS-UCS2-HW-V \
	$(FITZ_DIR)\cmaps\japanese\UniJIS-UCS2-V $(FITZ_DIR)\cmaps\japanese\V

$(O)\cmap_korean.c: $(CMAPDUMP_APP)
	$(CMAPDUMP_APP) $(O)\cmap_korean.c $(FITZ_DIR)\cmaps\korean\Adobe-Korea1-2 \
	$(FITZ_DIR)\cmaps\korean\Adobe-Korea1-UCS2 $(FITZ_DIR)\cmaps\korean\KSC-EUC-H \
	$(FITZ_DIR)\cmaps\korean\KSC-EUC-V $(FITZ_DIR)\cmaps\korean\KSCms-UHC-H \
	$(FITZ_DIR)\cmaps\korean\KSCms-UHC-HW-H $(FITZ_DIR)\cmaps\korean\KSCms-UHC-HW-V \
	$(FITZ_DIR)\cmaps\korean\KSCms-UHC-UCS2 $(FITZ_DIR)\cmaps\korean\KSCms-UHC-V \
	$(FITZ_DIR)\cmaps\korean\KSCpc-EUC-H $(FITZ_DIR)\cmaps\korean\KSCpc-EUC-UCS2 \
	$(FITZ_DIR)\cmaps\korean\KSCpc-EUC-UCS2C $(FITZ_DIR)\cmaps\korean\UniKS-UCS2-H \
	$(FITZ_DIR)\cmaps\korean\UniKS-UCS2-V

$(O)\font_misc.c: $(FONTDUMP_APP)
	$(FONTDUMP_APP) $(O)\font_misc.c \
	$(FITZ_DIR)\fonts\Dingbats.cff \
	$(FITZ_DIR)\fonts\StandardSymL.cff \
	$(FITZ_DIR)\fonts\URWChanceryL-MediItal.cff

$(O)\font_mono.c: $(FONTDUMP_APP)
	$(FONTDUMP_APP) $(O)\font_mono.c \
	$(FITZ_DIR)\fonts\NimbusMonL-Regu.cff \
	$(FITZ_DIR)\fonts\NimbusMonL-ReguObli.cff \
	$(FITZ_DIR)\fonts\NimbusMonL-Bold.cff \
	$(FITZ_DIR)\fonts\NimbusMonL-BoldObli.cff

$(O)\font_serif.c: $(FONTDUMP_APP)
	$(FONTDUMP_APP) $(O)\font_serif.c \
	$(FITZ_DIR)\fonts\NimbusRomNo9L-Regu.cff \
	$(FITZ_DIR)\fonts\NimbusRomNo9L-ReguItal.cff \
	$(FITZ_DIR)\fonts\NimbusRomNo9L-Medi.cff \
	$(FITZ_DIR)\fonts\NimbusRomNo9L-MediItal.cff

$(O)\font_sans.c: $(FONTDUMP_APP)
	$(FONTDUMP_APP) $(O)\font_sans.c \
	$(FITZ_DIR)\fonts\NimbusSanL-Bold.cff \
	$(FITZ_DIR)\fonts\NimbusSanL-BoldItal.cff \
	$(FITZ_DIR)\fonts\NimbusSanL-Regu.cff \
	$(FITZ_DIR)\fonts\NimbusSanL-ReguItal.cff

$(PDFBENCH_APP): $(PDFBENCH_OBJS)
	$(LD) $(LDFLAGS) /OUT:$(PDFBENCH_APP) /PDB:$(PDFBENCH_PDB) \
	$(PDFBENCH_OBJS) $(LIBS) \
	/MAP:$(PDFBENCH_MAP) \
	/SUBSYSTEM:CONSOLE

$(FONTDUMP_APP): $(FONTDUMP_OBJS)
	$(LD) $(LDFLAGS) /OUT:$(FONTDUMP_APP) /PDB:$(FONTDUMP_PDB) \
	$(FONTDUMP_OBJS) $(LIBS) \
	/MAP:$(FONTDUMP_MAP) \
	/SUBSYSTEM:CONSOLE

$(CMAPDUMP_APP): $(CMAPDUMP_OBJS)
	$(LD) $(LDFLAGS) /OUT:$(CMAPDUMP_APP) /PDB:$(CMAPDUMP_PDB) \
	$(CMAPDUMP_OBJS) $(LIBS) \
	/MAP:$(CMAPDUMP_MAP) \
	/SUBSYSTEM:CONSOLE

$(PDFDRAW_APP): $(PDFDRAW_OBJS)
	$(LD) $(LDFLAGS) /OUT:$(PDFDRAW_APP) /PDB:$(PDFDRAW_PDB) \
	$(PDFDRAW_OBJS) $(LIBS) \
	/MAP:$(PDFDRAW_MAP) \
	/SUBSYSTEM:CONSOLE

$(PDFSHOW_APP): $(PDFSHOW_OBJS)
	$(LD) $(LDFLAGS) /OUT:$(PDFSHOW_APP) /PDB:$(PDFSHOW_PDB) \
	$(PDFSHOW_OBJS) $(LIBS) \
	/MAP:$(PDFSHOW_MAP) \
	/SUBSYSTEM:CONSOLE

$(PDFCLEAN_APP): $(PDFCLEAN_OBJS)
	$(LD) $(LDFLAGS) /OUT:$(PDFCLEAN_APP) /PDB:$(PDFCLEAN_PDB) \
	$(PDFCLEAN_OBJS) $(LIBS) \
	/MAP:$(PDFCLEAN_MAP) \
	/SUBSYSTEM:CONSOLE

$(PDFINFO_APP): $(PDFINFO_OBJS)
	$(LD) $(LDFLAGS) /OUT:$(PDFINFO_APP) /PDB:$(PDFINFO_PDB) \
	$(PDFINFO_OBJS) $(LIBS) \
	/MAP:$(PDFINFO_MAP) \
	/SUBSYSTEM:CONSOLE

$(SUMATRA_APP): $(LIBS_OBJS) $(SUMATRA_OBJS)
	$(LD) $(LDFLAGS) /OUT:$(SUMATRA_APP) /PDB:$(SUMATRA_PDB) \
	$(LIBS_OBJS) $(SUMATRA_OBJS) $(LIBS) \
	/MAP:$(SUMATRA_MAP)

$(PDFAPP_APP): $(PDFAPP_OBJS)
	$(LD) $(LDFLAGS) /OUT:$(PDFAPP_APP) /PDB:$(PDFAPP_PDB) \
	$(PDFAPP_OBJS) $(LIBS) \
	/MAP:$(PDFAPP_MAP) \
	/SUBSYSTEM:CONSOLE

$(PDFEXTRACT_APP): $(PDFEXTRACT_OBJS)
	$(LD) $(LDFLAGS) /OUT:$(PDFEXTRACT_APP) /PDB:$(PDFEXTRACT_PDB) \
	$(PDFEXTRACT_OBJS) $(LIBS) \
	/MAP:$(PDFEXTRACT_MAP) \
	/SUBSYSTEM:CONSOLE

# freetype directories
{$(FREETYPE_DIR)\builds\win32}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\builds\unix}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\autofit}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\base}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\bdf}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\cache}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\cff}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\cid}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\gxvalid}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\gzip}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\lzw}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\otvalid}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\pcf}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\pfr}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\psaux}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\pshinter}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\psnames}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\raster}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\sfnt}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\smooth}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\truetype}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\type1}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\type42}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FREETYPE_DIR)\src\winfonts}.c{$(O)}.obj::
	$(CC) $(FT_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

# zlib directories
{$(ZLIB_DIR)}.c{$(O)}.obj::
	$(CC) $(ZLIB_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

# libjpeg directories
{$(JPEG_DIR)}.c{$(O)}.obj::
	$(CC) $(JPEG_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

# jasper directories
{$(JASPER_DIR)\base}.c{$(O)}.obj::
	$(CC) $(JASPER_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(JASPER_DIR)\jp2}.c{$(O)}.obj::
	$(CC) $(JASPER_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(JASPER_DIR)\jpc}.c{$(O)}.obj::
	$(CC) $(JASPER_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(JASPER_DIR)\pgx}.c{$(O)}.obj::
	$(CC) $(JASPER_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

# openjpeg directories
{$(OPENJPEG_DIR)}.c{$(O)}.obj::
	$(CC) $(OPENJPEG_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

# jbig2 directories
{$(JBIG2_DIR)\}.c{$(O)}.obj::
	$(CC) $(JBIG2_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

# fitz directories
{$(FITZ_DIR)\apps\}.c{$(O)}.obj::
	$(CC) $(FITZ_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FITZ_DIR)\apps\common\}.c{$(O)}.obj::
	$(CC) $(FITZ_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FITZ_DIR)\apps\windows\}.c{$(O)}.obj::
	$(CC) $(FITZ_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FITZ_DIR)\mupdf\}.c{$(O)}.obj::
	$(CC) $(FITZ_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FITZ_DIR)\fitzdraw\}.c{$(O)}.obj::
	$(CC) $(FITZ_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FITZ_DIR)\fitz\}.c{$(O)}.obj::
	$(CC) $(FITZ_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FITZ_DIR)\fonts\}.c{$(O)}.obj::
	$(CC) $(FITZ_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{$(FITZ_DIR)\cmaps\}.c{$(O)}.obj::
	$(CC) $(FITZ_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

# files generated during build process (fonts and cmaps)
{$(O)\}.c{$(O)}.obj::
	$(CC) $(FITZ_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

# sumatra directories
{baseutils\}.c{$(O)}.obj::
	$(CC) $(SUMATRA_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{baseutils\}.cpp{$(O)}.obj::
	$(CC) $(SUMATRA_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{src\}.cc{$(O)}.obj::
	$(CC) $(SUMATRA_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{src\}.cpp{$(O)}.obj::
	$(CC) $(SUMATRA_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{DialogSizer\}.cpp{$(O)}.obj::
	$(CC) $(SUMATRA_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

{src\}.c{$(O)}.obj::
	$(CC) $(SUMATRA_CFLAGS) /Fo$(O)\ /Fd$(O)\vc80.pdb  $<

force: ;
