# Makefile for xa -- DCR 96-03-10 #
# =============================== #

# Choice of C compiler (GNU C is recommended)...

CC = gcc

# Use the following macro for basic optimization...

CCOPT = -O2

# Use this instead for debugging with gcc...

#CCOPT = -g -Wall

# Use -Wl,-s to strip the executable (makes it smaller)...
# Use -static for static linking (instead of shared or dynamic linking)...

LDFLAGS = -Wl,-s#-static

# Destination for executable if installing...

BIN_DEST = /usr/local/bin

# Destination for man pages if installing...

MAN_DEST = /usr/local/man

# Section and extension to use for man pages...

MAN_SECT = n

# Location of XView header files...

XVIEW_INC = /laburnum/richards/XView/include
#XVIEW_INC = /usr/local/include
#XVIEW_INC = $(OPENWINHOME)/include # Typically OPENWINHOME=/usr/openwin

# Location of XView libraries...

XVIEW_LIB = /laburnum/richards/XView/lib
#XVIEW_LIB = /usr/local/lib
#XVIEW_LIB = $(OPENWINHOME)/lib

# Dummy target to get things going (leave this alone!)...

start: all

# Comment out the following to disable JPEG support...

JPEG     = -DJPEG
JPEG_DIR = ./jpeg
JPEG_INC = -I$(JPEG_DIR)
JPEG_LIB = $(JPEG_DIR)/libjpeg.a
$(JPEG_DIR)/jconfig.h:
	cd $(JPEG_DIR); ./configure CC='$(CC)' CFLAGS='$(CCOPT)'
$(JPEG_LIB): $(JPEG_DIR)/jconfig.h
	cd $(JPEG_DIR); $(MAKE)

# Comment out the following to disable MPEG support...

MPEG     = -DMPEG
MPEG_DIR = ./mpeg
MPEG_INC = -I$(MPEG_DIR)
MPEG_LIB = $(MPEG_DIR)/libmpeg.a
$(MPEG_LIB):
	cd $(MPEG_DIR); $(MAKE) CC='$(CC)' HOWCOMP='$(CCOPT)'

# Useful if debugging and the dmalloc library is available...
# (dmalloc is available from ftp://ftp.letters.com/src/dmalloc/)

#DMALLOC_DIR = /laburnum/richards/DMalloc
#DMALLOC_INC = -I$(DMALLOC_DIR)/include
#DMALLOC_LIB = $(DMALLOC_DIR)/lib/libdmalloc.a

# Uncomment the appropriate architecture-specific macro...

ARCH = -DALPHA
#ARCH = -DSGI
#ARCH = -DSOLARIS
#ARCH = -DSUN

##### DO NOT CHANGE ANYTHING BELOW THIS LINE #####

SHELL = /bin/sh

# Compiler flags for header file info...

INCS = $(JPEG_INC) $(MPEG_INC) -I$(XVIEW_INC) $(DMALLOC_INC)

# Compiler flags for library info...

LIBS = -L$(XVIEW_LIB) -lxview -lolgx $(JPEG_LIB) $(MPEG_LIB) -lX11 -lm\
	$(DMALLOC_LIB)

# Name of target(s) to build...

TARGET = xa

# List of sources...

SRCS =\
	baseframe.c\
	canvas.c\
	color.c\
	gif.c\
	loadimages.c\
	mainpanel.c\
	params.c\
	quant.c\
	subpanel.c\
	xa.c

# List of objects...

OBJS = $(SRCS:.c=.o)

# Lint stuff (unsupported)...

LINTFILES = $(SRCS:.c=.ln)
LINTFLAGS =

# Compilation directives...

CFLAGS = $(CCOPT) $(JPEG) $(MPEG) $(ARCH) $(INCS)

all: $(JPEG_LIB) $(MPEG_LIB) $(TARGET)

$(TARGET): Makefile $(OBJS)
	$(CC) $(CCOPT) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

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

install:
	-rm -f $(BIN_DEST)/$(TARGET)
	-cp $(TARGET) $(BIN_DEST)

install.man:
	-rm -f $(MAN_DEST)/man$(MAN_SECT)/$(TARGET).$(MAN_SECT)
	-cp $(TARGET).man $(MAN_DEST)/man$(MAN_SECT)/$(TARGET).$(MAN_SECT)

.c.ln:
	 lint -i $(LINTFLAGS) $(INCS) $*.c

lint: $(LINTFILES)
	lint $(LINTFLAGS) $(LINTFILES) $(LIBS)

depend:
	makedepend $(INCS) $(SRCS)

cflow:
	cflow $(INCS) $(SRCS) | expand -3 > cflow.out

clean:
	-rm -f .*% .*~ *% *~
	-rm -f $(TARGET) $(OBJS) $(LINTFILES) $(TARGET).lint cflow.out
	-cd $(JPEG_DIR); make clean
	-rm $(JPEG_DIR)/jconfig.h
	-cd $(MPEG_DIR); make clean

# Miscellaneous dependencies...

$(OBJS): xa.h config.h
xa.h: COPYRIGHT.h version.h
baseframe.o: bitmaps/base_icon.xbm
canvas.o: bitmaps/canvas_icon.xbm bitmaps/cursor.xbm bitmaps/cursor_mask.xbm
canvas.o: bitmaps/backdrops.xbm
loadimages.o: rasterfile.h $(JPEG_LIB) $(MPEG_LIB)
mainpanel.o: bitmaps/fwd.xbm bitmaps/rev.xbm bitmaps/cycle.xbm
mainpanel.o: bitmaps/loopback.xbm bitmaps/oneway.xbm
subpanel.o: bitmaps/lock.xbm

# $Id: Makefile,v 1.13 1996/05/04 19:55:39 richards Exp $

# End Makefile #
