Debian Codegraph @

converter/other/Makefile

raw
1 ifeq ($(SRCDIR)x,x)
2 SRCDIR = $(CURDIR)/../..
3 BUILDDIR = $(SRCDIR)
4 endif
5 SUBDIR = converter/other
6 VPATH=.:$(SRCDIR)/$(SUBDIR)
7
8 include $(BUILDDIR)/config.mk
9
10 # The pkg-config test used to be just 'pkg-config libxml-2.0', without the
11 # --exists, and on at least one system, it does the same thing as --exists:
12 # exit code 0 if the package exists; 1 if it does not, with no Standard
13 # Output. But we have evidence that on one system, it issues the whole
14 # package not found try a different path, blah, blah, blah message that
15 # looks like a failure in the build. We're hoping --exists does not do that.
16 # But maybe we didn't do --exists in the first place because it doesn't exist
17 # on older pkg-config. 19.09.20.
18 #
19 # Note that --exists is better for another reason - it fails when the named
20 # package exists, but it is unusable because its prerequisite packages don't.
21 #
22 # Also note that in both cases, the shell command fails if pkg-config
23 # doesn't even exist.
24
25 TEST_PKGCONFIG_LIBXML2 := \
26 if $(PKG_CONFIG) libxml-2.0 --exists; then echo exists; fi
27
28 ifneq ($(shell $(TEST_PKGCONFIG_LIBXML2)),)
29 # pkg-config works and says libxml2 exists on this system
30 XML2_LIBS = $(shell $(PKG_CONFIG) libxml-2.0 --libs)
31 XML2_CFLAGS = $(shell $(PKG_CONFIG) libxml-2.0 --cflags)
32 else
33 ifeq ($(shell xml2-config --version),)
34 XML2_LIBS=NONE
35 XML2_CFLAGS=NONE
36 else
37 XML2_LIBS=$(shell xml2-config --libs)
38 XML2_CFLAGS=$(shell xml2-config --cflags)
39 endif
40 endif
41
42 SUBDIRS = jbig pnmtopalm jpeg2000 cameratopam pamtosvg
43 ifneq ($(BUILD_FIASCO), N)
44 SUBDIRS += fiasco
45 endif
46
47 ifneq ($(TIFFLIB),NONE)
48 ifneq ($(TIFFHDR_DIR)x,x)
49 EXTERN_INCLUDES += -I$(TIFFHDR_DIR)
50 endif
51 endif
52
53 TEST_PKGCONFIG_LIBPNG := \
54 if $(PKG_CONFIG) libpng$(PNGVER) --exists; then echo exists; fi
55
56 ifneq ($(shell $(TEST_PKGCONFIG_LIBPNG)),)
57 # pkg-config works and says libpng exists on this system
58 HAVE_PNGLIB = Y
59 EXTERN_INCLUDES += $(shell $(PKG_CONFIG) libpng$(PNGVER) --cflags)
60 else
61 ifneq ($(shell libpng$(PNGVER)-config --version),)
62 # No pkg-config, but we have libpng-config on this system
63 HAVE_PNGLIB = Y
64 EXTERN_INCLUDES += $(shell libpng$(PNGVER)-config --cflags)
65 else
66 # System can't tell us where libpng is; use stuff from config.mk
67 ifneq ($(PNGLIB),NONE)
68 HAVE_PNGLIB = Y
69 ifneq ($(PNGHDR_DIR)x,x)
70 EXTERN_INCLUDES += -I$(PNGHDR_DIR)
71 endif
72 ifneq ($(ZHDR_DIR)x,x)
73 EXTERN_INCLUDES += -I$(ZHDR_DIR)
74 endif
75 endif
76 endif
77 endif
78
79 ifneq ($(JPEGLIB),NONE)
80 ifneq ($(JPEGHDR_DIR)x,x)
81 EXTERN_INCLUDES += -I$(JPEGHDR_DIR)
82 endif
83 endif
84 ifneq ($(URTLIB),NONE)
85 ifneq ($(URTHDR_DIR)x,x)
86 EXTERN_INCLUDES += -I$(URTHDR_DIR)
87 endif
88 endif
89 ifneq ($(XML2_LIBS),NONE)
90 ifneq ($(XML2_CFLAGS),NONE)
91 EXTERN_INCLUDES += $(XML2_CFLAGS)
92 endif
93 endif
94
95 ifeq ($(TIFFLIB),NONE)
96 TIFF_PREREQ_MISSING = Y
97 endif
98
99 TIFFLIB_EXTRALIBS =
100 ifeq ($(TIFFLIB_NEEDS_JPEG),Y)
101 ifeq ($(JPEGLIB),NONE)
102 TIFF_PREREQ_MISSING = Y
103 else
104 TIFFLIB_EXTRALIBS += $(JPEGLIB)
105 endif
106 endif
107 ifeq ($(TIFFLIB_NEEDS_Z),Y)
108 ifeq ($(ZLIB),NONE)
109 TIFF_PREREQ_MISSING = Y
110 else
111 TIFFLIB_EXTRALIBS += $(ZLIB)
112 endif
113 endif
114
115 # TIFFLIB_USERLIBS is for the user to set manually, on the make command line
116 # or manually added to config.mk. There are arcane situations where the TIFF
117 # library refers to additional libraries not handled above.
118
119 TIFFLIB_EXTRALIBS += $(TIFFLIB_USERLIBS)
120
121 # Pnmtops's "flate" compression function requires libz. But if we don't
122 # have libz, we still build Pnmtops; we just omit the flate compression
123 # capability.
124 ifeq ($(ZLIB),NONE)
125 PNMTOPS_ZLIB_OPT =
126 PNMTOPS_NOFLATE_OPT = -DNOFLATE
127 else
128 PNMTOPS_ZLIB_OPT = $(ZLIB)
129 PNMTOPS_NOFLATE_OPT =
130 endif
131
132
133 PORTBINARIES = avstopam bmptopnm fitstopnm \
134 gemtopnm giftopnm hdifftopam infotopam \
135 pamtoavs pamtodjvurle pamtofits pamtogif \
136 pamtohdiff pamtohtmltbl pamtompfont pamtooctaveimg \
137 pamtopam pamtopdbimg pamtopfm pamtopnm \
138 pamtoqoi pamtosrf pamtouil \
139 pamtowinicon pamtoxvmini \
140 pbmtopgm pdbimgtopam pfmtopam \
141 pgmtopbm pgmtoppm ppmtopgm pnmtoddif \
142 pnmtopclxl pnmtorast \
143 pnmtosgi pnmtosir pamtotga pnmtoxwd qoitopam \
144 rasttopnm rlatopam sgitopnm sirtopnm srftopam sunicontopnm \
145 winicontopam xwdtopnm yuy2topam zeisstopnm \
146
147 ifneq ($(DONT_HAVE_PROCESS_MGMT),Y)
148 PORTBINARIES += pstopnm pnmtops
149 endif
150
151 ifeq ($(HAVE_PNGLIB),Y)
152 PORTBINARIES += pamtopng pnmtopng pngtopam
153 endif
154 ifneq ($(JPEGLIB),NONE)
155 PORTBINARIES += jpegtopnm pnmtojpeg
156 endif
157 ifneq ($(TIFF_PREREQ_MISSING),Y)
158 PORTBINARIES += tifftopnm pamtotiff pnmtotiffcmyk
159 endif
160 ifneq ($(URTLIB),NONE)
161 PORTBINARIES += rletopnm pnmtorle
162 endif
163
164 ifneq ($(XML2_LIBS),NONE)
165 PORTBINARIES += svgtopam
166 endif
167
168 BINARIES = $(PORTBINARIES)
169
170 MERGEBINARIES = $(BINARIES)
171
172 EXTRA_OBJECTS = exif.o rast.o ipdb.o srf.o
173 ifeq ($(HAVE_PNGLIB),Y)
174 EXTRA_OBJECTS += pngtxt.o
175 EXTRA_OBJECTS += pngx.o
176 endif
177 ifneq ($(JPEGLIB),NONE)
178 EXTRA_OBJECTS += jpegdatasource.o
179 endif
180 ifneq (($TIFF_PREREQ_MISSING),Y)
181 EXTRA_OBJECTS += tiff.o
182 endif
183
184 OBJECTS = $(BINARIES:%=%.o) $(EXTRA_OBJECTS)
185 MERGE_OBJECTS = $(MERGEBINARIES:%=%.o2) $(EXTRA_OBJECTS)
186
187 HAVE_MERGE_COMPAT=YES
188
189 pnmtops.o pnmtops.o2: CFLAGS_TARGET=$(PNMTOPS_NOFLATE_OPT)
190
191 SCRIPTS = anytopnm pnmtoplainpnm
192
193 .PHONY: all
194 all: $(BINARIES) $(SUBDIRS:%=%/all)
195
196 include $(SRCDIR)/common.mk
197
198 ifeq ($(NEED_RUNTIME_PATH),Y)
199 LIBOPTR = -runtime
200 else
201 LIBOPTR =
202 endif
203
204 LIBOPTS_TIFF = $(shell $(LIBOPT) \
205 $(LIBOPTR) $(TIFFLIB) $(TIFFLIB_EXTRALIBS))
206
207 tifftopnm pamtotiff pnmtotiffcmyk: tiff.o
208 tifftopnm pamtotiff pnmtotiffcmyk: ADDL_OBJECTS = tiff.o
209 tifftopnm pamtotiff pnmtotiffcmyk: \
210 LDFLAGS_TARGET = \
211 $(shell $(LIBOPT) $(LIBOPTR) $(TIFFLIB) $(TIFFLIB_EXTRALIBS))
212
213 ifneq ($(shell $(TEST_PKGCONFIG_LIBPNG)),)
214 # pkg-config works and says libpng exists on this system
215 PNGLIB_LIBOPTS = $(shell $(PKG_CONFIG) libpng$(PNGVER) --libs)
216 else
217 ifneq ($(shell libpng$(PNGVER)-config --version),)
218 # No pkg-config, but we have libpng-config on this system
219 PNGLIB_LIBOPTS = $(shell libpng$(PNGVER)-config --ldflags)
220 else
221 # System can't tell us where libpng is; use stuff from config.mk
222 PNGLIB_LIBOPTS = $(shell $(LIBOPT) $(LIBOPTR) $(PNGLIB) $(ZLIB))
223 endif
224 endif
225
226 pngtopam: pngx.o
227 pngtopam: ADDL_OBJECTS = pngx.o
228 pngtopam: LDFLAGS_TARGET = $(PNGLIB_LIBOPTS)
229
230 pamtopng: pngx.o pngtxt.o
231 pamtopng: ADDL_OBJECTS = pngx.o pngtxt.o
232 pamtopng: LDFLAGS_TARGET = $(PNGLIB_LIBOPTS)
233
234 pnmtopng: pngx.o pngtxt.o
235 pnmtopng: ADDL_OBJECTS = pngx.o pngtxt.o
236 pnmtopng: LDFLAGS_TARGET = $(PNGLIB_LIBOPTS)
237
238 jpegtopnm: jpegdatasource.o exif.o
239 jpegtopnm: ADDL_OBJECTS = jpegdatasource.o exif.o
240 jpegtopnm: LDFLAGS_TARGET = $(shell $(LIBOPT) $(LIBOPTR) $(JPEGLIB))
241
242 srftopam pamtosrf: srf.o
243 srftopam pamtosrf: ADDL_OBJECTS = srf.o
244
245 pnmtojpeg: LDFLAGS_TARGET = $(shell $(LIBOPT) $(LIBOPTR) $(JPEGLIB))
246
247 svgtopam: LDFLAGS_TARGET = $(XML2_LIBS)
248
249 # If URTLIB is BUNDLED_URTLIB, then we're responsible for building it, which
250 # means it needs to be a dependency:
251 ifeq ($(URTLIB), $(BUNDLED_URTLIB))
252 rletopnm pnmtorle: $(URTLIB)
253 endif
254
255 rletopnm pnmtorle: LDFLAGS_TARGET = $(shell $(LIBOPT) $(URTLIB))
256
257 pnmtops: LDFLAGS_TARGET = $(shell $(LIBOPT) $(PNMTOPS_ZLIB_OPT))
258
259 pnmtorast rasttopnm: rast.o
260 pnmtorast rasttopnm: ADDL_OBJECTS = rast.o
261
262 pdbimgtopam pamtopdbimg: ipdb.o
263 pdbimgtopam pamtopdbimg: ADDL_OBJECTS = ipdb.o
264
265 # Declare dependencies on created header files (symbolic links, actually).
266
267 bmptopnm.o bmptopnm.o2: bmp.h
268
269 pamtotga.o pamtotga.o2: tga.h
270
271 install.bin install.merge: install.bin.local
272 .PHONY: install.bin.local
273 install.bin.local: $(PKGDIR)/bin
274 # Remember that $(SYMLINK) might just be a copy command.
275 # backward compatibility: program used to be named pnmnoraw
276 cd $(PKGDIR)/bin ; \
277 $(SYMLINK) pnmtoplainpnm$(EXE) pnmnoraw$(EXE)
278 # backward compatibility: program used to be gemtopbm
279 cd $(PKGDIR)/bin ; \
280 $(SYMLINK) gemtopnm$(EXE) gemtopbm$(EXE)
281 # In October 2001, pnmtojpeg replaced ppmtojpeg
282 ifneq ($(JPEGLIB),NONE)
283 cd $(PKGDIR)/bin ; \
284 $(SYMLINK) pnmtojpeg$(EXE) ppmtojpeg$(EXE)
285 endif
286 # In March 2002, bmptopnm replaced bmptoppm
287 cd $(PKGDIR)/bin ; \
288 $(SYMLINK) bmptopnm$(EXE) bmptoppm$(EXE)
289 # In May 2002, pamtouil replaced ppmtouil
290 cd $(PKGDIR)/bin ; \
291 $(SYMLINK) pamtouil$(EXE) ppmtouil$(EXE)
292 # In July 2002, pamtotga replaced ppmtotga
293 cd $(PKGDIR)/bin ; \
294 $(SYMLINK) pamtotga$(EXE) ppmtotga$(EXE)
295 # In March 2005, we realized that pamtopnm obviates pnmtopnm
296 cd $(PKGDIR)/bin ; \
297 $(SYMLINK) pamtopnm$(EXE) pnmtopnm$(EXE)
298 # In October 2005, pamtofits replaced pnmtofits
299 cd $(PKGDIR)/bin ; \
300 $(SYMLINK) pamtofits$(EXE) pnmtofits$(EXE)
301 ifneq ($(TIFF_PREREQ_MISSING),Y)
302 # In October 2005, pamtotiff replaced pnmtotiff
303 cd $(PKGDIR)/bin ; \
304 $(SYMLINK) pamtotiff$(EXE) pnmtotiff$(EXE)
305 endif
306 ifeq ($(HAVE_PNGLIB),Y)
307 # In September 2009, pngtopam replaced pngtopnm
308 cd $(PKGDIR)/bin ; \
309 $(SYMLINK) pngtopam$(EXE) pngtopnm$(EXE)
310 endif
311 # In December 2010, sunicontopnm replaced icontopbm
312 cd $(PKGDIR)/bin ; \
313 $(SYMLINK) sunicontopnm$(EXE) icontopbm$(EXE)
314 ifeq ($(HAVE_PNGLIB),Y)
315 # In June 2015, pamtopng replaced pamrgbapng
316 cd $(PKGDIR)/bin ; \
317 $(SYMLINK) pamtopng$(EXE) pamrgbatopng$(EXE)
318 endif
319
320 mergecomptrylist:
321 cat /dev/null >$@
322 echo "TRY(\"bmptoppm\", main_bmptopnm);" >>$@
323 echo "TRY(\"gemtopbm\", main_gemtopnm);" >>$@
324 ifneq ($(JPEGLIB),NONE)
325 echo "TRY(\"ppmtojpeg\", main_pnmtojpeg);" >>$@
326 endif
327 echo "TRY(\"ppmtouil\", main_pamtouil);" >>$@
328 echo "TRY(\"ppmtotga\", main_pamtotga);" >>$@
329 echo "TRY(\"pnmtopnm\", main_pamtopnm);" >>$@
330 echo "TRY(\"pnmtofits\", main_pamtofits);" >>$@
331 ifneq ($(TIFF_PREREQ_MISSING),Y)
332 echo "TRY(\"pnmtotiff\", main_pamtotiff);" >>$@
333 endif
334 ifeq ($(HAVE_PNGLIB),Y)
335 echo "TRY(\"pngtopnm\", main_pngtopam);" >>$@
336 endif
337 echo "TRY(\"icontopbm\", main_sunicontopnm);" >>$@
338 ifeq ($(HAVE_PNGLIB),Y)
339 echo "TRY(\"pamrgbatopng\", main_pamtopng);" >>$@
340 endif