<<<<<<<
# $Id$
APPL=binkd

CC=@CC@
AWK=@AWK@
INSTALL=@INSTALL@

# prepend prefix to installed program names
prefix=@prefix@
CONFDIR=@sysconfdir@
MANDIR=@mandir@
DATADIR=@datarootdir@

SRCS=md5b.c binkd.c readcfg.c tools.c ftnaddr.c ftnq.c client.c server.c protocol.c bsy.c inbound.c breaksig.c branch.c unix/rename.c unix/getfree.c ftndom.c ftnnode.c srif.c pmatch.c readflo.c prothlp.c iptools.c rfc2553.c run.c binlog.c exitproc.c getw.c xalloc.c crypt.c unix/setpttl.c unix/daemonize.c @OPT_SRC@
OBJS=${SRCS:.c=.o}
AUTODEFS=@DEFS@
AUTOLIBS=@LIBS@
DEFINES=$(AUTODEFS) -DHAVE_FORK -DUNIX -DOS="\"UNIX\""
CFLAGS=$(DEFINES) @CFLAGS@
LIBS=$(AUTOLIBS)

all: compile banner

compile: $(APPL)

$(APPL): $(OBJS)
	@echo Linking $(APPL)...
	@$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

banner:
	@echo
	@echo
	@echo " Binkd is successfully compiled.                             "
	@echo
	@echo " If you want to install Binkd files into $(DESTDIR)$(prefix) "
	@echo "     1. Run \`make -n install' to be sure this makefile will "
	@echo "        do not something criminal during the installation;   "
	@echo "     2. \`su' to root;                                       "
	@echo "     3. Run \`make install' to install Binkd.                "
	@echo "     4. Edit $(CONFDIR)/$(APPL).conf-dist and RENAME it or"
	@echo "        MOVE it somewhere (so another \`make install' will   "
	@echo "        not overwrite it during your next Binkd upgrade)     "
	@echo
	@echo " If you want to put the files into some other directory just "
	@echo " run \`configure --prefix=/another/path' and go to step 1.   "
	@echo

.version: $(APPL)
	@./$(APPL) -v | $(AWK) '{ print $$2; }' > $@

install: compile .version
	./mkinstalldirs $(DESTDIR)$(prefix)/sbin
	$(INSTALL) $(APPL) $(DESTDIR)$(prefix)/sbin/$(APPL)-`cat .version`
	rm -f $(DESTDIR)$(prefix)/sbin/$(APPL)
	(VER=`cat .version` ; cd $(DESTDIR)$(prefix)/sbin ; ln -s $(APPL)-$$VER $(APPL) )
	./mkinstalldirs $(DESTDIR)$(MANDIR)/man8
	$(INSTALL) -m 644 $(APPL).8 $(DESTDIR)$(MANDIR)/man8/$(APPL).8
	./mkinstalldirs $(DESTDIR)$(CONFDIR)
	$(INSTALL) -m 644 $(APPL).conf $(DESTDIR)$(CONFDIR)/$(APPL).conf-dist

clean:
	rm -f *.[bo] unix/*.[bo] ntlm/*.[bo] *.BAK *.core *.obj *.err
	rm -f *~ core config.cache config.log config.status

cleanall: clean
	rm -f $(APPL) Makefile Makefile.dep Makefile.in
	rm -f configure configure.in .version install-sh mkinstalldirs

# targets for compatibility
mostlyclean: clean
distclean: cleanall
realclean: cleanall

.c.o:
	@echo Compiling $*.c...
	@$(CC) -c $(CFLAGS) -o $*.o $*.c

binkd.txt: binkd.8
	@groff -Tascii -mman binkd.8 | perl -npe 's/.\010//g' >binkd.txt

depend Makefile.dep:   Makefile
	@echo Making depends...
	@$(CC) -MM $(CFLAGS) $(SRCS) $(SYS) | \
	      $(AWK) '{ if ($$1 != prev) { if (rec != "") print rec; \
		  rec = $$0; prev = $$1; } \
		  else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
		  else rec = rec " " $$2 } } \
		  END { print rec }' > Makefile.dep


include Makefile.dep
=======
# $Id: Makefile.in,v 2.22.2.1 2014/08/20 06:12:39 gul Exp $
APPL=binkd

CC=@CC@
AWK=@AWK@
INSTALL=@INSTALL@

# prepend prefix to installed program names
prefix=@prefix@
CONFDIR=@sysconfdir@
MANDIR=@mandir@
DATADIR=@datarootdir@

SRCS=md5b.c binkd.c readcfg.c tools.c ftnaddr.c ftnq.c client.c server.c protocol.c bsy.c inbound.c breaksig.c branch.c unix/rename.c unix/getfree.c ftndom.c ftnnode.c srif.c pmatch.c readflo.c prothlp.c iptools.c rfc2553.c run.c binlog.c exitproc.c getw.c xalloc.c crypt.c unix/setpttl.c unix/daemonize.c @OPT_SRC@
OBJS=${SRCS:.c=.o}
AUTODEFS=@DEFS@
AUTOLIBS=@LIBS@
DEFINES=$(AUTODEFS) -DHAVE_FORK -DUNIX -DOS="\"UNIX\""
CFLAGS=$(DEFINES) @CFLAGS@
LIBS=$(AUTOLIBS)

all: compile banner

compile: $(APPL)

$(APPL): $(OBJS)
	@echo Linking $(APPL)...
	@$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

banner:
	@echo
	@echo
	@echo " Binkd is successfully compiled.                             "
	@echo
	@echo " If you want to install Binkd files into $(DESTDIR)$(prefix) "
	@echo "     1. Run \`make -n install' to be sure this makefile will "
	@echo "        do not something criminal during the installation;   "
	@echo "     2. \`su' to root;                                       "
	@echo "     3. Run \`make install' to install Binkd.                "
	@echo "     4. Edit $(CONFDIR)/$(APPL).conf-dist and RENAME it or"
	@echo "        MOVE it somewhere (so another \`make install' will   "
	@echo "        not overwrite it during your next Binkd upgrade)     "
	@echo
	@echo " If you want to put the files into some other directory just "
	@echo " run \`configure --prefix=/another/path' and go to step 1.   "
	@echo

.version: $(APPL)
	@./$(APPL) -v | $(AWK) '{ print $$2; }' > $@

install: compile .version
	./mkinstalldirs $(DESTDIR)$(prefix)/sbin
	$(INSTALL) $(APPL) $(DESTDIR)$(prefix)/sbin/$(APPL)-`cat .version`
	rm -f $(DESTDIR)$(prefix)/sbin/$(APPL)
	(VER=`cat .version` ; cd $(DESTDIR)$(prefix)/sbin ; ln -s $(APPL)-$$VER $(APPL) )
	./mkinstalldirs $(DESTDIR)$(MANDIR)/man8
	$(INSTALL) -m 644 $(APPL).8 $(DESTDIR)$(MANDIR)/man8/$(APPL).8
	./mkinstalldirs $(DESTDIR)$(CONFDIR)
	$(INSTALL) -m 644 $(APPL).conf $(DESTDIR)$(CONFDIR)/$(APPL).conf-dist

clean:
	rm -f *.[bo] unix/*.[bo] ntlm/*.[bo] *.BAK *.core *.obj *.err
	rm -f *~ core config.cache config.log config.status

cleanall: clean
	rm -f $(APPL) Makefile Makefile.dep Makefile.in
	rm -f configure configure.in .version install-sh mkinstalldirs

# targets for compatibility
mostlyclean: clean
distclean: cleanall
realclean: cleanall

.c.o:
	@echo Compiling $*.c...
	@$(CC) -c $(CFLAGS) -o $*.o $*.c

binkd.txt: binkd.8
	@groff -Tascii -mman binkd.8 | perl -npe 's/.\010//g' >binkd.txt

depend Makefile.dep:   Makefile
	@echo Making depends...
	@$(CC) -MM $(CFLAGS) $(SRCS) $(SYS) | \
	      $(AWK) '{ if ($$1 != prev) { if (rec != "") print rec; \
		  rec = $$0; prev = $$1; } \
		  else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
		  else rec = rec " " $$2 } } \
		  END { print rec }' > Makefile.dep


include Makefile.dep
>>>>>>>
