#*******************************************************************************
#
# University of Western Australia
# Department of Computer Science
# Copyright (c) University of Western Australia
#
# SYSTEM :              VIP
# RELEASE:		3
# SUBSYSTEM:            VIP
# MODULE:		Makefile
# REVISION:             3.9
# AUTHOR:               
# CREATION DATE:        
# REVISION DATE:	4/26/94        
#
#*******************************************************************************
#
# REVISION LOG
#
# REVISION:		3.9
# REVISION DATE:	26 April 1994
# COMMENT:		Fixed list of programs
# BY:			PK
#
# REVISION:		3.8
# REVISION DATE:	19 April 1994
# COMMENT:		Added more comments
# BY:			PK
#
# REVISION:		3.7
# REVISION DATE:	8 April 1994
# COMMENT:		Redid all of the programs to clean it up and
#			make sure none were missed or obselete
# BY:			BJR
#
# REVISION:		3.6
# REVISION DATE:	8 April 1994
# COMMENT:		Added homomorphic
# BY:			PK
#
# REVISION:		3.5
# REVISION DATE:	8 April 1994
# COMMENT:		Cleanup linking etc. works for Sun and Dec
# BY:			BJR
#
# REVISION:		3.4
# REVISION DATE:	8 April 1994
# COMMENT:		added warnings and environment variables for compiling
#			on all Unix platforms.
# BY:			BJR
#
# REVISION:		3.3
# REVISION DATE:	19 Nov 1992
# COMMENT:		Added new source: differ.
# BY:			CFF
#
# REVISION:		3.2
# REVISION DATE:	06 August 1992
# COMMENT:		Added new sources; vip2ppm.c, raster2vip. vip2raster,
#				    	   pm2vip, rgbppm2vip, squareroot,
#					   vip2ps.
# BY:			CFF
#
# REVISION:		3.1
# REVISION DATE:	11 July 1992
# COMMENT:		ANSIfied and SCCS'd
# BY:			CFF
#
# @(#)Makefile	3.9 4/26/94
#
#****************************************************************************/


# Section that you will need to edit for your own installation of VIP

# The main variables that you will have to set are:
# VIP_DIR
# VIP_MACHINE
# VIP_LIB_DIR
# VIP_BIN_DIR

# We set VIP_MACHINE, VIP_LIB_DIR and VIP_BIN_DIR via environment
# variables to automatically invoke the correct compilation depending on
# the type of machine one is logged into.  If you are working on just
# one architecture you may not wish to do this, nor will you need to
# have separate library or bin subdirectories.
# The definition of VFC is only relevant if you have a Videopix
# framegrabber and you wish to make the program 'snap'.

# REQUIRED ENVIRONMENT VARIABLES

# VIP_MACHINE   SUN or DEC_ALPHA or LINUX
# VIP_LIB_DIR   sunlib or declib or linuxlib
# VIP_BIN_DIR	sunbin or decbin or linuxbin

# ========== libraries and headers ==========
VIP_DIR    = /home/decadence/staff/pk/vip
BIN_DIR    = $(VIP_DIR)/bin
LIB_DIR    = $(VIP_DIR)/lib
INCLUDE    = -I$(VIP_DIR)/include  -I${OPENWINHOME}/include
VFC        = /usr/local/videopix/1.0-VFC

#  standard defines that are needed because they aren't on all machines

COMPILE.c= $(CC) $(CFLAGS) $(CPPFLAGS) -c
LINK.c= $(CC) $(CFLAGS) $(CPPFLAGS)

LIBPATH   = -L$(LIB_DIR)
# Flags and Options
CC	= gcc
fla	= -O  -D$(VIP_MACHINE)
CFLAGS  = $(INCLUDE) $(fla)
LDFLAGS = $(LIBPATH) -lvip -lm

# LINUX !!!!!
# IMPORTANT: if you are using linux then you will need to manually
# edit the makefile to get around problems with Linux's make.
# go below past where it says you wont need to edit and follow
# the instructions.


# If you are not compiling on a Sun and you were unable to
# incorporate rast.o in the vip library you will not be able
# to make the programs raster2vip and vip2raster.  

#--------- End of section that you will need to edit -------------

PROGRAMS = \
	3edge absim ap2cx byte2complex calibrate clip \
	complex2ri conj convert2byte convert2cx convert2float \
	convolve cx2ri d2gaussian deres differ eqnim expim \
	fft gaussian genimage gline gnoise highpass \
	histe histogram homomorphic ifft imageinfo imtest \
	knn lapgaussian laser localhisteq logim lowpass mag \
	negim  nlogim phase pm2vip raw2vip \
	reflect res rgbppm2vip ri2cx scale snn \
	size spy sqrim sqrtim stat sumim thresh transpose vip2ppm \
	vtest xdisplay xyscale zc pgm2vip


# ========== Building rules for Makefile ==========

all: $(PROGRAMS)

#IMPORTANT LINUX
#uncomment the next 3 lines
#$(PROGRAMS):$@
#	$(CC) $@.c -o $(BIN_DIR)/$@  $(CFLAGS) -L$(LIB_DIR) -lvip -lm
#	chmod 775 $(BIN_DIR)/$@


#IMPORTANT LINUX
#comment the next 3 lines
$(PROGRAMS):$$@.o
	$(LINK.c) -o $(BIN_DIR)/$@ $? $(LDFLAGS)
#chmod 775 $(BIN_DIR)/$@

snap: snap.c
	gcc -o $(BIN_DIR)/snap snap.c $(INCLUDE) -L$(LIB_DIR) -lvip \
	-I$(VFC)/vfc_lib -I$(VFC)/sys -L$(VFC)/vfc_lib -lvfc \
	-lxview -lolgx -lX11 -lm
	chmod 775 $(BIN_DIR)/snap
	chmod 664 snap.c

rv: rv.c
	gcc -g -o $(BIN_DIR)/rv rv.c $(INCLUDE) -L$(LIB_DIR) -lvip -lpixrect \
	-lxview -lolgx -lX11 -lm
	chmod 775 $(BIN_DIR)/rv
	chmod 664 rv.c

raster2vip: raster2vip.c
	gcc -g -o $(BIN_DIR)/raster2vip raster2vip.c $(INCLUDE) -L$(LIB_DIR) -lvip -lpixrect \
	-lxview -lolgx -lX11 -lm
	chmod 775 $(BIN_DIR)/raster2vip
	chmod 664 raster2vip.c

vip2raster: vip2raster.c
	gcc -o $(BIN_DIR)/vip2raster vip2raster.c $(INCLUDE) -L$(LIB_DIR) -lvip -lpixrect \
	-lxview -lolgx -lX11 -lm
	chmod 775 $(BIN_DIR)/vip2raster
	chmod 664 vip2raster.c

vr: vr.c
	gcc -o $(BIN_DIR)/vr vr.c $(INCLUDE) -L$(LIB_DIR) -lvip -lpixrect \
	-lxview -lolgx -lX11 -lm
	chmod 775 $(BIN_DIR)/vr
	chmod 664 vr.c

.c.o:
	$(COMPILE.c) $*.c
#chmod 664 $*.o $*.c

