blob: 1cacd2f97472aaac59f00fdef176b2e1f0dc4ae0 [file] [log] [blame] [edit]
# Makefile for Visual Studio
# Written by Krzysztof Kowalczyk (http://blog.kowalczyk.info)
# This code is in public domain.
CC = cl.exe
LD = link.exe
ZLIB_DIR=ext\zlib
FREETYPE_DIR=ext\freetype231
JPEG_DIR=ext\jpeg
VALID_TARGET=no
!if "$(TARGET)"=="rel"
OUTDIR=rel
#/Gy - separate functions for linker. Generates smaller code.
#/GL - enables link-time code generation. Requires /LTCG in linker.
# generates smaller and faster code
CFLAGS = $(CFLAGS) /D "NDEBUG" /D "_SECURE_CSL=0" /MD /Ox /Os /Gy /GL
# /Gr - __fastcall calling convention. Generates smaller and faster code.
#CFLAGS = $(CFLAGS) /Gr
# /Oy - omits frame pointers. Should generate smaller code but I'm not seeing that,
# so I'm not enabling this function.
#CFLAGS = $(CFLAGS) /Oy
VALID_TARGET=yes
!endif
!if "$(TARGET)"=="dbg"
OUTDIR=dbg
CFLAGS = $(CFLAGS) /D "_DEBUG" /MDd /Od
VALID_TARGET=yes
!endif
!if "$(ANALYZE)"=="yes"
CFLAGS = $(CFLAGS) /analyze
!endif
O=$(OUTDIR)
CFLAGS = $(CFLAGS) /nologo /c
# standard windows defines
CFLAGS = $(CFLAGS) /D "WIN32" /D "WINDOWS" /D "_WIN32_WINNT=0x0500"
#CFLAGS = $(CFLAGS) /D "WIN32_LEAN_AND_MEAN"
#CFLAGS = $(CFLAGS) /D "UNICODE" /D "_UNICODE"
CFLAGS = $(CFLAGS) /D "_SCL_SECURE_NO_DEPRECATE" /D "_CRT_SECURE_NO_DEPRECATE"
CFLAGS = $(CFLAGS) /D "_CRT_SECURE_NO_WARNINGS"
#CFLAGS = $(CFLAGS) /D "_DLL"
#CFLAGS = $(CFLAGS) /wd4996
CFLAGS = $(CFLAGS) /W3
#CFLAGS = $(CFLAGS) /Wall
# /GR- : disable C++ RTTI
CFLAGS = $(CFLAGS) /GR-
CFLAGS = $(CFLAGS) /Zi
# /FAscu - generate assembly listings
CFLAGS = $(CFLAGS) /FAscu
CFLAGS = $(CFLAGS) /Imsvc /Imsvc/poppler /I. /Igoo /Ipoppler /Isplash /Ifofi /Itest
CFLAGS = $(CFLAGS) /I$(ZLIB_DIR) /I$(JPEG_DIR) /I$(FREETYPE_DIR)\include
LIBS = $(LIBS) kernel32.lib advapi32.lib user32.lib gdi32.lib
LDFLAGS = $(LDFLAGS) /nologo /DEBUG
#CFLAGS = $(CFLAGS) /D "USE_FIXEDPOINT"
!if "$(TARGET)"=="rel"
# /opt:ref - removes unused functions
# /opt:icf - removes duplicate functions
# /ltcg - link-time code generation. Generates smaller and faster code. Requires /GL when compiling.
LDFLAGS = $(LDFLAGS) /opt:ref /opt:icf /opt:nowin98 /ltcg
LIBS = $(LIBS) $(ZLIB_DIR)\zlib_s.lib $(JPEG_DIR)\jpeg_s.lib $(FREETYPE_DIR)\freetype231mt.lib
LDFLAGS = $(LDFLAGS) /NODEFAULTLIB:libcmt
!else
LIBS = $(LIBS) $(ZLIB_DIR)\zlib_ds.lib $(JPEG_DIR)\jpeg_ds.lib $(FREETYPE_DIR)\freetype231mt_d.lib
LDFLAGS = $(LDFLAGS) /NODEFAULTLIB:libcmtd
!endif
FOFI_OBJS=$(O)\FoFiBase.obj $(O)\FoFiEncodings.obj $(O)\FoFiTrueType.obj \
$(O)\FoFiType1.obj $(O)\FoFiType1C.obj
GOO_OBJS=$(O)\FixedPoint.obj $(O)\GooHash.obj $(O)\GooList.obj $(O)\GooString.obj \
$(O)\GooTimer.obj $(O)\gfile.obj $(O)\gmem.obj $(O)\gmempp.obj
POPPLER_OBJS=$(O)\Annot.obj $(O)\Array.obj $(O)\BuiltinFont.obj $(O)\BuiltinFontTables.obj \
$(O)\CMap.obj $(O)\Catalog.obj $(O)\CharCodeToUnicode.obj $(O)\DCTStream.obj \
$(O)\Decrypt.obj $(O)\Dict.obj $(O)\Error.obj \
$(O)\FontEncodingTables.obj $(O)\FontInfo.obj $(O)\Form.obj $(O)\Function.obj \
$(O)\Gfx.obj $(O)\GfxFont.obj $(O)\GfxState.obj $(O)\GlobalParams.obj \
$(O)\GlobalParamsWin.obj \
$(O)\JArithmeticDecoder.obj $(O)\JBIG2Stream.obj $(O)\JPXStream.obj \
$(O)\Lexer.obj $(O)\Link.obj $(O)\NameToCharCode.obj $(O)\Object.obj \
$(O)\Outline.obj $(O)\OutputDev.obj $(O)\PDFDoc.obj $(O)\PDFDocEncoding.obj \
$(O)\Page.obj $(O)\PageLabelInfo.obj $(O)\PageTransition.obj $(O)\Parser.obj \
$(O)\PreScanOutputDev.obj $(O)\ProfileData.obj $(O)\PSTokenizer.obj \
$(O)\SecurityHandler.obj $(O)\Sound.obj $(O)\SplashOutputDev.obj \
$(O)\Stream.obj $(O)\TextOutputDev.obj $(O)\UnicodeMap.obj \
$(O)\UnicodeTypeTable.obj $(O)\XRef.obj
# $(O)\FlateStream.obj
SPLASH_OBJS=$(O)\Splash.obj $(O)\SplashBitmap.obj $(O)\SplashClip.obj \
$(O)\SplashFTFont.obj $(O)\SplashFTFontEngine.obj $(O)\SplashFTFontFile.obj \
$(O)\SplashFont.obj $(O)\SplashFontEngine.obj $(O)\SplashFontFile.obj \
$(O)\SplashFontFileID.obj $(O)\SplashPath.obj $(O)\SplashPattern.obj \
$(O)\SplashScreen.obj $(O)\SplashState.obj $(O)\SplashT1Font.obj \
$(O)\SplashT1FontEngine.obj $(O)\SplashT1FontFile.obj \
$(O)\SplashXPath.obj $(O)\SplashXPathScanner.obj
OBJS = $(GOO_OBJS) $(POPPLER_OBJS) $(SPLASH_OBJS) $(FOFI_OBJS)
PERFTEST_EXE=$(O)\perftest.exe
PERFTEST_PDB=$(O)\perftest.pdb
PERFTEST_OBJS=$(OBJS) $(O)\perf-test.obj $(O)\perf-test-preview-win.obj
!if "$(VALID_TARGET)"=="yes"
all: $(OUTDIR) $(PERFTEST_EXE)
$(OUTDIR): force
@if not exist $(OUTDIR) mkdir $(OUTDIR)
clean: force
-rmdir /S /Q $(OUTDIR)
rebuild: clean all
!else
all clean: force
@echo TARGET must be set to dbg or rel
!endif
$(PERFTEST_EXE): $(PERFTEST_OBJS)
$(LD) $(LDFLAGS) /OUT:$@ \
/PDB:$(PERFTEST_PDB) \
$** $(LIBS) \
/SUBSYSTEM:CONSOLE /MACHINE:X86
{fofi\}.cc{$(OUTDIR)}.obj::
$(CC) $(CFLAGS) -Fo$(OUTDIR)\ /Fd$(OUTDIR)\vc80.pdb /Fa$(OUTDIR)\ $<
{goo\}.cc{$(OUTDIR)}.obj::
$(CC) $(CFLAGS) -Fo$(OUTDIR)\ /Fd$(OUTDIR)\vc80.pdb /Fa$(OUTDIR)\ $<
{poppler\}.cc{$(OUTDIR)}.obj::
$(CC) $(CFLAGS) -Fo$(OUTDIR)\ /Fd$(OUTDIR)\vc80.pdb /Fa$(OUTDIR)\ $<
{splash\}.cc{$(OUTDIR)}.obj::
$(CC) $(CFLAGS) -Fo$(OUTDIR)\ /Fd$(OUTDIR)\vc80.pdb /Fa$(OUTDIR)\ $<
{test\}.cc{$(OUTDIR)}.obj::
$(CC) $(CFLAGS) -Fo$(OUTDIR)\ /Fd$(OUTDIR)\vc80.pdb /Fa$(OUTDIR)\ $<
force: ;