# Makefile for the xuseless programme, a cut-down version of xless
#
#   Based Upon: Xmore for X11R2 by Chris Peterson - MIT Project Athena.
#   Written By: Carlo Lisa - MIT Project Athena.
#   Revised By: Dave Glowacki - UCB Software Warehouse
#
#   Copyright 1989 Massachusetts Institute of Technology
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising
# or publicity pertaining to distribution of the software without specific,
# written prior permission.  M.I.T. makes no representations about the
# suitability of this software for any purpose.  It is provided "as is"
# without express or implied warranty.
#
# M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

AR       = ar r
CC       = gcc
CPP      = g++
RANLIB   = ranlib
CFLAGS   = -Wall -pipe -O2
RM       = rm -f
STRIP    = strip

DEPFILE  = Dependancies
HEADERS  = xless.h
SOURCES  = actions.c functions.c init.c popup.c widgdump.c callbacks.c  \
	   help.c main.c util.c window.c
OBJS     = actions.o functions.o init.o popup.o widgdump.o callbacks.o  \
	   help.o main.o util.o window.o
OTHERS   = *.ad *.icon Makefile
LIBS	 = -lXaw -lXmu -lXt -lX11

ALL      = xuseless

.c.o:	
	$(CC) $(CFLAGS) $(EXTRA) -c $< 

all:	$(ALL) 

xuseless:	$(DEPFILE) $(OBJS) 
	$(RM) $@ 
	$(CC) -o $@ $(OBJS) $(LIBS) 
	$(STRIP) $@ 

pedantic:
	make $(ALL) EXTRA=-pedantic

debug:	
	make $(ALL) EXTRA=-ggdb

rcs:
	set -e; for i in $(HEADERS) $(SOURCES) Makefile; do if [ $$i -nt RCS/$$i,v ] ; then (ci -l$(REV) $$i) ; fi; done

backup:
	lha c /tmp/backup $(HEADERS) $(SOURCES) $(OTHERS) 
	if [ -f /tmp/backup.lzh ]; then mcopy -nvm /tmp/backup.lzh a:xuseless.lzh ; fi
	if [ -f /tmp/backup ]; then mcopy -nvm /tmp/backup a:xuseless.lzh ; fi
	rm -f /tmp/backup.lzh /tmp/backup

clean:
	rm -f $(OBJS) xuseless

dep:	FORCE
	$(RM) $(DEPFILE) 	
	make $(DEPFILE)

FORCE:


$(DEPFILE):
	set -e; for i in $(SOURCES) ; do $(CC) -M $$i >>$(DEPFILE) ; done
	
#
# include a dependency file if one exists
#
#ifeq ($(DEPFILE),$(wildcard $(DEPFILE)))
include $(DEPFILE)
#endif
