CC = @CC@
DEFS = @DEFS@ -DSYSPATHFILE=\"/etc/X11/Xloadimage\"
CPPFLAGS = @CPPFLAGS@
CPPFLAGS += ${DEFS}
CFLAGS = @CFLAGS@
XLIB = @X_LIBS@ -lX11 @X_EXTRA_LIBS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@

SRCS = bright.c clip.c cmuwmraster.c compress.c config.c \
dither.c faces.c fbm.c fill.c gif.c halftone.c imagetypes.c img.c jpeg.c \
mac.c mc_tables.c mcidas.c merge.c misc.c new.c niff.c options.c \
pbm.c pcx.c pdsuncomp.c reduce.c rle.c rlelib.c root.c rotate.c \
send.c smooth.c sunraster.c tiff.c undither.c value.c vff.c \
vicar.c window.c xbitmap.c xloadimage.c xpixmap.c xwd.c zio.c zoom.c png.c

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

all: $(PROG) uufilter

$(PROG): $(OBJS)
	./build-info
	$(CC) $(CFLAGS) ${CPPFLAGS} -c build.c
	$(CC) ${CFLAGS} ${LDFLAGS} -o $@ $(OBJS) build.o $(XLIB) $(LIBS)

uufilter: uufilter.c
	$(CC) $(CFLAGS) ${CPPFLAGS} ${LDFLAGS} uufilter.c -o $@

${OBJS}: config.h image.h

.c.o:
	$(CC) $(CFLAGS) ${CPPFLAGS} -c $<

build.c:
	./build-info

clean:
	rm -f autoconfig build.c err
#	cd jpeg ; make clean
#	cd tiff ; make clean
	rm -f *.o *~ xloadimage uufilter autoconfig libconfig packtar \
	  buildshar doshar shar.* *.tar *.tar.Z *.tc

distclean:
	make clean
	rm -f config.log config.cache config.status config.h Makefile

config.h.in: configure.ac
	autoheader

configure: configure.ac
	autoconf

Makefile: Makefile.in
	./configure
