XCOMM $Xorg: Imakefile,v 1.4 2000/08/17 19:54:01 cpqbld Exp $
XCOMM
XCOMM
XCOMM
XCOMM
XCOMM $XFree86: xc/programs/rstart/Imakefile,v 3.11 2002/05/31 18:46:08 dawes Exp $
XCOMM
XCOMM Copyright (c) 1993 Quarterdeck Office Systems
XCOMM
XCOMM Permission to use, copy, modify, distribute, and sell this software
XCOMM and software and its documentation for any purpose is hereby granted
XCOMM without fee, provided that the above copyright notice appear in all
XCOMM copies and that both that copyright notice and this permission
XCOMM notice appear in supporting documentation, and that the name
XCOMM Quarterdeck Office Systems, Inc. not be used in advertising or
XCOMM publicity pertaining to distribution of this software without
XCOMM specific, written prior permission.
XCOMM
XCOMM THIS SOFTWARE IS PROVIDED 'AS-IS'.  QUARTERDECK OFFICE SYSTEMS,
XCOMM INC., DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
XCOMM INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF
XCOMM MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
XCOMM NONINFRINGEMENT.  IN NO EVENT SHALL QUARTERDECK OFFICE SYSTEMS,
XCOMM INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING SPECIAL,
XCOMM INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA, OR
XCOMM PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS
XCOMM OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT
XCOMM OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

XCOMM Having had to change the name once, I do not want it to be tough
XCOMM the next time...

SERVERNAME=rstartd
SSERVERNAME=$(SERVERNAME)
RSERVERNAME=$(SERVERNAME).real
SSERVERSRC=server.cpp
OS=
CLIENTNAME=rstart

MYLIBDIR=$(LIBDIR)/rstart
ENVPREFIX=RSTART
PACKAGEname=rstart

USRBIN=DefaultUsrBin

#ifndef RshCmd
# if	SystemV
#  ifdef HPArchitecture
#   define	RshCmd	remsh
#  else
#   define	RshCmd	rcmd
#  endif
# else
#  define	RshCmd	rsh
# endif
#endif

RSHCMD=RshCmd

           SRCS = server.c auth.c
           OBJS = server.o auth.o

SRVDEFS = -DSERVERNAME=\"$(SERVERNAME)\" -DDEFAULT_CONFIG=\"$(MYLIBDIR)/config\"
#if !HasPutenv
PEDEFS = -DNOPUTENV
#endif

AllTarget(ProgramTargetName($(RSERVERNAME)))
NormalProgramTarget($(RSERVERNAME), $(OBJS),NullParameter,NullParameter,NullParameter)
InstallProgram($(RSERVERNAME),$(MYLIBDIR))

SpecialCObjectRule(server,NullParameter,$(SRVDEFS) $(PEDEFS))

AllTarget($(SSERVERNAME))
CppScriptTarget($(SSERVERNAME),$(SSERVERSRC),$(OS) -DLIBDIR=$(MYLIBDIR) -DSERVERNAME=$(SERVERNAME),NullParameter)
InstallNamedProg($(SSERVERNAME),$(SSERVERNAME),$(BINDIR))

AllTarget($(CLIENTNAME))
CppScriptTarget($(CLIENTNAME),client.cpp,-DRSHCMD=$(RSHCMD) -DSERVERNAME=$(SERVERNAME),NullParameter)
InstallNamedProg($(CLIENTNAME),$(CLIENTNAME),$(BINDIR))

AllTarget(config)
CppFileTarget(config,config.cpp,-DBINDIR=$(BINDIR) -DLIBDIR=$(MYLIBDIR) -DPACKAGEname=$(PACKAGEname) -DENVPREFIX=$(ENVPREFIX),NullParameter)
InstallNonExecFile(config,$(MYLIBDIR))

#ifdef	ProjectRoot
DEFAULT_X_MANPATH=$(MANPATH):SystemManDirectory
#else
DEFAULT_X_MANPATH=SystemManDirectory
#endif

DEFAULT_USER_PATH=DefaultUserPath

#define MakeDirect(dir) if [ -d dir ]; then set +x;			\@@\
		else (set -x; $(MKDIRHIER) dir); fi

#define	FilterContext(src, dest) RemoveFile(dest);			\@@\
	sed								\@@\
		-e 's,_PATH,$(DEFAULT_USER_PATH),g'			\@@\
		-e 's,_MANPATH,$(DEFAULT_X_MANPATH),g'			\@@\
		< src > dest

#define	FilterCommand(src, dest) RemoveFile(dest);			\@@\
	sed								\@@\
		-e 's,ENVPREFIX,$(ENVPREFIX),g'				\@@\
		< src > dest;						\@@\
	case `basename dest` in						\@@\
	@*)								\@@\
		;;							\@@\
	*)								\@@\
		chmod a+x dest ;;					\@@\
	esac

#define	Recurse(src, dest, filefunc) set -x;				\@@\
	for name in `find src -print | grep -v CVS` ;			\@@\
		do							\@@\
			if test -f $$name;				\@@\
			then						\@@\
				filefunc($$name,$(DESTDIR)dest/$$name);	\@@\
			else						\@@\
				MakeDirect($(DESTDIR)dest/$$name);	\@@\
			fi;						\@@\
 		done

#if	HasSymLinks
#define	InstallAliases() set -x;					\@@\
 	cd $(DESTDIR)$(MYLIBDIR)/contexts;				\@@\
 		sed -e '/^$$/d' -e '/^#/d' @Aliases |			\@@\
 		while read real aliases;				\@@\
 		do							\@@\
 			for i in $$aliases;				\@@\
 			do						\@@\
 				$(RM) $$i;				\@@\
 				$(LN) $$real $$i;			\@@\
 				$(RM) $(DESTDIR)$(MYLIBDIR)/commands/$$i; \@@\
 				$(LN) $$real $(DESTDIR)$(MYLIBDIR)/commands/$$i; \@@\
 			done;						\@@\
 		done;							\@@\
 		rm @Aliases
#else
#define	InstallAliases()						\@@\
	echo "Sorry:  don't yet know how to install aliases without symlinks"
#endif

install::
	Recurse(commands,$(MYLIBDIR),FilterCommand)
	Recurse(contexts,$(MYLIBDIR),FilterContext)
	InstallAliases()

InstallManPage(rstart,$(MANDIR))
InstallManPage(rstartd,$(MANDIR))

XCOMM # Turning this on makes the server look up host names in $DISPLAY and
XCOMM # substitute IP addresses.  (ODT v1 X clients can't look names up in
XCOMM # DNS.)
XCOMM #CFLAGS=-DODT1_DISPLAY_HACK

LinkConfDirectory(rstart,.,rstart,.)

