By convention, each package has two package names. In this text we will refer to them as $pkg and $PKG. The name $pkg usually consists of lower case letters, digits, underlines and hyphens. $PKG consists of uppercase letters, digits and underlines, but no hyphens. Normally $PKG is the name $pkg with letters converted to upper case and hyphens converted to underlines. Version numbers are not part of a package name, so most package names don’t contain digits.

Packages may be either library packages or binary packages. Library packages are in make/libs/](../../../make/libs/), while binary packages are in [make/.

Each package must define the following targets:

	Download source for the package

	Unpack source for the package

	Compile package and prepare for firmware generation

	Remove all files that can be recreated

	add package to the list of static or dynamic patches

	remove binary files from package or library files from root/${FREETZ_LIBRARY_DIR}

To use the convenience macros, you need some more defines:

# initialize package macros, ether BINary or LIBrary.
#   $(1) = version (mandatory)
#   $(2) = lower-case package name (optional, default name of makefile)
#   $(3) = upper-case package name (optional, default $2 converted to uppercase/underline)
# default values for
#  - $(PKG)_DIR : directory for sources
#  - $(PKG)_MAKE_DIR : directory for freetz makefile, patches and files
#  - $(PKG)_TARGET_DIR : directory for installation
$(call PKG_INIT_BIN, VERSION, [pkg], [PKG])
$(call PKG_INIT_LIB, VERSION, [pkg], [PKG])

# The download URL, split in directory part and filename

# directory containing the makefiles. This value is the default from PKG_INIT.
# It should not be necessary to override this value.

# directory for sourcefile, "$($(PKG)_SOURCE_DIR)/" and the directory created by extracting the tar-file
# This value is the default from PKG_INIT.

# target directory for the package. The default value depends on BIN/LIB,
# It should not be necessary to override this value.

# root directory for installation. The default value depends on BIN/LIB,
# It should not be necessary to override this value.

# Order for inclusion in list of static or dynamic packages. Only for binary packages.
# Only necessary if the package contains a run-script
# The default is 99, which is intended for packages that have no run-script.

# Now you can use these macros:
# Download $($(PKG)_SITE)/$($(PKG)_SOURCE) to dl/$($(PKG)_SOURCE)
# defines $(pkg)-download

# Unpack binary or library package from dl/$($(PKG)_SOURCE) and apply patches
# defines $(pkg)-unpacked and $(pkg)-source
# Some packages contain suboptions. If $(PKG)_REBUILD_SUBOPTS is defined, the package is
# rebuild from scratch if one of the named options are changed in .config.

# configure package with ./configure with standard options
# common settings are read from include/site/*, a common config.cache is enabled.
# for special needs, use these macros:
#    commands to execute before ./configure
#    terminate each command with ';'
#    example: $(PKG)_CONFIGURE_PRE_CMDS += autoconf --force ;
#    environment assignments before ./configure
#    example: $(PKG)_CONFIGURE_ENV += ac_cv_special_value=yes
#    options for ./configure
#    example: $(PKG)_CONFIGURE_OPTIONS += --with-foo --enable-bar

# If the package has no configuration, use this

# Finalize package
# defines ${pkg}-list for binary packages
# defines $(pkg)-dirclean