# Makefile for DUPLINK, link duplicatie files in a directory tree.
# Copyright (C) 1993 Michael L.H. Brouwer.
# 
# This file is part of DUPLINK.
# 
# DUPLINK is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# 
# DUPLINK is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with DUPLINK; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#
# $Modified: Thu Mar 25 21:41:57 1993 by michael $
# $Id: Makefile.in,v 1.13 1993/04/04 22:45:49 michael Exp $

SHELL = /bin/sh

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

srcdir = @srcdir@
VPATH = $(srcdir)

CC = @CC@

CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@

# Define these for your system as follows:
#	-DHAVE_MMAP		If you have the mmap system call.
#	-DHAVE_MUNMAP		If you have the munmap system call.
#	-DHAVE_MAP_FD		If you have the map_fd system call.
#	-DHAVE_VM_DEALLOCATE	If you have to vm_deallocate system call.
DEFS = @DEFS@

# If you are using the GNU C library, or have the GNU getopt functions in
# your C library, you can comment these out.
GETOPT = getopt.o getopt1.o
GETOPT_HDR = $(srcdir)/getopt.h
GETOPT_SRC = $(srcdir)/getopt.c $(srcdir)/getopt1.c

# If your system doesn't have alloca, or the one provided is bad, define this.
ALLOCA = @ALLOCA@
ALLOCA_SRC = $(srcdir)/alloca.c

# If your system needs extra libraries loaded in, define them here.
# System V probably need -lPW for alloca.  HP-UX 7.0's alloca in
# libPW.a is broken on HP9000s300 and HP9000s400 machines.  Use
# alloca.c instead on those machines.
LOADLIBES = @LIBS@

# This library is only on machines running NeXTSTEP 3.0 or higher, and is
# needed for compressHelp.
IXLIBS = -lIndexing_s

# Any extra object files your system needs.
extras = @LIBOBJS@

# Common prefix for machine-independent installed files.
prefix = /usr/local
# Common prefix for machine-dependent installed files.
exec_prefix = $(prefix)

# Where to install the executable.
bindir = $(exec_prefix)/bin
# Directory to install info files.
infodir = $(exec_prefix)/info
# Directory to install the man pages in.
mandir = $(prefix)/man/man$(manext)
# Number to put on the man page filename.
manext = 1

# Program to install executables.
INSTALL_PROGRAM = @INSTALL_PROGRAM@
# Program to install the info files.
INSTALL_DATA = @INSTALL_DATA@
# Generic install program.
INSTALL = @INSTALL@

# Program to format Texinfo source into Info files.
MAKEINFO = makeinfo
# Program to format Texinfo source into DVI files.
TEXI2DVI = texi2dvi
# Program to make a PS file from a DVI file.
DVIPS = dvips

# Programs to make tags files.
ETAGS = etags -tw
CTAGS = ctags -tw

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

HDRS = $(srcdir)/dirtree.h $(srcdir)/global.h $(srcdir)/mapfile.h $(GETOPT_HDR)
OBJS = dirtree.o global.o mapfile.o $(GETOPT) $(ALLOCA) $(extras)
SRCS = $(srcdir)/duplink.c $(srcdir)/dirtree.c $(srcdir/)global.c	\
	$(srcdir)/mapfile.c $(GETOPT_SRC)
DISTFILES = COPYING COPYING.LIB ChangeLog README README-compressHelp	\
	INSTALL	TODO NEWS Makefile.in configure configure.in		\
	duplink.texi gpl.texinfo duplink.info compressHelp.m		\
	config.h.in compressHelp.man duplink.man $(SRCS) $(HDRS)

all:	@PROGS@
check: # No tests.
info: duplink.info
dvi: duplink.dvi

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

compressHelp: compressHelp.o $(OBJS)
	$(CC) -o $@ $(LDFLAGS) compressHelp.o $(OBJS) $(LIBS) $(IXLIBS)

duplink: duplink.o $(OBJS)
	$(CC) -o $@ $(LDFLAGS) duplink.o $(OBJS) $(LIBS)

duplink.info: duplink.texi
	$(MAKEINFO) $(srcdir)/duplink.texi

duplink.dvi: duplink.texi
	$(TEXI2DVI) $(srcdir)/duplink.texi

duplink.ps: duplink.dvi
	$(DVIPS) -o duplink.ps duplink.dvi

install: install-prog install-info install-man

install-prog: all
	@(for prog in @PROGS@; \
	    do \
	      echo $(INSTALL_PROGRAM) $$prog $(bindir)/$$prog; \
	      $(INSTALL_PROGRAM) $$prog $(bindir)/$$prog; \
	    done)

install-info: duplink.info
	$(INSTALL_DATA) $(srcdir)/duplink.info $(infodir)/duplink.info

install-man:
	@(for prog in @PROGS@; \
	    do \
	      echo $(INSTALL_DATA) $(srcdir)/$$prog.man \
				   $(mandir)/$$prog.$(manext); \
	      $(INSTALL_DATA) $(srcdir)/$$prog.man \
			      $(mandir)/$$prog.$(manext); \
	    done)

TAGS: $(SRCS)
	$(ETAGS) $(SRCS)

tags: $(SRCS)
	$(CTAGS) $(SRCS)

clean:
	-rm -f duplink compressHelp *.o core

mostlyclean: clean

distclean: clean
	-rm -f Makefile config.h config.status duplink.dvi
	-rm -f duplink.?? duplink.??s duplink.log duplink.toc duplink.*aux

realclean: distclean
	-rm -f tags TAGS duplink.info

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

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

config.h: config.status $(srcdir)/config.h.in
	$(SHELL) config.status

configure: configure.in
	autoconf

config.h.in: configure.in
	autoheader

# Automatically generated dependencies will be put at the end of the file.

# Automatically generated dependencies.
compressHelp.o: dirtree.h getopt.h global.h mapfile.h
dirtree.o: dirtree.h global.h mapfile.h
duplink.o: dirtree.h getopt.h global.h
getopt.o getopt1.o: getopt.h
global.o: global.h
mapfile.o: mapfile.h
