summaryrefslogtreecommitdiff
path: root/Makefile.mingw
blob: 1804d9760d9f09595b50c9577ec23583f2f7e3e4 (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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# xdelta 3 - delta compression tools and library
# Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007.  Joshua P. MacDonald

UNAME = $(shell uname)
CYGWIN = $(findstring CYGWIN, $(UNAME))
MINGW = $(findstring MINGW32, $(UNAME))
PYVER = 2.5

ifneq ("$(CYGWIN)", "")
SWIGTGT = xdelta3module.dll
PYTGT = build/lib.cygwin-1.5.24-i686-$(PYVER)/xdelta3main.dll
else
ifneq ("$(MINGW)", "")
# FIXME: WHAT TO DO HERE???
# FIXME: WHAT IF WE ARE CROSS-COMPILING???
endif
endif

SOURCES = xdelta3-cfgs.h \
	  xdelta3-decode.h \
	  xdelta3-djw.h \
	  xdelta3-fgk.h \
	  xdelta3-hash.h \
	  xdelta3-list.h \
	  xdelta3-main.h \
	  xdelta3-python.h \
	  xdelta3-second.h \
	  xdelta3-test.h \
	  xdelta3-test2.h \
	  xdelta3.c \
	  xdelta3.h

TARGETS = xdelta3-debug.exe \
	  xdelta3.exe \
	  xdelta3-debug2.exe \
	  xdelta3-debug3.exe \
	  xdelta3.o \
	  xdelta3_wrap.o \
	  xdelta3-32.exe \
	  xdelta3-64.exe \
	  xdelta3-everything.exe \
	  xdelta3-decoder.exe xdelta3-decoder-nomain.o \
	  xdelta3-nosec.o xdelta3-all.o xdelta3-fgk.o \
	  xdelta3-noext.exe xdelta3-tools.exe \
	  xdelta3-notools.exe \
	  xdelta3_wrap.c xdelta3.py \
	  $(PYTGT) $(SWIGTGT)

PYTHON = python

WIXDIR = "/cygdrive/c/Program Files/wix2.0.4820"
# FIXME: MinGW ????

CFLAGS= -Wall -Wshadow -fno-builtin
XDWINFLAGS:=-DXD3_STDIO=0 -DXD3_POSIX=0 -DXD3_WIN32=1 -DEXTERNAL_COMPRESSION=0

# $Format: "REL=$Xdelta3Version$" $
REL=3.0.1

RELDIR = xdelta$(REL)

EXTRA = Makefile COPYING linkxd3lib.c badcopy.c xdelta3.swig \
	draft-korn-vcdiff.txt xdelta3.vcproj badcopy.vcproj \
	xdelta3-regtest.py xdelta3-test.py setup.py \
	examples/Makefile examples/small_page_test.c \
	examples/README examples/encode_decode_test.c \
	examples/compare_test.c examples/speed_test.c \
	examples/test.h examples/checksum_test.cc \
	xdelta3.py xdelta3_wrap.c xdelta3.wxs xdelta3.wxi \
	README readme.txt

SWIG_FLAGS = -DXD3_DEBUG=0 \
	      -DEXTERNAL_COMPRESSION=0 \
	      -DXD3_USE_LARGEFILE64=1 \
	      -DGENERIC_ENCODE_TABLES=1 \
	      -DSECONDARY_DJW=1 \
	      -DVCDIFF_TOOLS=1 \
	      -DSWIG_MODULE=1

all: xdelta3-debug.exe xdelta3.exe

all-py: all $(PYTGT) $(SWIGTGT)

all-targets: $(TARGETS)

all-targets-test: all-targets test

pytgt: $(PYTGT)
swigtgt: $(SWIGTGT)

test:
	./xdelta3-debug.exe test
#	FIXME: Not good when cross-compiling

clean:
	rm -f $(TARGETS)
	rm -rf build Debug Release core cifs* *.stackdump *.exe \
		xdelta3.ncb xdelta3.suo xdelta3.sln xdelta3.wixobj xdelta3.msi

wix: xdelta3.wxs xdelta3.wxi readme.txt Release\xdelta3.exe
	$(WIXDIR)/candle.exe xdelta3.wxs -out xdelta3.wixobj
	$(WIXDIR)/light.exe xdelta3.wixobj -out xdelta3.msi
#	FIXME: MinGW ????

xdelta3.exe: $(SOURCES)
	$(CC) $(CFLAGS) -O3 xdelta3.c -lm -o xdelta3.exe \
	      $(XDWINFLAGS) \
	      -DGENERIC_ENCODE_TABLES=0 \
	      -DREGRESSION_TEST=1 \
	      -DSECONDARY_DJW=1 \
	      -DSECONDARY_FGK=1 \
	      -DXD3_DEBUG=0 \
	      -DXD3_MAIN=1 \
	      -DXD3_USE_LARGEFILE64=1

xdelta3-debug.exe: $(SOURCES)
	$(CC) -g $(CFLAGS) xdelta3.c -lm -o xdelta3-debug.exe \
		$(XDWINFLAGS) \
		-DGENERIC_ENCODE_TABLES=1 \
		-DREGRESSION_TEST=1 \
		-DSECONDARY_DJW=1 \
		-DSECONDARY_FGK=1 \
		-DXD3_DEBUG=1 \
		-DXD3_MAIN=1 \
		-DXD3_USE_LARGEFILE64=1

xdelta3-32.exe: $(SOURCES)
	$(CC) -O3 $(CFLAGS) xdelta3.c -lm -o xdelta3-32.exe \
	      $(XDWINFLAGS) \
	      -DXD3_DEBUG=1 \
	      -DXD3_USE_LARGEFILE64=0 \
	      -DREGRESSION_TEST=1 \
	      -DSECONDARY_DJW=1 \
	      -DSECONDARY_FGK=1 \
	      -DXD3_MAIN=1

xdelta3-debug2.exe: $(SOURCES)
	$(CC) -g $(CFLAGS) \
		xdelta3.c -o xdelta3-debug2.exe \
		$(XDWINFLAGS) \
		-DXD3_DEBUG=2 \
		-DXD3_MAIN=1 \
		-DXD3_USE_LARGEFILE64=1 \
		-DGENERIC_ENCODE_TABLES=1 \
		-DREGRESSION_TEST=1 \
		-DSECONDARY_DJW=1 \
		-DSECONDARY_FGK=1 \
		-lm

xdelta3-debug3.exe: $(SOURCES)
	$(CC) -g $(CFLAGS) xdelta3.c -o xdelta3-debug3.exe \
		$(XDWINFLAGS) \
		-DXD3_MAIN=1 \
		-DGENERIC_ENCODE_TABLES=1 \
		-DXD3_USE_LARGEFILE64=1 \
		-DREGRESSION_TEST=1 \
		-DXD3_DEBUG=3 \
		-DSECONDARY_DJW=1 \
		-DSECONDARY_FGK=1 \
		-lm

$(PYTGT): $(SOURCES) setup.py
	$(PYTHON) setup.py install --verbose --compile --force

xdelta3_wrap.c xdelta3.py: xdelta3.swig
	swig -python xdelta3.swig

xdelta3.o: $(SOURCES)
	$(CC) -O3 $(CFLAGS) -c xdelta3.c $(SWIG_FLAGS) -o xdelta3.o

xdelta3_wrap.o: xdelta3_wrap.c
	$(CC) -O3 $(CFLAGS) $(SWIG_FLAGS) \
	      -DHAVE_CONFIG_H \
	      -I/usr/include/python$(PYVER) \
	      -I/usr/lib/python$(PYVER)/config \
	      -fpic \
	      -c xdelta3_wrap.c
#	FIXME: MinGW ????

xdelta3module.dll: xdelta3_wrap.o xdelta3.o
	gcc -shared -Wl,--enable-auto-image-base \
		xdelta3.o \
		xdelta3_wrap.o \
		-L/usr/lib/python$(PYVER)/config \
		-lpython$(PYVER) \
		-o xdelta3module.dll
	cp $(SWIGTGT) /usr/lib/python$(PYVER)/site-packages
#	FIXME: MinGW ????

xdelta3-decoder.exe: $(SOURCES)
	$(CC) -O3 -Wall -Wshadow xdelta3.c \
	    -DXD3_ENCODER=0 -DXD3_MAIN=1 -DSECONDARY_FGK=0 -DSECONDARY_DJW=0 \
	    $(XDWINFLAGS) -DVCDIFF_TOOLS=0 \
	    -o xdelta3-decoder.exe

xdelta3-decoder-nomain.o: $(SOURCES) linkxd3lib.c
	$(CC) -O3 -Wall -Wshadow xdelta3.c linkxd3lib.c \
	    -DXD3_ENCODER=0 -DSECONDARY_FGK=0 -DSECONDARY_DJW=0 \
	    -o xdelta3-decoder-nomain.o
	strip xdelta3-decoder-nomain.o
#	FIXME: this OK with MinGW?? What's with strip??

xdelta3-64.exe: $(SOURCES)
	$(CC) -g $(CFLAGS) \
		xdelta3.c \
		-o xdelta3-64.exe \
		$(XDWINFLAGS) \
		-DXD3_MAIN=1 \
		-DREGRESSION_TEST=1 \
		-DXD3_DEBUG=0 \
		-DXD3_USE_LARGEFILE64=1 \
		-lm

xdelta3-everything.exe: $(SOURCES)
	$(CC) -g $(CFLAGS) \
		xdelta3.c \
		-o xdelta3-everything.exe \
		$(XDWINFLAGS) \
		-DXD3_MAIN=1 \
		-DVCDIFF_TOOLS=1 \
		-DREGRESSION_TEST=1 \
		-DSECONDARY_FGK=1 \
		-DSECONDARY_DJW=1 \
		-DGENERIC_ENCODE_TABLES=1 \
		-DGENERIC_ENCODE_TABLES_COMPUTE=1 \
		-DXD3_DEBUG=1 \
		-lm

xdelta3-nosec.o: $(SOURCES)
	$(CC) -O3 $(CFLAGS) -c xdelta3.c $(XDWINFLAGS) -DSECONDARY_FGK=0 -DSECONDARY_DJW=0 -o xdelta3-nosec.o

xdelta3-all.o: $(SOURCES)
	$(CC) -O3 $(CFLAGS) -c xdelta3.c $(XDWINFLAGS) -DSECONDARY_FGK=1 -DSECONDARY_DJW=1 -o xdelta3-all.o

xdelta3-fgk.o: $(SOURCES)
	$(CC) -O3 $(CFLAGS) -c xdelta3.c $(XDWINFLAGS) -DSECONDARY_FGK=1 -DSECONDARY_DJW=0 -o xdelta3-fgk.o

xdelta3-noext.exe: $(SOURCES)
	$(CC) -O3 $(CFLAGS) xdelta3.c $(XDWINFLAGS) -DEXTERNAL_COMPRESSION=0 -DXD3_MAIN=1 -o xdelta3-noext.exe

xdelta3-tools.exe: $(SOURCES)
	$(CC) -O3 $(CFLAGS) xdelta3.c $(XDWINFLAGS) -DXD3_MAIN=1 -o xdelta3-tools.exe

xdelta3-notools.exe: $(SOURCES)
	$(CC) -O3 $(CFLAGS) xdelta3.c $(XDWINFLAGS) -DXD3_MAIN=1 -DVCDIFF_TOOLS=0 -o xdelta3-notools.exe