
# Makefile for vimage
#
# Copyright (c) 1994, Joseph J. Traister
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

CC = gcc
CFLAGS = -Wall -O2 -m486 -fomit-frame-pointer -pipe

# If you don't have libjpeg and the header files for it, comment out the
# following definitions to turn off JPEG support. If you do have libjpeg,
# define JPEG_INC to be the directory where the JPEG include files are.
# Also, define JPEG_LIB to "-ljpeg" to include the jpeg library.
# Optionally, if the jpeg library is not in your lib search path, preface 
# this with "-L <path>" where <path> is the directory name where libjpeg
# resides
JPEG_DEF = -DJPEG_SUPPORT
JPEG_INC =
JPEG_LIB = -ljpeg

# If you don't have ncurses you can still use vimage to view pictures
# but you can't use the file selector. Comment out these three lines.
# If you do have ncurses, define NCURSES_INC to be the directory where
# the ncurses include files reside. Also, set NCURSES_LIB to be either
# just -lncurses to include the lib or preface it with -L and the directory
# where the ncurses library is located.
NCURSES_DEF = -DNCURSES_SUPPORT
NCURSES_INC = -I/usr/include/ncurses
NCURSES_LIB = -lncurses

# Directories to install binary and manpage
# Change these to install the binary or manpage in different places
BINDIR = /usr/local/bin
MANDIR = /usr/local/man/man1

### End of user defineable options ###

VER = 1.1
VERSION = \"$(VER)\"

SRCS = vimage.c video.c gif.c pbm.c sun.c targa.c jpeg.c cube.c hmcut.c \
       filesel.c scale.c tiff.c hash.c
OBJS = vimage.o video.o gif.o pbm.o sun.o targa.o jpeg.o cube.o hmcut.o \
       filesel.o scale.o tiff.o hash.o
LIBS = -lvga $(JPEG_LIB) $(NCURSES_LIB)
INCLUDES = $(NCURSES_INC) $(JPEG_INC)
DEFINES = $(JPEG_DEF) $(NCURSES_DEF) $(SVGABUG_DEF) -DVERSION=$(VERSION)
DISTRIB = $(SRCS) cube.h vimage.h tiff.h hash.h COPYING ChangeLog BUGS \
          Makefile BUGS README TODO vimage.man vimage.lsm cubegen.c

.c.o:
	$(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -c $<

all:	vimage

vimage: $(OBJS)
	rm -f vimage
	gcc -o vimage $(OBJS) $(LIBS)

clean:
	rm -f core* *.o *~ temp \#*\# *.bak vimage

backup:
	tar czf vimage-$(VER).tar.gz $(DISTRIB)
	mv vimage-$(VER).tar.gz /home/traister/incoming

install: all
	install -s -m 4755 vimage $(BINDIR)

install.man:
	cp -f vimage.man $(MANDIR)/vimage.1

