1# Makefile for Independent JPEG Group's software
2
3# makefile.cfg is edited by configure to produce a custom Makefile.
4
5# Read installation instructions before saying "make" !!
6
7# For compiling with source and object files in different directories.
8srcdir = @srcdir@
9VPATH = @srcdir@
10
11# Where to install the programs and man pages.
12prefix = @prefix@
13exec_prefix = @exec_prefix@
14bindir = $(exec_prefix)/bin
15libdir = $(exec_prefix)/lib
16includedir = $(prefix)/include
17binprefix =
18manprefix =
19manext = 1
20mandir = $(prefix)/man/man$(manext)
21
22# The name of your C compiler:
23CC= @CC@
24
25# You may need to adjust these cc options:
26CFLAGS= @CFLAGS@ @CPPFLAGS@ @INCLUDEFLAGS@
27# Generally, we recommend defining any configuration symbols in jconfig.h,
28# NOT via -D switches here.
29# However, any special defines for ansi2knr.c may be included here:
30ANSI2KNRFLAGS= @ANSI2KNRFLAGS@
31
32# Link-time cc options:
33LDFLAGS= @LDFLAGS@
34
35# To link any special libraries, add the necessary -l commands here.
36LDLIBS= @LIBS@
37
38# If using GNU libtool, LIBTOOL references it; if not, LIBTOOL is empty.
39LIBTOOL = @LIBTOOL@
40# $(O) expands to "lo" if using libtool, plain "o" if not.
41# Similarly, $(A) expands to "la" or "a".
42O = @O@
43A = @A@
44
45# Library version ID; libtool uses this for the shared library version number.
46# Note: we suggest this match the macro of the same name in jpeglib.h.
47JPEG_LIB_VERSION = @JPEG_LIB_VERSION@
48
49# Put here the object file name for the correct system-dependent memory
50# manager file.  For Unix this is usually jmemnobs.o, but you may want
51# to use jmemansi.o or jmemname.o if you have limited swap space.
52SYSDEPMEM= @MEMORYMGR@
53
54# miscellaneous OS-dependent stuff
55SHELL= /bin/sh
56# linker
57LN= @LN@
58# file deletion command
59RM= rm -f
60# directory creation command
61MKDIR= mkdir
62# library (.a) file creation command
63AR= ar rc
64# second step in .a creation (use "touch" if not needed)
65AR2= @RANLIB@
66# installation program
67INSTALL= @INSTALL@
68INSTALL_PROGRAM= @INSTALL_PROGRAM@
69INSTALL_LIB= @INSTALL_LIB@
70INSTALL_DATA= @INSTALL_DATA@
71
72# End of configurable options.
73
74
75# source files: JPEG library proper
76LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
77        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
78        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
79        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
80        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
81        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
82        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
83        jquant2.c jutils.c jmemmgr.c
84# memmgr back ends: compile only one of these into a working library
85SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
86# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
87APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
88        rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
89        rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
90SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
91# files included by source files
92INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
93        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
94# documentation, test, and support files
95DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
96        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \
97        coderules.doc filelist.doc change.log
98MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \
99        makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \
100        makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \
101        maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \
102        makvms.opt
103CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
104        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
105        jconfig.vms
106CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
107OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
108TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
109        testimgp.jpg
110DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
111        $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
112# library object files common to compression and decompression
113COMOBJECTS= jcomapi.$(O) jutils.$(O) jerror.$(O) jmemmgr.$(O) $(SYSDEPMEM)
114# compression library object files
115CLIBOBJECTS= jcapimin.$(O) jcapistd.$(O) jctrans.$(O) jcparam.$(O) \
116        jdatadst.$(O) jcinit.$(O) jcmaster.$(O) jcmarker.$(O) jcmainct.$(O) \
117        jcprepct.$(O) jccoefct.$(O) jccolor.$(O) jcsample.$(O) jchuff.$(O) \
118        jcphuff.$(O) jcdctmgr.$(O) jfdctfst.$(O) jfdctflt.$(O) \
119        jfdctint.$(O)
120# decompression library object files
121DLIBOBJECTS= jdapimin.$(O) jdapistd.$(O) jdtrans.$(O) jdatasrc.$(O) \
122        jdmaster.$(O) jdinput.$(O) jdmarker.$(O) jdhuff.$(O) jdphuff.$(O) \
123        jdmainct.$(O) jdcoefct.$(O) jdpostct.$(O) jddctmgr.$(O) \
124        jidctfst.$(O) jidctflt.$(O) jidctint.$(O) jidctred.$(O) \
125        jdsample.$(O) jdcolor.$(O) jquant1.$(O) jquant2.$(O) jdmerge.$(O)
126# These objectfiles are included in libjpeg.a
127LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
128# object files for sample applications (excluding library files)
129COBJECTS= cjpeg.$(O) rdppm.$(O) rdgif.$(O) rdtarga.$(O) rdrle.$(O) \
130        rdbmp.$(O) rdswitch.$(O) cdjpeg.$(O)
131DOBJECTS= djpeg.$(O) wrppm.$(O) wrgif.$(O) wrtarga.$(O) wrrle.$(O) \
132        wrbmp.$(O) rdcolmap.$(O) cdjpeg.$(O)
133TROBJECTS= jpegtran.$(O) rdswitch.$(O) cdjpeg.$(O) transupp.$(O)
134
135
136all: @A2K_DEPS@ libjpeg.$(A) cjpeg djpeg jpegtran rdjpgcom wrjpgcom
137
138# Special compilation rules to support ansi2knr and libtool.
139.SUFFIXES: .lo .la
140
141# How to compile with libtool.
142@COM_LT@.c.lo:
143@COM_LT@	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$*.c
144
145# How to use ansi2knr, when not using libtool.
146@COM_A2K@.c.o:
147@COM_A2K@	./ansi2knr $(srcdir)/$*.c knr/$*.c
148@COM_A2K@	$(CC) $(CFLAGS) -c knr/$*.c
149@COM_A2K@	$(RM) knr/$*.c
150
151# How to use ansi2knr AND libtool.
152@COM_A2K@.c.lo:
153@COM_A2K@	./ansi2knr $(srcdir)/$*.c knr/$*.c
154@COM_A2K@	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c knr/$*.c
155@COM_A2K@	$(RM) knr/$*.c
156
157ansi2knr: ansi2knr.c
158	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr $(srcdir)/ansi2knr.c
159	$(MKDIR) knr
160
161# the library:
162
163# without libtool:
164libjpeg.a: @A2K_DEPS@ $(LIBOBJECTS)
165	$(RM) libjpeg.a
166	$(AR) libjpeg.a  $(LIBOBJECTS)
167	$(AR2) libjpeg.a
168
169# with libtool:
170libjpeg.la: @A2K_DEPS@ $(LIBOBJECTS)
171	$(LIBTOOL) --mode=link $(CC) -o libjpeg.la $(LIBOBJECTS) \
172		-rpath $(libdir) -version-info $(JPEG_LIB_VERSION)
173
174# sample programs:
175
176cjpeg: $(COBJECTS) libjpeg.$(A)
177	$(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) libjpeg.$(A) $(LDLIBS)
178
179djpeg: $(DOBJECTS) libjpeg.$(A)
180	$(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) libjpeg.$(A) $(LDLIBS)
181
182jpegtran: $(TROBJECTS) libjpeg.$(A)
183	$(LN) $(LDFLAGS) -o jpegtran $(TROBJECTS) libjpeg.$(A) $(LDLIBS)
184
185rdjpgcom: rdjpgcom.$(O)
186	$(LN) $(LDFLAGS) -o rdjpgcom rdjpgcom.$(O) $(LDLIBS)
187
188wrjpgcom: wrjpgcom.$(O)
189	$(LN) $(LDFLAGS) -o wrjpgcom wrjpgcom.$(O) $(LDLIBS)
190
191# Installation rules:
192
193install: cjpeg djpeg jpegtran rdjpgcom wrjpgcom @FORCE_INSTALL_LIB@
194	$(INSTALL_PROGRAM) cjpeg $(bindir)/$(binprefix)cjpeg
195	$(INSTALL_PROGRAM) djpeg $(bindir)/$(binprefix)djpeg
196	$(INSTALL_PROGRAM) jpegtran $(bindir)/$(binprefix)jpegtran
197	$(INSTALL_PROGRAM) rdjpgcom $(bindir)/$(binprefix)rdjpgcom
198	$(INSTALL_PROGRAM) wrjpgcom $(bindir)/$(binprefix)wrjpgcom
199	$(INSTALL_DATA) $(srcdir)/cjpeg.1 $(mandir)/$(manprefix)cjpeg.$(manext)
200	$(INSTALL_DATA) $(srcdir)/djpeg.1 $(mandir)/$(manprefix)djpeg.$(manext)
201	$(INSTALL_DATA) $(srcdir)/jpegtran.1 $(mandir)/$(manprefix)jpegtran.$(manext)
202	$(INSTALL_DATA) $(srcdir)/rdjpgcom.1 $(mandir)/$(manprefix)rdjpgcom.$(manext)
203	$(INSTALL_DATA) $(srcdir)/wrjpgcom.1 $(mandir)/$(manprefix)wrjpgcom.$(manext)
204
205install-lib: libjpeg.$(A) install-headers
206	$(INSTALL_LIB) libjpeg.$(A) $(libdir)/$(binprefix)libjpeg.$(A)
207
208install-headers: jconfig.h
209	$(INSTALL_DATA) jconfig.h $(includedir)/jconfig.h
210	$(INSTALL_DATA) $(srcdir)/jpeglib.h $(includedir)/jpeglib.h
211	$(INSTALL_DATA) $(srcdir)/jmorecfg.h $(includedir)/jmorecfg.h
212	$(INSTALL_DATA) $(srcdir)/jerror.h $(includedir)/jerror.h
213
214clean:
215	$(RM) *.o *.lo libjpeg.a libjpeg.la
216	$(RM) cjpeg djpeg jpegtran rdjpgcom wrjpgcom
217	$(RM) ansi2knr core testout* config.log config.status
218	$(RM) -r knr .libs _libs
219
220distclean: clean
221	$(RM) Makefile jconfig.h libtool config.cache
222
223test: cjpeg djpeg jpegtran
224	$(RM) testout*
225	./djpeg -dct int -ppm -outfile testout.ppm  $(srcdir)/testorig.jpg
226	./djpeg -dct int -bmp -colors 256 -outfile testout.bmp  $(srcdir)/testorig.jpg
227	./cjpeg -dct int -outfile testout.jpg  $(srcdir)/testimg.ppm
228	./djpeg -dct int -ppm -outfile testoutp.ppm $(srcdir)/testprog.jpg
229	./cjpeg -dct int -progressive -opt -outfile testoutp.jpg $(srcdir)/testimg.ppm
230	./jpegtran -outfile testoutt.jpg $(srcdir)/testprog.jpg
231	cmp $(srcdir)/testimg.ppm testout.ppm
232	cmp $(srcdir)/testimg.bmp testout.bmp
233	cmp $(srcdir)/testimg.jpg testout.jpg
234	cmp $(srcdir)/testimg.ppm testoutp.ppm
235	cmp $(srcdir)/testimgp.jpg testoutp.jpg
236	cmp $(srcdir)/testorig.jpg testoutt.jpg
237
238check: test
239
240# Mistake catcher:
241
242jconfig.h: jconfig.doc
243	echo You must prepare a system-dependent jconfig.h file.
244	echo Please read the installation directions in install.doc.
245	exit 1
246
247# GNU Make likes to know which target names are not really files to be made:
248.PHONY: all install install-lib install-headers clean distclean test check
249
250
251jcapimin.$(O): jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
252jcapistd.$(O): jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
253jccoefct.$(O): jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
254jccolor.$(O): jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
255jcdctmgr.$(O): jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
256jchuff.$(O): jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
257jcinit.$(O): jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
258jcmainct.$(O): jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
259jcmarker.$(O): jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
260jcmaster.$(O): jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
261jcomapi.$(O): jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
262jcparam.$(O): jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
263jcphuff.$(O): jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
264jcprepct.$(O): jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
265jcsample.$(O): jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
266jctrans.$(O): jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
267jdapimin.$(O): jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
268jdapistd.$(O): jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
269jdatadst.$(O): jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
270jdatasrc.$(O): jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
271jdcoefct.$(O): jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
272jdcolor.$(O): jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
273jddctmgr.$(O): jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
274jdhuff.$(O): jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
275jdinput.$(O): jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
276jdmainct.$(O): jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
277jdmarker.$(O): jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
278jdmaster.$(O): jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
279jdmerge.$(O): jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
280jdphuff.$(O): jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
281jdpostct.$(O): jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
282jdsample.$(O): jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
283jdtrans.$(O): jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
284jerror.$(O): jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
285jfdctflt.$(O): jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
286jfdctfst.$(O): jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
287jfdctint.$(O): jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
288jidctflt.$(O): jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
289jidctfst.$(O): jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
290jidctint.$(O): jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
291jidctred.$(O): jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
292jquant1.$(O): jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
293jquant2.$(O): jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
294jutils.$(O): jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
295jmemmgr.$(O): jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
296jmemansi.$(O): jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
297jmemname.$(O): jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
298jmemnobs.$(O): jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
299jmemdos.$(O): jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
300jmemmac.$(O): jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
301cjpeg.$(O): cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
302djpeg.$(O): djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
303jpegtran.$(O): jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
304rdjpgcom.$(O): rdjpgcom.c jinclude.h jconfig.h
305wrjpgcom.$(O): wrjpgcom.c jinclude.h jconfig.h
306cdjpeg.$(O): cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
307rdcolmap.$(O): rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
308rdswitch.$(O): rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
309transupp.$(O): transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
310rdppm.$(O): rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
311wrppm.$(O): wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
312rdgif.$(O): rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
313wrgif.$(O): wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
314rdtarga.$(O): rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
315wrtarga.$(O): wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
316rdbmp.$(O): rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
317wrbmp.$(O): wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
318rdrle.$(O): rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
319wrrle.$(O): wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
320