Debian Codegraph @

windows/msys/Makefile

raw
1 # Simple makefile for building and testing libgd under MSYS/MinGW on
2 # Windows
3
4
5 # The version
6 LIBVER=3.0.1
7
8 # Misc. config flags.
9 CDEFS=-DHAVE_ICONV -DHAVE_ICONV_H \
10 -DHAVE_ICONV_T_DEF -DHAVE_INTTYPES_H \
11 -DHAVE_STDINT_H -DHAVE_VISIBILITY -DICONV_CONST \
12 -DENABLE_GD_FORMATS=1
13
14 # GnuWin32 libs should all be installed in one place.
15 GNUDIR=/c/tools/GnuWin32
16 GNUINC=-I$(GNUDIR)/include
17 GNULIB=-L$(GNUDIR)/lib
18 GNUDLL=$(GNUDIR)/bin/
19
20 # Various optional components. Comment-out the ones you don't have
21 # and edit the paths and options as needed if you do. The default
22 # assumes GnuWin32 packages installed in /c/Program Files/GnuWin32.
23 JPEG_D=-DHAVE_LIBJPEG
24 JPEG_L=-ljpeg
25 JPEG_I=$(GNUINC)
26 JPEG_LIBDIR=$(GNULIB)
27 JPEG_DLLDIR=$(GNUDLL)
28
29 PNG_D=-DHAVE_LIBPNG
30 PNG_L=-lpng
31 PNG_I= #$(GNUINC)
32 PNG_LIBDIR= #$(GNULIB)
33 PNG_DLLDIR= #$(GNUDLL)
34
35 TIFF_D=-DHAVE_LIBTIFF
36 TIFF_L=-ltiff
37 TIFF_I= #$(GNUINC)
38 TIFF_LIBDIR= #$(GNULIB)
39 TIFF_DLLDIR= #$(GNUDLL)
40
41 LIBZ_D=-DHAVE_LIBZ
42 LIBZ_L=-lz
43 LIBZ_I= #$(GNUINC)
44 LIBZ_LIBDIR= #$(GNULIB)
45 LIBZ_DLLDIR= #$(GNUDLL)
46
47 # LIBXPM_D=-DHAVE_LIBXPM
48 # LIBXPM_L=-lxpm
49 # LIBXPM_I= #$(GNUINC)
50 # LIBXPM_LIBDIR= #$(GNULIB)
51
52 FREETYPE_D=-DHAVE_LIBFREETYPE -DHAVE_FT2BUILD_H
53 FREETYPE_L=-lfreetype
54 FREETYPE_I=$(GNUINC)/freetype2/
55 FREETYPE_LIBDIR= #$(GNULIB)
56 FREETYPE_DLLDIR= #$(GNUDLL)
57
58 # FONTCONFIG_D=-DHAVE_LIBFONTCONFIG
59 # FONTCONFIG_L=
60 # FONTCONFIG_I=
61 # FONTCONFIG_LIBDIR=
62
63 ALL_D=$(FREETYPE_D) $(JPEG_D) $(PNG_D) $(TIFF_D) $(LIBZ_D) $(LIBXPM_D)
64 ALL_L=$(FREETYPE_L) $(JPEG_L) $(PNG_L) $(TIFF_L) $(LIBZ_L) $(LIBXPM_L)
65 ALL_I=$(FREETYPE_I) $(JPEG_I) $(PNG_I) $(TIFF_I) $(LIBZ_I) $(LIBXPM_I)
66 ALL_LIBDIR=$(FREETYPE_LIBDIR) $(JPEG_LIBDIR) $(PNG_LIBDIR) $(TIFF_LIBDIR) \
67 $(LIBZ_LIBDIR) $(LIBXPM_LIBDIR)
68 ALL_DLLDIR=$(FREETYPE_DLLDIR) $(JPEG_DLLDIR) $(PNG_DLLDIR) $(TIFF_DLLDIR) \
69 $(LIBZ_DLLDIR) $(LIBXPM_DLLDIR)
70
71 # We need libiconv for internationalization. We default to static
72 # linking because that reduces the number of dependencies. However,
73 # libiconv is released under the GNU GPL which may impose extra
74 # restrictions on redistribution.
75 LIBICONV=/c/MinGW/lib/libiconv.a
76 #LIBICONV=-liconv
77
78
79 DEFS=$(CDEFS) $(ALL_D)
80 INCLUDES=$(ALL_I)
81
82 CC=gcc
83 CFLAGS=-g -O2 -I. -std=gnu99 -fvisibility=hidden -static-libgcc \
84 -D_WIN32 -DBGDWIN32 $(DEFS) $(INCLUDES)
85
86 LD=gcc
87 LDFLAGS=-g -O2 -fvisibility=hidden -static-libgcc $(ALL_LIBDIR)
88 LIBS=$(ALL_L) $(LIBICONV)
89
90 ZIP=zip -j9
91 DIST=libgd-win.zip
92
93 # Get this list from c files in libgd_la_SOURCES in Makefile.mk
94 SRC=gd.c gd_color.c gd_color_map.c gd_transform.c gdfx.c \
95 gd_security.c gd_gd.c gd_gd2.c gd_io.c gd_io_dp.c gd_gif_in.c \
96 gd_gif_out.c gd_io_file.c gd_io_ss.c gd_jpeg.c gd_png.c gd_ss.c \
97 gd_topal.c gd_wbmp.c gdcache.c gdfontg.c gdfontl.c gdfontmb.c \
98 gdfonts.c gdfontt.c gdft.c gdhelpers.c gdkanji.c gdtables.c gdxpm.c \
99 wbmp.c gd_filter.c gd_nnquant.c gd_rotate.c gd_matrix.c \
100 gd_interpolation.c gd_crop.c gd_webp.c gd_heif.c gd_tiff.c gd_tga.c \
101 gd_bmp.c gd_xbm.c gd_color_match.c gd_version.c gd_filename.c \
102 gd_avif.c
103
104 OBJ=$(SRC:.c=.o)
105
106 TARGETBASE=libgd
107 TARGET=$(TARGETBASE).dll
108 TARGET_A=$(TARGETBASE).a
109
110 all:
111 (cd ../../src; make -f ../windows/msys/Makefile $(TARGET))
112
113 # BUG: this sucks in all the DLLs in the lib installation directory,
114 # including those you may not need.
115 dist: all
116 (cd ../..; $(ZIP) $(DIST) src/*.dll src/*.a $$(for d in $(ALL_DLLDIR); do echo $$d/*.dll; done | sort -u) )
117
118
119 clean:
120 -rm ../../$(DIST)
121 (cd ../../src; rm -f *.dll *.a $(OBJ) deps.mk; true)
122
123 check: all
124 bash run_tests.sh "$(GNUDIR)/bin" "$(INCLUDES)"
125
126 deps.mk:
127 [ -f gd.h ] # Sanity check: we're in src/, right?
128 gcc -MM $(DEFS) $(INCLUDES) $(SRC) > deps.mk
129
130 $(TARGET): $(OBJ)
131 gcc -shared -o $(TARGET) $(LDFLAGS) -Wl,--out-implib,$(TARGET_A) \
132 $(OBJ) $(LIBS)
133
134 include deps.mk