$OpenBSD: patch-Makefile,v 1.8 2006/09/24 21:09:26 jolan Exp $ --- Makefile.orig Wed Sep 6 15:09:10 2006 +++ Makefile Tue Sep 19 14:26:50 2006 @@ -19,8 +19,8 @@ OPTIONS= # CROSS_COMPILE=/opt/montavista/pro/devkit/arm/xscale_be/bin/xscale_be- # CROSS_COMPILE_BIN=/opt/montavista/pro/devkit/arm/xscale_be/bin/ # CROSS_COMPILE_TARGET=/opt/montavista/pro/devkit/arm/xscale_be/target -CC=$(CROSS_COMPILE)gcc -HOST_CC=gcc +CC?=$(CROSS_COMPILE)gcc +HOST_CC=$(CC) # CROSS_ARCH=Linux # CROSS_PROC=arm # SUB_PROC=xscale # or maverick @@ -47,8 +47,12 @@ ifneq ($(findstring dont-optimize,$(MAKE #K6OPT = -DK6OPT #Tell gcc to optimize the code +ifeq (${OSARCH},OpenBSD) +OPTIMIZE+=-O2 +else OPTIMIZE+=-O6 endif +endif #Overwite config files on "make samples" OVERWRITE=y @@ -88,7 +92,11 @@ INSTALL=install # Where to install asterisk after compiling # Default -> leave empty +ifeq (${OSARCH},OpenBSD) +INSTALL_PREFIX= ${TRUEPREFIX} +else INSTALL_PREFIX?= +endif # Staging directory # Files are copied here temporarily during the install process @@ -110,7 +118,7 @@ BUSYDETECT+= #-DBUSYDETECT_TONEONLY # Don't use together with -DBUSYDETECT_TONEONLY BUSYDETECT+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE -ifneq ($(OSARCH),SunOS) +ifeq ($(OSARCH),Linux) ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk ASTVARLIBDIR=$(INSTALL_PREFIX)/var/lib/asterisk ASTETCDIR=$(INSTALL_PREFIX)/etc/asterisk @@ -124,7 +132,25 @@ ifneq ($(OSARCH),SunOS) ASTMANDIR=$(INSTALL_PREFIX)/usr/share/man MODULES_DIR=$(ASTLIBDIR)/modules AGI_DIR=$(ASTVARLIBDIR)/agi-bin -else +endif +# OpenBSD has its own packaging mechanism +ifeq ($(OSARCH),OpenBSD) + ASTLIBDIR=$(INSTALL_PREFIX)/lib/asterisk + ASTVARLIBDIR=$(INSTALL_PREFIX)/share/asterisk + ASTETCDIR=${SYSCONFDIR}/asterisk + ASTSPOOLDIR=/var/spool/asterisk + ASTLOGDIR=/var/log/asterisk + ASTHEADERDIR=$(INSTALL_PREFIX)/include/asterisk + ASTCONFPATH=$(ASTETCDIR)/asterisk.conf + ASTBINDIR=$(INSTALL_PREFIX)/bin + ASTSBINDIR=$(INSTALL_PREFIX)/sbin + ASTVARRUNDIR=/var/db/asterisk + ASTMANDIR=$(INSTALL_PREFIX)/man + + MODULES_DIR=$(ASTLIBDIR)/modules + AGI_DIR=/var/asterisk/agi-bin +endif +ifeq ($(OSARCH),SunOS) ASTLIBDIR=$(INSTALL_PREFIX)/opt/asterisk/lib ASTVARLIBDIR=$(INSTALL_PREFIX)/var/opt/asterisk/lib ASTETCDIR=$(INSTALL_PREFIX)/etc/opt/asterisk @@ -165,6 +191,8 @@ HTTP_CGIDIR=/var/www/cgi-bin # The file, /etc/asterisk.makeopts will also be included, but can be overridden # by the file in your home directory. +# OpenBSD wants repeatable builds +ifneq ($(OSARCH),OpenBSD) ifneq ($(wildcard /etc/asterisk.makeopts),) include /etc/asterisk.makeopts endif @@ -172,6 +200,7 @@ endif ifneq ($(wildcard ~/.asterisk.makeopts),) include ~/.asterisk.makeopts endif +endif ifeq ($(OSARCH),Linux) ifeq ($(CROSS_COMPILE),) @@ -235,8 +264,10 @@ ifeq ($(findstring BSD,$(OSARCH)),BSD) ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib endif -ifneq ($(PROC),ultrasparc) - ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi) +ifneq (${OSARCH},OpenBSD) + ifneq ($(PROC),ultrasparc) + ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi) + endif endif ifeq ($(PROC),ppc) @@ -423,6 +454,7 @@ endif LIBS+=-lssl _all: all +ifneq (${OSARCH},OpenBSD) @echo " +--------- Asterisk Build Complete ---------+" @echo " + Asterisk has successfully been built, but +" @echo " + cannot be run before being installed by +" @@ -430,6 +462,7 @@ _all: all @echo " + +" @echo " + $(MAKE) install +" @echo " +-------------------------------------------+" +endif all: cleantest depend asterisk subdirs @@ -705,6 +738,7 @@ install: all datafiles bininstall instal @if [ -x /usr/sbin/asterisk-post-install ]; then \ /usr/sbin/asterisk-post-install $(DESTDIR) . ; \ fi +ifneq (${OSARCH},OpenBSD) @echo " +---- Asterisk Installation Complete -------+" @echo " + +" @echo " + YOU MUST READ THE SECURITY DOCUMENT +" @@ -726,6 +760,7 @@ install: all datafiles bininstall instal @echo " + **Note** This requires that you have +" @echo " + doxygen installed on your local system +" @echo " +-------------------------------------------+" +endif @$(MAKE) -s oldmodcheck upgrade: all bininstall