#
# $Header: /home/cvs/d4x/main/Makefile.am,v 1.3.2.4 2005/09/13 08:47:17 max Exp $
#

include $(top_srcdir)/admin/Makefile.all

SUBDIRS = face

MAINTAINERCLEANFILES = Makefile.in
CLEANFILES = *~

# FIXME: We override 'default' value used by automake to avoid headers conflict
DEFAULT_INCLUDES = -I$(top_builddir)

bin_PROGRAMS = nt

if EXTRA_OPTIMIZE
nt_SOURCES = nt.all_cc.cc
else
nt_SOURCES = $(nt_SOURCES_LIST)
endif

# List of C++ modules (got from `ls -w50 -q *.cc)
nt_SOURCES_LIST = $(strip                   \
    addr.cc      queue.cc     path.cc       \
    alt.cc       history.cc   recode.cc     \
    autoadd.cc   hproxy.cc    savedvar.cc   \
    base64.cc    html.cc      savelog.cc    \
    client.cc    http.cc      schedule.cc   \
    httpd.cc     segments.cc  sslsocket.cc  \
    config.cc    liststr.cc   signal.cc     \
    cookie.cc    locstr.cc    sm.cc         \
    db.cc        log.cc       sndserv.cc    \
    dlist.cc     main.cc      socket.cc     \
    download.cc  mainlog.cc   socks.cc      \
    dqueue.cc    memwl.cc     sort.cc       \
    eff.cc       meter.cc     speed.cc      \
    filter.cc    msgqueue.cc  srvclt.cc     \
    fsearch.cc   mutex.cc     var.cc        \
    ftp.cc       nt.cc        xml.cc        \
    ftpd.cc      ping.cc                    \
)
noinst_HEADERS = $(strip                           \
    addr.h      eff.h       log.h       schedule.h \
    alt.h       filter.h    main.h      segments.h \
    autoadd.h   fsearch.h   mainlog.h   signal.h   \
    base64.h    ftp.h       memwl.h     sm.h       \
    client.h    ftpd.h      meter.h     sndserv.h  \
    msgqueue.h  socket.h    sslsocket.h path.h     \
    config.h    history.h   mutex.h     socks.h    \
    cookie.h    hproxy.h    ntlocale.h  sort.h     \
    db.h        html.h      ping.h      speed.h    \
    dbc.h       http.h      queue.h     srvclt.h   \
    dlist.h     httpd.h     recode.h    var.h      \
    download.h  liststr.h   savedvar.h  xml.h      \
    dqueue.h    locstr.h    savelog.h              \
)
nt_LDADD = $(top_builddir)/main/face/libface.a

#
# Rule to join all sources in one compilation unit
#
nt.all_cc.cc: $(srcdir)/Makefile.am
	@echo "Creating $(@) ..."; \
	echo "/* DO NOT EDIT! This file is autogenerated by 'make' from sources list... */" > $(@); \
	list="$(nt_SOURCES_LIST)"; \
	for i in $$list; do \
	    echo "#include \"$$i\"" >> $(@); \
	done

#
# Make symlink (if possible) nt --> d4x on install
#
install-exec-local:
	if test -f $(DESTDIR)$(bindir)/$(PACKAGE); then \
	    rm -f $(DESTDIR)$(bindir)/$(PACKAGE); \
	fi; \
	cd $(DESTDIR)$(bindir) && $(LN_S) -f $(bin_PROGRAMS) $(PACKAGE)

#
# Remove remaining symlink when unistall
#
uninstall-local:
	test -h $(DESTDIR)$(bindir)/$(PACKAGE) && rm -f $(DESTDIR)$(bindir)/$(PACKAGE)


syntax highlighted by Code2HTML, v. 0.9.1