Skip to content
Snippets Groups Projects
Makefile 41.4 KiB
Newer Older
Mark Spencer's avatar
Mark Spencer committed
#
# Asterisk -- An open source telephony toolkit.
Mark Spencer's avatar
Mark Spencer committed
# Top level Makefile
#
# Copyright (C) 1999-2010, Digium, Inc.
Mark Spencer's avatar
Mark Spencer committed
#
Mark Spencer's avatar
Mark Spencer committed
#
# This program is free software, distributed under the terms of
# the GNU General Public License
#

# All Makefiles use the following variables:
#
# ASTCFLAGS - compiler options provided by the user (if any)
# _ASTCFLAGS - compiler options provided by the build system
# ASTLDFLAGS - linker flags (not libraries) provided by the user (if any)
# _ASTLDFLAGS - linker flags (not libraries) provided by the build system
# LIBS - additional libraries, at top-level for all links,
#      on a single object just for that object
# SOLINK - linker flags used only for creating dynamically loadable modules
#          as .so files
# DYLINK - linker flags used only for creating shared libaries
#          (.so files on Unix-type platforms, .dylib on Darwin)
# Values for ASTCFLAGS and ASTLDFLAGS can be specified in the
# environment when running make, as follows:
#
Luigi Rizzo's avatar
Luigi Rizzo committed
#	$ ASTCFLAGS="-Werror" make ...
#
# or as a variable value on the make command line itself:
Luigi Rizzo's avatar
Luigi Rizzo committed
#
#	$ make ASTCFLAGS="-Werror" ...
export ASTTOPDIR		# Top level dir, used in subdirs' Makefiles
export ASTERISKVERSION
export ASTERISKVERSIONNUM

#--- values used for default paths

# DESTDIR is the staging (or final) directory where files are copied
# during the install process. Define it before 'export', otherwise
# export will set it to the empty string making ?= fail.
# Trying to run asterisk from the DESTDIR is completely unsupported
# behavior.
# WARNING: do not put spaces or comments after the value.
DESTDIR?=$(INSTALL_PATH)
export DESTDIR

export INSTALL_PATH       # Additional prefix for the following paths
export ASTETCDIR          # Path for config files
export ASTVARRUNDIR
export ASTSPOOLDIR
export ASTVARLIBDIR
export ASTDATADIR
export ASTDBDIR
export ASTLIBDIR
export ASTMANDIR
export ASTHEADERDIR
export ASTSBINDIR
export ASTKEYDIR
export OSARCH             # Operating system
export NOISY_BUILD        # Used in Makefile.rules
export MENUSELECT_CFLAGS  # Options selected in menuselect.
export AST_DEVMODE        # Set to "yes" for additional compiler
                          # and runtime checks
export AST_DEVMODE_STRICT # Enables shadow warnings (-Wshadow)
export _SOLINK            # linker flags for all shared objects
export SOLINK             # linker flags for loadable modules
export DYLINK             # linker flags for shared libraries

#--- paths to various commands
# The makeopts include below tries to set these if they're found during
# configure.
export CC
export CXX
export AR
export RANLIB
export HOST_CC
export DOWNLOAD
export WGET_EXTRA_ARGS
export PYTHON
# makeopts is required unless the goal is just {dist{-}}clean
ifeq ($(MAKECMDGOALS),clean)
else ifeq ($(MAKECMDGOALS),distclean)
else ifeq ($(MAKECMDGOALS),dist-clean)
else
# start the primary CFLAGS and LDFLAGS with any that were provided
# to the configure script
_ASTCFLAGS:=$(CONFIG_CFLAGS) $(CONFIG_SIGNED_CHAR)
# Some build systems, such as the one in openwrt, like to pass custom target
# CFLAGS and LDFLAGS in the COPTS and LDOPTS variables; these should also
# go before any build-system computed flags, since they are defaults, not
# overrides
_ASTCFLAGS+=$(COPTS)
_ASTLDFLAGS+=$(LDOPTS)
# libxml2 cflags
_ASTCFLAGS+=$(LIBXML2_INCLUDE)
David M. Lee's avatar
David M. Lee committed
# BIND_8_COMPAT
_ASTCFLAGS+=$(BIND8_CFLAGS)

#Uncomment this to see all build commands instead of 'quiet' output
#NOISY_BUILD=yes

empty:=
space:=$(empty) $(empty)
ASTTOPDIR:=$(subst $(space),\$(space),$(CURDIR))
# Overwite config files on "make samples" or other config installation targets
OVERWRITE=y
# Include debug and macro symbols in the executables (-g) and profiling info (-pg)
Kevin P. Fleming's avatar
Kevin P. Fleming committed
DEBUG=-g3
# Asterisk.conf is located in ASTETCDIR or by using the -C flag
# when starting Asterisk
ASTCONFPATH=$(ASTETCDIR)/asterisk.conf

# If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
HTTP_DOCSDIR=/var/www/html
# Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
HTTP_CGIDIR=/var/www/cgi-bin
# If your platform's linker expects a prefix on symbols generated from compiling C
# source files, set LINKER_SYMBOL_PREFIX to that value. On some systems, exported symbols
# from C source files are prefixed with '_', for example. If this value is not set
# properly, the linker scripts that live in the '*.exports' files in various places
# in this tree will unintentionally suppress symbols that should be visible
# in the final binary objects.
LINKER_SYMBOL_PREFIX=

# Uncomment this to use the older DSP routines
#_ASTCFLAGS+=-DOLD_DSP_ROUTINES
# Default install directory for DAHDI hooks.
DAHDI_UDEV_HOOK_DIR = /usr/share/dahdi/span_config.d

# If the file .asterisk.makeopts is present in your home directory, you can
# include all of your favorite menuselect options so that every time you download
# a new version of Asterisk, you don't have to run menuselect to set them.
# The file /etc/asterisk.makeopts will also be included but can be overridden
ifeq ($(wildcard menuselect.makeopts),)
	USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
	GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
else
	USER_MAKEOPTS=
	GLOBAL_MAKEOPTS=
endif

MOD_SUBDIR_CFLAGS="-I$(ASTTOPDIR)/include"
OTHER_SUBDIR_CFLAGS="-I$(ASTTOPDIR)/include"
# Create OPTIONS variable, but probably we can assign directly to ASTCFLAGS
OPTIONS=

ifeq ($(findstring -save-temps,$(_ASTCFLAGS) $(ASTCFLAGS)),)
  ifeq ($(findstring -pipe,$(_ASTCFLAGS) $(ASTCFLAGS)),)
    _ASTCFLAGS+=-pipe
ifeq ($(findstring -Wall,$(_ASTCFLAGS) $(ASTCFLAGS)),)
  _ASTCFLAGS+=-Wall
_ASTCFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(AST_NESTED_FUNCTIONS) $(AST_CLANG_BLOCKS) $(DEBUG)
Tilghman Lesher's avatar
Tilghman Lesher committed
ADDL_TARGETS=
Loading
Loading full blame...