# Makefile for xloadimage using standard C compiler
#
# Copyright 1989, 1990 Jim Frost
#
# See file "copyright.h" for complete copyright information.

SYSPATHFILE=/usr/lib/X11/Xloadimage
INSTALLDIR=/usr/bin/X11
CC= cc
CFLAGS= -O -DSYSPATHFILE=\"$(SYSPATHFILE)\"
CP= cp
LN= ln -s
RM= rm -f
LIBS= -lX11

SRCS= bright.c clip.c compress.c dither.c faces.c fill.c g3.c gif.c \
      halftone.c imagetypes.c merge.c misc.c new.c options.c path.c \
      pbm.c reduce.c root.c send.c sunraster.c value.c window.c \
      xbitmap.c xloadimage.c xpixmap.c zio.c zoom.c 

OBJS= bright.o clip.o compress.o dither.o faces.o fill.o g3.o gif.o \
      halftone.o imagetypes.o merge.o misc.o new.o options.o path.o \
      pbm.o reduce.o root.o send.o sunraster.o value.o window.o \
      xbitmap.o xloadimage.o xpixmap.o zio.o zoom.o

xloadimage: $(OBJS)
	$(CC) $(CFLAGS) -o xloadimage $(OBJS) $(LIBS)

install: $(SYSPATHFILE)
	$(RM) $(INSTALLDIR)/xloadimage
	$(RM) $(INSTALLDIR)/xsetbg
	$(RM) $(INSTALLDIR)/xview
	$(CP) xloadimage $(INSTALLDIR)/xloadimage
	$(LN) $(INSTALLDIR)/xloadimage $(INSTALLDIR)/xsetbg
	$(LN) $(INSTALLDIR)/xloadimage $(INSTALLDIR)/xview

clean:
	rm -f *.o *~ xloadimage

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

$(SYSPATHFILE):
	@echo "*** Creating default $(SYSPATHFILE) since you"
	@echo "*** don't have one. This file is used to set up default places"
	@echo "*** and names to look for images.  You probably want to edit"
	@echo "*** it for your site.  See the xloadimage manual page for"
	@echo "*** details on the contents of this file."
	cp /dev/null $(SYSPATHFILE)
	echo "path= /usr/local/images" \
		>> $(SYSPATHFILE)
	echo "extension=.csun .msun .sun .face .xbm .bm .gif" \
		>>$(SYSPATHFILE)

# these targets are for those of us who have Saber-C

# load all objects in saber.  useful if you then swap the portions to debug
# for source.

objinsaber:
	#setopt ccargs -g -DSYSPATHFILE=\\\"$(SYSPATHFILE)\\\"
	#load $(OBJS) $(LIBS)
	#link

# load all sources in saber.  not as useful as the last one.

srcinsaber:
	#setopt load_flags -DSYSPATHFILE=\\\"$(SYSPATHFILE)\\\"
	#load $(SRCS) $(LIBS)
	#link
