usr/src/cmd/quagga/Makefile.sfw
author Jon Tibble <meths@btinternet.com>
Mon, 04 May 2015 14:04:39 +0100
branchoi_151a
changeset 254 9c2a4ac793f0
parent 228 dc60997879d6
permissions -rw-r--r--
Bash patch catchup including shellshock

#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
#
#pragma ident	"@(#)Makefile.sfw	1.11	11/03/16 SMI"

NAME=quagga
VERSION=0.99.8
SOURCE=$(NAME)-$(VERSION).tar.gz
SRCDIR=$(NAME)-$(VERSION)
BUILDDIR=$(NAME)-$(MACH)-build

PATCHES:sh= cat ./PATCHES.sfw | grep -v '^\#' | grep -v '^$' | sed 's/\(.*\)/$(SRCDIR)\/\1\.applied/'

LD_OPTIONS=-L${ROOT}/usr/lib -L/usr/sfw/lib -L/usr/lib  -R/usr/sfw/lib:/usr/lib

.PARALLEL: $(BUILDDIR)/.compile

all: runconfig $(BUILDDIR)/.compile
	@find . -name core -exec rm -f {} \;

include ../Makefile.cmd

# configure script paths, e.g. --prefix, --sysconfdir, etc..
# ../../Makefile should provide these directly idealls
CFGSYSCONFDIR=	$(CFGETC)/quagga
CFGPREFIX=	/usr
CFGLOCALSTATEDIR=/var/run/quagga
CFGINFODIR=	$(CFGSFWINFO)
CFGMANDIR=	$(CFGSFWMAN)
CFGINCLUDEDIR=	$(CFGSFWINCLUDE)
CFGLIBDIR=	$(CFGSFWLIB)

# GNU compatible install is needed by auto* and provided with Quagga
INSTALL=../$(SRCDIR)/install-sh

#CC=cc
CPPFLAGS += -I /usr/sfw/include
LDFLAGS +=-lumem

#Sun SOS8 CFLAGS
CFLAGS += -xspace -Xa -xildoff 
#debug
CFLAGS += -g -xdebugformat=dwarf -O
#else optimisation
#CFLAGS += -xO4
CFLAGS += -errtags=yes -xc99=%all 
CFLAGS += -erroff=E_TRAILING_COMMA_IN_ENUM 
CFLAGS += -erroff=E_STATEMENT_NOT_REACHED 
CFLAGS += -erroff=E_EMPTY_TRANSLATION_UNIT 
#CFLAGS += -DTEXT_DOMAIN="SUNW_OST_OSCMD" 
#CFLAGS += -D_TS_ERRNO

#GCC CFLAGS
#CFLAGS = -g -Os -Wall,packed,padded,sign-compare,pointer-arith


install: all
	(cd $(BUILDDIR) ; $(GMAKE) \
		install MAKE="$(GMAKE)" DESTDIR="$(ROOT)" ; \
	 $(SH) ../post-install.sh "$(ROOT)" "$(SRCDIR)")
	$(INSTALL_PROTO) -m 0444 exec_attr $(ROOT)/etc/security/exec_attr.d/quagga

$(BUILDDIR)/config.status: .prep
	(cd $(BUILDDIR); env \
	    LD_OPTIONS="$(LD_OPTIONS)" \
	    CC=$(CC) "CFLAGS=$(CFLAGS)" "CPPFLAGS=$(CPPFLAGS)" \
	    MAKE=$(GMAKE) \
	    PATH=$(SFW_PATH) \
	    INSTALL="$(INSTALL) -c" \
	    ../$(SRCDIR)/configure  --prefix=$(CFGPREFIX) \
		--sysconfdir=$(CFGSYSCONFDIR) \
	    --localstatedir=$(CFGLOCALSTATEDIR) \
	    --infodir=$(CFGINFODIR) \
	    --mandir=$(CFGMANDIR) \
	    --includedir=$(CFGINCLUDEDIR) \
	    --libdir=$(CFGLIBDIR) \
	    --with-tags="" \
	    --with-cflags="$(CFLAGS)" \
	    --enable-opaque-lsa \
	    --enable-isisd --enable-trill --disable-watchquagga \
	    --enable-ospf6d --enable-ripngd \
	    --enable-user=root --enable-group=root)

$(BUILDDIR)/.compile:
	(cd $(BUILDDIR); $(GMAKE) \
	    LD_OPTIONS="$(LD_OPTIONS)" \
	    CC=$(CC) \
	    "LDFLAGS=$(LDFLAGS)" \
            "CFLAGS=$(CFLAGS)" \
	    "CPPFLAGS=$(CPPFLAGS)" \
	    PATH=$(SFW_PATH) \
	    MAKE=$(GMAKE) \
	    INSTALL="$(INSTALL) -c" )
	touch $(BUILDDIR)/.compile

packages: install .WAIT
	(cd $(BUILDDIR)/solaris; $(GMAKE) MAKE="$(GMAKE)" DESTDIR=$(ROOT) packages)

runconfig: $(BUILDDIR)/config.status

untar: $(SRCDIR)/.untar

$(SRCDIR)/.untar: $(SOURCE) 
	gzip -dc $(SOURCE) | tar xopf -
	touch $(SRCDIR)/.untar

patch: $(SRCDIR)/.patch

$(SRCDIR)/.patch: $(SRCDIR)/.untar $(PATCHES)
	touch $(SRCDIR)/.patch

$(BUILDDIR):
	mkdir $(BUILDDIR)

.prep: $(SRCDIR)/.untar $(SRCDIR)/.patch $(BUILDDIR)
	touch .prep

prep: .prep

clean:
	-$(RM) -f -r $(SRCDIR) .prep $(BUILDDIR)

$(SRCDIR)/%.patch.applied: patches/%.patch
	(cd $(SRCDIR); gpatch -p0 < ../$< && cp ../$< ../$@ && touch ../$@)

include ../Makefile.targ