#!/bin/sh

# Script to build links for all the exim source files from the system-
# specific build directory. It should be run from within that directory.

test ! -d ../src && \
  echo "*** $0 should be run in a system-specific subdirectory." && \
  exit 1
test -r version.c && \
  echo "*** It appears that $0 has already been run." && \
  exit 1

echo ""
echo ">>> Creating links to source files..."

# Link the generic make file.

ln -s ../OS/Makefile-Base        Makefile

# The RFC1413 ident sources have to be linked independently
# in their own sub-directory, since their .o files are built
# using their own Makefile in the sub-directory.

mkdir libident
cd libident
ln -s ../../src/libident/Makefile        Makefile
ln -s ../../src/libident/INSTALL         INSTALL
ln -s ../../src/libident/README          README
ln -s ../../src/libident/id_close.c      id_close.c
ln -s ../../src/libident/id_open.c       id_open.c
ln -s ../../src/libident/id_parse.c      id_parse.c
ln -s ../../src/libident/id_query.c      id_query.c
ln -s ../../src/libident/ident-tester.c  ident-tester.c
ln -s ../../src/libident/ident.3         ident.3
ln -s ../../src/libident/ident.c         ident.c
ln -s ../../src/libident/ident.h         ident.h
ln -s ../../src/libident/lookup-tester.c lookup-tester.c
ln -s ../../src/libident/support.c       support.c
ln -s ../../src/libident/version.c       version.c
cd ..

# Likewise for the code for the directors
mkdir directors
cd directors
ln -s ../../src/directors/README        README
ln -s ../../src/directors/Makefile      Makefile
ln -s ../../src/directors/aliasfile.h   aliasfile.h
ln -s ../../src/directors/aliasfile.c   aliasfile.c
ln -s ../../src/directors/forwardfile.h forwardfile.h
ln -s ../../src/directors/forwardfile.c forwardfile.c
ln -s ../../src/directors/localuser.h   localuser.h
ln -s ../../src/directors/localuser.c   localuser.c
ln -s ../../src/directors/smartuser.h   smartuser.h
ln -s ../../src/directors/smartuser.c   smartuser.c
cd ..

# Likewise for the code for the routers
mkdir routers
cd routers
ln -s ../../src/routers/README          README
ln -s ../../src/routers/Makefile        Makefile
ln -s ../../src/routers/domainlist.h    domainlist.h
ln -s ../../src/routers/domainlist.c    domainlist.c
ln -s ../../src/routers/ipliteral.h     ipliteral.h
ln -s ../../src/routers/ipliteral.c     ipliteral.c
ln -s ../../src/routers/iplookup.h      iplookup.h
ln -s ../../src/routers/iplookup.c      iplookup.c
ln -s ../../src/routers/lookuphost.h    lookuphost.h
ln -s ../../src/routers/lookuphost.c    lookuphost.c
ln -s ../../src/routers/queryprogram.h  queryprogram.h
ln -s ../../src/routers/queryprogram.c  queryprogram.c
cd ..

# Likewise for the code for the transports
mkdir transports
cd transports
ln -s ../../src/transports/README       README
ln -s ../../src/transports/Makefile     Makefile
ln -s ../../src/transports/appendfile.h appendfile.h
ln -s ../../src/transports/appendfile.c appendfile.c
ln -s ../../src/transports/autoreply.h  autoreply.h
ln -s ../../src/transports/autoreply.c  autoreply.c
ln -s ../../src/transports/debug.h      debug.h
ln -s ../../src/transports/debug.c      debug.c
ln -s ../../src/transports/pipe.h       pipe.h
ln -s ../../src/transports/pipe.c       pipe.c
ln -s ../../src/transports/smtp.h       smtp.h
ln -s ../../src/transports/smtp.c       smtp.c
cd ..

# The basic source files for Exim and utilities

ln -s ../src/dbhdr.h           dbhdr.h
ln -s ../src/exim.h            exim.h
ln -s ../src/functions.h       functions.h
ln -s ../src/globals.h         globals.h
ln -s ../src/macros.h          macros.h
ln -s ../src/structs.h         structs.h

ln -s ../src/accept.c          accept.c
ln -s ../src/buildconfig.c     buildconfig.c
ln -s ../src/child.c           child.c
ln -s ../src/daemon.c          daemon.c
ln -s ../src/db.c              db.c
ln -s ../src/debug.c           debug.c
ln -s ../src/deliver.c         deliver.c
ln -s ../src/direct.c          direct.c
ln -s ../src/directory.c       directory.c
ln -s ../src/drtables.c        drtables.c
ln -s ../src/exim.c            exim.c
ln -s ../src/exim_dbmbuild.c   exim_dbmbuild.c
ln -s ../src/exim_dumpdb.c     exim_dumpdb.c
ln -s ../src/exim_fixdb.c      exim_fixdb.c
ln -s ../src/exim_tidydb.c     exim_tidydb.c
ln -s ../src/expand.c          expand.c
ln -s ../src/filter.c          filter.c
ln -s ../src/globals.c         globals.c
ln -s ../src/header.c          header.c
ln -s ../src/host.c            host.c
ln -s ../src/log.c             log.c
ln -s ../src/match.c           match.c
ln -s ../src/moan.c            moan.c
ln -s ../src/os.SunOS5.c       os.SunOS5.c
ln -s ../src/parse.c           parse.c
ln -s ../src/queue.c           queue.c
ln -s ../src/readconf.c        readconf.c
ln -s ../src/retry.c           retry.c
ln -s ../src/rewrite.c         rewrite.c
ln -s ../src/route.c           route.c
ln -s ../src/search.c          search.c
ln -s ../src/smtp_in.c         smtp_in.c
ln -s ../src/spool_in.c        spool_in.c
ln -s ../src/spool_out.c       spool_out.c
ln -s ../src/store.c           store.c
ln -s ../src/string.c          string.c
ln -s ../src/tod.c             tod.c
ln -s ../src/transport.c       transport.c
ln -s ../src/tree.c            tree.c
ln -s ../src/verify.c          verify.c
ln -s ../src/version.c         version.c

# End of MakeLinks
