Jamrules #4

  • //
  • guest/
  • sven_erik_knop/
  • p4dcfg/
  • Jamrules
  • View
  • Commits
  • Open Download .zip Download (2 KB)
EXEC_DIRS = P4DCFG bin.$(OS:L)$(OSVER:EL)$(OSPLAT:EL) $(TYPE:L) ;
EXEC	?= [ FSubDirPath $(EXEC_DIRS) ] ;
ALL_LOCATE_TARGET = $(EXEC) ;

TYPE	?= opt ;

#
# Support for different build types
#
switch $(TYPE)
{
    case opt :
	    OPTIM = -O ;

    case g :
	    OPTIM = -g ;

    case pg :
	    OPTIM = -pg ;

    case * :
	    Exit Don't know build type $(TYPE) ;
}

#
# By default install into /usr/local/bin
#
BINDIR ?= /usr/local/bin ;
	
#
# OS variations
#
switch $(OS)
{
    case LINUX :
	    C++ = c++ ;
	    LINK = c++ ;
	    YACC = bison ;
	    YACCFLAGS += -b y ;
    case SOLARIS :
	    C++ = g++ ;
	    CC  = gcc ;
	    LINK = g++ ;
    case FREEBSD :
	    C++ = g++ ;
	    CC  = gcc ;
	    LINK = g++ ;
	case DARWIN :
		C++ = g++ ;
		CC  = gcc ;
		LINK = g++ ;

    case * :
	    Echo Don't know "$(OS)$(OSVER) or " $(OS). I'll try ;
}

#
# Rule for making sure that our executable is installed setuid root, which
# it needs to be to manage the pid files. Based on InstallInto and InstallBin
# in Jambase: unfortunately they don't get it quite right.
#
# SetUidRoot target : sources ;

rule SetUidRoot
{
	local _oldmode = $(EXEMODE) ;
	local _oldowner = $(OWNER) ;

	EXEMODE = 4711 ;
	OWNER = root ;

	Main $(<) : $(>) ;

	local i t ;

	t = [ FAppendSuffix $(<) : $(SUFEXE) ] ;
	t = $(t:G=$(INSTALLGRIST)) ;
	MODE on $(t) = $(EXEMODE) ;

	# Arrange for jam install
	# Arrange for jam uninstall
	# sources are in SEARCH_SOURCE
	# targets are in dir

	Depends install : $(t) ;
	Clean uninstall : $(t) ;
	SEARCH on $(<) = $(SEARCH_SOURCE) ;
	MakeLocate $(t) : $(BINDIR) ;

	# For each target, make gristed target name
	# and Install, Chmod, Chown, and Chgrp

	for i in $(<)
	{
	    local tt = $(i:G=$(INSTALLGRIST)) ;

	    Depends $(tt) : $(i) ;
	    Install $(tt) : $(i) ;

	    if $(OWNER) && $(CHOWN) 
	    { 
		Chown $(tt) ;
		OWNER on $(tt) = $(OWNER) ;
	    }

	    if $(GROUP) && $(CHGRP) 
	    { 
		Chgrp $(tt) ;
		GROUP on $(tt) = $(GROUP) ;
	    }

	    Chmod $(tt) ;
	}

	EXEMODE = $(_oldmode) ;
	OWNER	= $(_oldowner) ;
}
# Change User Description Committed
#4 8038 Sven Erik Knop Updated imports and link libraries for Linux to deal with new compiler.
#3 7761 Sven Erik Knop Added Darwin for Mac OS X to the Jamrules.
#2 5987 Sven Erik Knop Few minor changes:

All commands now accept variable called "Options". This can be used to collect
all options for which Perforce has not defined an environment variable -
for example the undocumented "-C1" for p4d to start a case insensitive server.

p4d also accepts the variables P4USER and P4PASSWD. These are only used for
stopping the service, which is done first via "p4 admin stop". Note that if
the stop via the admin command fails, p4dcfg will stop the service via a kill
#1 5882 Sven Erik Knop initial publish