#
# Makefile for write_jpeg AVS module.
#					last edit: johnl Oct-91
#
# This is a combination of the Makefile written by mod_gen and parts of:
# Makefile for portable JPEG code        last edit: tgl  11-Aug-91
#
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# New files added for use with AVS are:
#	write_jpeg.c
#	write_jpeg.txt
#	makefile.avs
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Standard AVS stuff written by mod_gen.
#
INC_FILE=$(ROOT)/usr/avs/include/Makeinclude
include $(INC_FILE)

AVS_LIBS = $(ROOT)/usr/avs/lib
INC = $(ROOT)/usr/include
BASELIBS=-lgeom -lutil -lm $(LASTLIBS)
CFLAGS = -I$(INC) $(AOPTCFLAGS) $(LOCAL_CFLAGS) $(G)
CFLOWLIBS=-L$(AVS_LIBS) -lflow_c $(BASELIBS)
CSIMLIBS=-L$(AVS_LIBS) -lsim_c $(BASELIBS)

# compression objectfiles
COBJECTS = write_jpeg.o jcdeflts.o jwrjfif.o \
	   jcarith.o jccolor.o jcexpand.o jchuff.o jcmaster.o jcmcu.o \
	   jcpipe.o jcsample.o jfwddct.o jutils.o jvirtmem.o

all: ansi2knr write_jpeg

ansi2knr: ansi2knr.c
	$(CC) -o ansi2knr ansi2knr.c

# If you have a C compiler that doesn't understand function prototypes,
# uncomment the 5 lines below and make sure PROTO is not defined by jconfig.h.

.c.o:
	./ansi2knr $*.c tmpansi.c
	$(CC) $(CFLAGS) -c tmpansi.c
	mv tmpansi.o $*.o
	$(RM) tmpansi.c

# For an ANSI C compiler, uncomment 2 lines below.

#.c.o:
#	$(CC) $(CFLAGS) -c $*.c


write_jpeg:	$(COBJECTS)
	$(CC) $(CFLAGS) -o write_jpeg $(COBJECTS) $(CFLOWLIBS)



# miscellaneous OS-dependent stuff
RM= rm -f

clean:
	$(RM) *.o write_jpeg ansi2knr core tmpansi.* testout.ppm testout.jpg


# source files
INCLUDES= jinclude.h jconfig.h jpegdata.h 
SOURCES= write_jpeg.c \
	 jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c \
	 jchuff.c jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c \
	 jdarith.c jdcolor.c jdhuff.c jdmain.c jdmaster.c jdmcu.c \
	 jdpipe.c jdsample.c jerror.c jfwddct.c jquant1.c jquant2.c \
	 jrdjfif.c jrdppm.c jrevdct.c jutils.c jvirtmem.c jwrjfif.c jwrppm.c \
	 egetopt.c
DOCS= README write_jpeg.txt architecture codingrules
MAKEFILES= makefile.avs \
	   makefile.unix makefile.mc5 makefile.mc6 cjpeg.lnk djpeg.lnk \
	   makefile.pwc cobjects.cf dobjects.cf
TESTFILES= testorig.jpg testimg.ppm testimg.jpg
DISTFILES= $(DOCS) $(MAKEFILES) ansi2knr.c $(SOURCES) $(INCLUDES) $(TESTFILES)

distribute:
	$(RM) jpegdist.tar*
	tar cvf jpegdist.tar $(DISTFILES)
	ls -l jpegdist.tar
	compress -v jpegdist.tar
	ls -l jpegdist.tar*


jbsmooth.o : jbsmooth.c jinclude.h jconfig.h jpegdata.h 
jcarith.o : jcarith.c jinclude.h jconfig.h jpegdata.h 
jccolor.o : jccolor.c jinclude.h jconfig.h jpegdata.h 
jcdeflts.o : jcdeflts.c jinclude.h jconfig.h jpegdata.h 
jcexpand.o : jcexpand.c jinclude.h jconfig.h jpegdata.h 
jchuff.o : jchuff.c jinclude.h jconfig.h jpegdata.h 
jcmain.o : jcmain.c jinclude.h jconfig.h jpegdata.h egetopt.c 
jcmaster.o : jcmaster.c jinclude.h jconfig.h jpegdata.h 
jcmcu.o : jcmcu.c jinclude.h jconfig.h jpegdata.h 
jcpipe.o : jcpipe.c jinclude.h jconfig.h jpegdata.h 
jcsample.o : jcsample.c jinclude.h jconfig.h jpegdata.h 
jdarith.o : jdarith.c jinclude.h jconfig.h jpegdata.h 
jdcolor.o : jdcolor.c jinclude.h jconfig.h jpegdata.h 
jdhuff.o : jdhuff.c jinclude.h jconfig.h jpegdata.h 
jdmain.o : jdmain.c jinclude.h jconfig.h jpegdata.h egetopt.c
jdmaster.o : jdmaster.c jinclude.h jconfig.h jpegdata.h 
jdmcu.o : jdmcu.c jinclude.h jconfig.h jpegdata.h 
jdpipe.o : jdpipe.c jinclude.h jconfig.h jpegdata.h 
jdsample.o : jdsample.c jinclude.h jconfig.h jpegdata.h 
jerror.o : jerror.c jinclude.h jconfig.h jpegdata.h 
jfwddct.o : jfwddct.c jinclude.h jconfig.h jpegdata.h 
jquant1.o : jquant1.c jinclude.h jconfig.h jpegdata.h 
jquant2.o : jquant2.c jinclude.h jconfig.h jpegdata.h 
jrdjfif.o : jrdjfif.c jinclude.h jconfig.h jpegdata.h 
jrdppm.o : jrdppm.c jinclude.h jconfig.h jpegdata.h 
jrevdct.o : jrevdct.c jinclude.h jconfig.h jpegdata.h 
jutils.o : jutils.c jinclude.h jconfig.h jpegdata.h 
jvirtmem.o : jvirtmem.c jinclude.h jconfig.h jpegdata.h 
jwrjfif.o : jwrjfif.c jinclude.h jconfig.h jpegdata.h 
jwrppm.o : jwrppm.c jinclude.h jconfig.h jpegdata.h 
write_jpeg.o : write_jpeg.c jinclude.h