# Makefile for uuencode.	-*- Indented-Text -*-
# Written by Ian Lance Taylor, ian@cygnus.com, August 1993.
# This Makefile is in the public domain.

#### Start of system configuration section. ####

VPATH = @srcdir@
srcdir = $(VPATH)

CC = @CC@

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi

DEFS = @DEFS@
LIBS = @LIBS@

CFLAGS = -O2
LDFLAGS =

prefix = /gnu
exec_prefix = $(prefix)

bindir = $(exec_prefix)/bin
infodir = $(prefix)/info
man1dir = $(prefix)/man/man1
man1ext = .1
man5dir = $(prefix)/man/man5
man5ext = .5

# Prefix to be prepended to each installed program, normally empty or `g'.
binprefix = 

#### End of system configuration section. ####

SHELL = /bin/sh

SRCS = uuencode.c uudecode.c getopt.c getopt1.c version.c alloca.c
EOBJS = uuencode.o getopt.o getopt1.o version.o @ALLOCA@
DOBJS = uudecode.o getopt.o getopt1.o version.o @ALLOCA@
HDRS = getopt.h
DISTFILES = $(SRCS) $(HDRS) ChangeLog NEWS Makefile.in \
	    README INSTALL uuencode.1 uuencode.5 \
	    configure configure.in \
	    mkinstalldirs testdata

all: uuencode uudecode
.PHONY: all

.PHONY: info dvi
info: uuencode.info
dvi: uuencode.dvi

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

.PHONY: install installdirs
install: installdirs uuencode uudecode
	$(INSTALL_PROGRAM) uuencode $(bindir)/$(binprefix)uuencode
	$(INSTALL_PROGRAM) uudecode $(bindir)/$(binprefix)uudecode
	$(INSTALL_DATA) $(srcdir)/uuencode.1 $(man1dir)/$(binprefix)uuencode$(man1ext)
	rm -f $(man1dir)/$(binprefix)uudecode$(man1ext)
	ln $(man1dir)/$(binprefix)uuencode$(man1ext) $(man1dir)/$(binprefix)uudecode$(man1ext)
	$(INSTALL_DATA) $(srcdir)/uuencode.5 $(man5dir)/$(binprefix)uuencode$(man5ext)
installdirs:
	${srcdir}/mkinstalldirs $(bindir) $(man1dir) $(man5dir)

uuencode: $(EOBJS)
	$(CC) $(LDFLAGS) -o $@ $(EOBJS) $(LIBS)

uudecode: $(DOBJS)
	$(CC) $(LDFLAGS) -o $@ $(DOBJS) $(LIBS)

uuencode.o uudecode.o getopt.o getopt1.o: getopt.h

uuencode.info:
	@#$(MAKEINFO) -I$(srcdir) -o uuencode.info $(srcdir)/uuencode.texi
	@echo No info file currently available
uudecode.dvi:
	@#$(TEXI2DVI) $(srcdir)/uuencode.texi
	@echo No DVI file currently available

.PHONY: check
check: uuencode uudecode testdata
	@echo expect no output from diff
	rm -f test.bin test.tmp
	./uudecode $(srcdir)/testdata
	./uuencode test.bin test.bin > test.tmp
	diff -c $(srcdir)/testdata test.tmp
	rm -f test.bin test.tmp

Makefile: Makefile.in config.status
	$(SHELL) config.status

config.status: configure
	$(srcdir)/configure --no-create

TAGS: $(SRCS)
	etags $(SRCS)

.PHONY: clean mostlyclean distclean realclean dist

clean:
	rm -f uuencode uudecode *.o core test.bin test.tmp
	rm -f uuencode.dvi uuencode.?? uuencode.??s

mostlyclean: clean

distclean: clean
	rm -f Makefile config.status

realclean: distclean
	rm -f TAGS uuencode.info*

dist: $(DISTFILES)
	echo uuencode-`sed -e '/version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q version.c` > .fname
	rm -rf `cat .fname`
	mkdir `cat .fname`
	ln $(DISTFILES) `cat .fname`
	tar chozf `cat .fname`.tar.gz `cat .fname`
	rm -rf `cat .fname` .fname

# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
