summaryrefslogtreecommitdiff
path: root/makefile.vc
blob: fecc0eee99bbeaa48c049fd45ffeb3a72f2d1888 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# Makefile for Visual Studio
# Written by Krzysztof Kowalczyk (http://blog.kowalczyk.info)
# This code is in public domain.
# Use it like this from command line:
# * add Visual Studio tools to your %PATH%
# * nmake -f makefile.vc TARGET=rel
#   or
# * nmake -f makefile.vc TARGET=dbg
# * the result is perftest.exe in either rel or dbg directory
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: ;