blob: c87583c5089db86765092ecb2b1ed35695e6e2bf (
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
246
247
248
249
250
251
252
253
254
255
256
257
|
# To build locally get a copy of the dependancies (http://windows.php.net/downloads/php-sdk/deps/)
# These are the dependencies used by PHP and largely used and tested. These binaries are built using
# the sources available at https://github.com/winlibs
# Then run 'nmake /f windows\Makefile.vc' in MS dev console
# To build tests as well 'nmake /f windows\Makefile.vc all'
# To build tests and execute them 'nmake /f windows\Makefile.vc check'
CC=cl
LD=link
LB=lib
!IFNDEF DEBUG
DEBUG=0
!ENDIF
!IFNDEF WITH_DEVEL
WITH_DEVEL=..\deps
!ENDIF
!IFNDEF WITH_BUILD
WITH_BUILD=..\gdbuild
!ENDIF
LIBGD_SRC_DIR=src
LIBGD_OBJ_DIR=$(WITH_BUILD)
LIBGD_BIN_DIR=$(WITH_BUILD)\bin
LIBGD_TEST_DIR=test
!IFNDEF PLATFORM
PLATFORM=x86
!ENDIF
# detect x64 cross-compiler env
!IF "$(PREFERREDTOOLARCHITECTURE)" == "x64"
PLATFORM=x64
!ENDIF
PLATFORM=$(PLATFORM:X=x)
BUILD_DIR=$(WITH_BUILD)
!MESSAGE library source: $(LIBGD_SRC_DIR)
GD_DLL=libgd.dll
GD_LIB=libgd_a.lib
GD_CONFIG_H=$(LIBGD_SRC_DIR)\config.h
SDR=$(BUILD_DIR)^\
TDR=$(BUILD_DIR)\tests^\
TARGETDLL=$(BUILD_DIR)\$(GD_DLL)
TARGETLIB=$(BUILD_DIR)\$(GD_LIB)
LIB_OBJS= \
$(LIBGD_OBJ_DIR)\gd.obj \
$(LIBGD_OBJ_DIR)\gdcache.obj \
$(LIBGD_OBJ_DIR)\gd_color.obj \
$(LIBGD_OBJ_DIR)\gd_color_match.obj \
$(LIBGD_OBJ_DIR)\gdfontg.obj \
$(LIBGD_OBJ_DIR)\gdfontl.obj \
$(LIBGD_OBJ_DIR)\gdfontmb.obj \
$(LIBGD_OBJ_DIR)\gdfonts.obj \
$(LIBGD_OBJ_DIR)\gdfontt.obj \
$(LIBGD_OBJ_DIR)\gdft.obj \
$(LIBGD_OBJ_DIR)\gdfx.obj \
$(LIBGD_OBJ_DIR)\gd_filename.obj \
$(LIBGD_OBJ_DIR)\gd_filter.obj \
$(LIBGD_OBJ_DIR)\gd_bmp.obj \
$(LIBGD_OBJ_DIR)\gd_gd2.obj \
$(LIBGD_OBJ_DIR)\gd_gd.obj \
$(LIBGD_OBJ_DIR)\gd_gif_in.obj \
$(LIBGD_OBJ_DIR)\gd_gif_out.obj \
$(LIBGD_OBJ_DIR)\gdhelpers.obj \
$(LIBGD_OBJ_DIR)\gd_io.obj \
$(LIBGD_OBJ_DIR)\gd_io_dp.obj \
$(LIBGD_OBJ_DIR)\gd_io_file.obj \
$(LIBGD_OBJ_DIR)\gd_io_ss.obj \
$(LIBGD_OBJ_DIR)\gd_jpeg.obj \
$(LIBGD_OBJ_DIR)\gd_security.obj \
$(LIBGD_OBJ_DIR)\gd_tga.obj \
$(LIBGD_OBJ_DIR)\gd_tiff.obj \
$(LIBGD_OBJ_DIR)\gd_xbm.obj \
$(LIBGD_OBJ_DIR)\gdkanji.obj \
$(LIBGD_OBJ_DIR)\gd_nnquant.obj \
$(LIBGD_OBJ_DIR)\gd_png.obj \
$(LIBGD_OBJ_DIR)\gd_ss.obj \
$(LIBGD_OBJ_DIR)\gdtables.obj \
$(LIBGD_OBJ_DIR)\gd_topal.obj \
$(LIBGD_OBJ_DIR)\gd_transform.obj \
$(LIBGD_OBJ_DIR)\gd_wbmp.obj \
$(LIBGD_OBJ_DIR)\gdxpm.obj \
$(LIBGD_OBJ_DIR)\wbmp.obj \
$(LIBGD_OBJ_DIR)\gd_interpolation.obj \
$(LIBGD_OBJ_DIR)\gd_matrix.obj \
$(LIBGD_OBJ_DIR)\gd_rotate.obj \
$(LIBGD_OBJ_DIR)\gd_version.obj \
$(LIBGD_OBJ_DIR)\gd_crop.obj \
$(LIBGD_OBJ_DIR)\gd_color_map.obj \
$(LIBGD_OBJ_DIR)\gd_webp.obj
LIBS=kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib Gdi32.Lib
LIBS_GD=libjpeg_a.lib freetype_a.lib libpng_a.lib libiconv_a.lib zlib_a.lib libwebp_a.lib libxpm_a.lib libtiff.lib
PROG_EXES= \
$(LIBGD_OBJ_DIR)\gdcmpgif.exe \
$(LIBGD_OBJ_DIR)\gdtopng.exe \
$(LIBGD_OBJ_DIR)\pngtogd.exe \
$(LIBGD_OBJ_DIR)\gdparttopng.exe \
$(LIBGD_OBJ_DIR)\gd2topng.exe \
$(LIBGD_OBJ_DIR)\pngtogd2.exe \
$(LIBGD_OBJ_DIR)\annotate.exe \
$(LIBGD_OBJ_DIR)\gd2copypal.exe \
$(LIBGD_OBJ_DIR)\gd2togif.exe \
$(LIBGD_OBJ_DIR)\giftogd2.exe
PROG_OBJS=$(PROG_EXES:exe=obj)
INCLUDES=/Isrc /I$(WITH_DEVEL)\include -I$(WITH_DEVEL)\include\libpng16 -I$(WITH_DEVEL)\include\freetype -I$(WITH_DEVEL)\include\freetype2 /Itests /Itests\gdtest -I$(WITH_DEVEL)\include\
LDFLAGS=/nologo /nodefaultlib:libcmt /libpath:$(WITH_DEVEL)\lib /MACHINE:$(PLATFORM)
!IF $(DEBUG)
LDFLAGS=$(LDFLAGS) /DEBUG
!ENDIF
!IF $(DEBUG)
CFLAGS=/nologo /Qvec-report:1 /MD /TC /Zi
!ELSE
CFLAGS=/nologo /O2 /Qvec-report:1 /MD /TC
!ENDIF
CFLAGS= $(CFLAGS) \
/DWIN32=1\
/D_WIN32=1\
/DMSWIN32=1\
/DBGDWIN32=1\
/DHAVE_FT2BUILD_H=1\
/DHAVE_GD_H=1\
/DHAVE_ICONV_H=1\
/DHAVE_GD_BUNDLED=1\
/DHAVE_LIBFREETYPE=1\
/DHAVE_LIBJPEG=1\
/DHAVE_LIBPNG=1\
/DHAVE_LIBWEBP=1\
/DHAVE_LIBZ=1\
/DHAVE_LIBXPM=1\
/DHAVE_LIBTIFF=1\
$(INCLUDES)
TEST_CFLAGS=$(CFLAGS)
TEST_LDFLAGS=$(LDFLAGS) $(SDR)readdir.obj $(SDR)gdtest.obj $(BUILD_DIR)\libgd.lib
TEST_LIST=$(TDR)testlist.txt
TEST_MK=$(TDR)Maketests.vc
TEST_OBJS=$(TEST_EXES:tests=obj)
TEST_OBJS=$(TEST_OBJS:exe=obj)
# create buil dir and test exe dir. test ext dir may not be called but easier like this
# so we can include the gentest file
!IF [if not exist $(BUILD_DIR) mkdir $(BUILD_DIR)]
!ENDIF
!IF [if not exist $(TDR) mkdir $(TDR)]
!ENDIF
!IF [$(MAKEDIR)\windows\gentest.bat tests $(BUILD_DIR) "$(TEST_CFLAGS)" "$(TEST_LDFLAGS)" $(CC) $(LD) "$(TEST_MK)" "$(TEST_LIST)"]
!ENDIF
# pseudotargets
build_libs: make_dirs $(TARGETDLL) $(TARGETLIB)
build_progs: build_libs $(PROG_OBJS) $(PROG_EXES)
all: build_libs build_tests build_progs
check: all run_tests
clean:
@if exist $(SDR) rd $(SDR) /s /q
@if exist $(TDR) rd $(TDR) /s /q
@if exist $(BUILD_DIR)\*.exe del $(BUILD_DIR)\*.exe /q
# helpers
make_dirs:
@if not exist $(BUILD_DIR) mkdir $(BUILD_DIR)
@if not exist $(SDR) mkdir $(SDR)
@echo #ifndef HAVE_FT2BUILD_H> $(GD_CONFIG_H)
@echo #define HAVE_FT2BUILD_H>> $(GD_CONFIG_H)
@echo #endif>> $(GD_CONFIG_H)
@echo #ifndef HAVE_ICONV_H>> $(GD_CONFIG_H)
@echo #define HAVE_ICONV_H>> $(GD_CONFIG_H)
@echo #endif>> $(GD_CONFIG_H)
@echo #ifndef HAVE_LIBFREETYPE>> $(GD_CONFIG_H)
@echo #define HAVE_LIBFREETYPE>> $(GD_CONFIG_H)
@echo #endif>> $(GD_CONFIG_H)
@echo #ifndef HAVE_LIBJPEG>> $(GD_CONFIG_H)
@echo #define HAVE_LIBJPEG>> $(GD_CONFIG_H)
@echo #endif>> $(GD_CONFIG_H)
@echo #ifndef HAVE_LIBPNG>> $(GD_CONFIG_H)
@echo #define HAVE_LIBPNG>> $(GD_CONFIG_H)
@echo #endif>> $(GD_CONFIG_H)
@echo #ifndef HAVE_LIBWEBP>> $(GD_CONFIG_H)
@echo #define HAVE_LIBWEBP>> $(GD_CONFIG_H)
@echo #endif>> $(GD_CONFIG_H)
@echo #ifndef HAVE_LIBZ>> $(GD_CONFIG_H)
@echo #define HAVE_LIBZ>> $(GD_CONFIG_H)
@echo #endif>> $(GD_CONFIG_H)
@echo #ifndef HAVE_LIBXPM>> $(GD_CONFIG_H)
@echo #define HAVE_LIBXPM>> $(GD_CONFIG_H)
@echo #endif>> $(GD_CONFIG_H)
@echo #ifndef HAVE_INTTYPES_H>> $(GD_CONFIG_H)
@echo #define HAVE_INTTYPES_H>> $(GD_CONFIG_H)
@echo #endif>> $(GD_CONFIG_H)
@echo #ifndef HAVE_SYS_STAT_H>> $(GD_CONFIG_H)
@echo #define HAVE_SYS_STAT_H>> $(GD_CONFIG_H)
@echo #endif>> $(GD_CONFIG_H)
@echo #ifndef HAVE_LIBTIFF>> $(GD_CONFIG_H)
@echo #define HAVE_LIBTIFF>> $(GD_CONFIG_H)
@echo #endif>> $(GD_CONFIG_H)
run_tests: pretest
@cd $(TDR)
@$(MAKEDIR)\windows\run_tests
# libgd
$(LIBGD_OBJ_DIR):
@if not exist $(LIBGD_OBJ_DIR) mkdir $(LIBGD_OBJ_DIR)
$(LIBGD_BIN_DIR):
@if not exist $(LIBGD_BIN_DIR) mkdir $(LIBGD_BIN_DIR)
$(TARGETDLL): $(LIB_OBJS)
@$(LD) /DLL /OUT:$@ $(LIB_OBJS) $(LIBS_GD) $(LIBS) $(LDFLAGS)
$(TARGETLIB): $(LIB_OBJS)
@$(LB) /OUT:$@ $(LIB_OBJS) $(LDFLAGS)
{$(LIBGD_SRC_DIR)\}.c{$(LIBGD_OBJ_DIR)\}.obj:
$(CC) $(CFLAGS) /c /Fo"$@" /Fd$*.pdb $<
all: $(LIBGD_OBJ_DIR) $(LIBGD_BIN_DIR) $(LIB_OBJS) $(STATICLIB)
.SUFFIXES: .c .obj .res .exe
# tests
!INCLUDE $(TEST_MK)
build_tests: $(TEST_LIST) $(SDR)readdir.obj $(SDR)gdtest.obj $(TEST_EXES)
$(SDR)gdtest.obj: $(TARGETDLL) tests\gdtest\gdtest.c
@$(CC) $(CFLAGS) /DGDTEST_TOP_DIR=\"$(MAKEDIR:\=\\)\\tests\" /c tests\gdtest\gdtest.c /Fd$(SDR)gdtest.pdb /Fo$(SDR)gdtest.obj
$(SDR)readdir.obj: $(TARGETDLL) tests\gdtest\readdir.c
@$(CC) $(CFLAGS) /c tests\gdtest\readdir.c /Fd$(SDR)readdir.pdb /Fo$(SDR)readdir.obj
pretest: $(TARGETDLL)
if not exist $(TDR) mkdir $(TDR)
copy $(TARGETDLL) $(TDR)$(GD_DLL)
# programs
{$(LIBGD_OBJ_DIR)}.obj{$(LIBGD_OBJ_DIR)}.exe:
$(LD) $(LDFLAGS) $** $(BUILD_DIR)\libgd.lib /out:$@
|