Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
C
click_for_comnet2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jiachen,Chen
click_for_comnet2
Commits
722c6733
Commit
722c6733
authored
Apr 30, 2019
by
Jiachen,Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added basic structures for click package
parent
cc4f881f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
289 additions
and
0 deletions
+289
-0
build/Makefile.in
build/Makefile.in
+60
-0
build/README
build/README
+146
-0
build/configure.ac
build/configure.ac
+83
-0
No files found.
build/Makefile.in
0 → 100644
View file @
722c6733
SHELL
=
@SHELL@
# THESE VARIABLES MAY CHANGE BETWEEN PACKAGES
# Set 'package' to the name of your package.
package
:=
@CLICKPACKAGENAME@
# Set these variables appropriately.
top_builddir
:=
.
subdir
:=
.
# Require Click prefix settings.
# Generally, you will provide a '--with-click=CLICKPREFIX' option, and set:
clickbuild_prefix
:=
@clickbuild_prefix@
include
@clickbuild_datadir@/config.mk
# Set 'MAKE_UPACKAGE', 'MAKE_KPACKAGE', and 'MAKE_BPACKAGE' to '0' or '1'
# to determine whether to build userlevel, linuxmodule, and bsdmodule
# packages, respectively.
MAKE_UPACKAGE
=
@BUILD_USERLEVEL@
MAKE_KPACKAGE
=
@BUILD_LINUXMODULE@
MAKE_BPACKAGE
=
@BUILD_BSDMODULE@
# Set 'KVERSIONFLAGS' to '--gpl' to generate a dual BSD/GPL licensed
# linuxmodule package.
KVERSIONFLAGS
=
--gpl
# Set 'STRIP_UPACKAGE' to 'strip -g' to strip debugging symbols from the
# userlevel package before installing.
#STRIP_UPACKAGE = $(STRIP) -g
# Set these variables as required.
DEFS
=
@DEFS@
$(CLICKDEFS)
INCLUDES
=
-I
.
-I
$(top_builddir)
-I
$(srcdir)
$(CLICKINCLUDES)
# Set this variable to force 'click-elem2package' to include a header,
# such as your package's '<config.h>', if necessary.
#ELEM2PACKAGE_INCLUDES = -i'<config.h>'
# END OF VARIABLES THAT MAY CHANGE BETWEEN PACKAGES
# Everything below here will probably stay unchanged
srcdir
:=
@srcdir@
top_srcdir
:=
@top_srcdir@
ifeq
($(CLICK_PACKAGE_MAKING),)
prefix
=
@prefix@
exec_prefix
=
@exec_prefix@
bindir
=
@bindir@
sbindir
=
@sbindir@
libdir
=
@libdir@
mandir
=
@mandir@
datarootdir
=
@datarootdir@
datadir
=
@datadir@
endif
include
$(clickbuild_datadir)/pkg-Makefile
build/README
0 → 100644
View file @
722c6733
A
SAMPLE
PACKAGE
================
Click
supports
dynamically
linked
'packages'
containing
extra
elements
.
The
two
drivers
--
specifically
,
the
'click'
user
-
level
driver
and
the
'click-install'
program
for
the
Linux
kernel
driver
--
automatically
link
with
whatever
packages
are
mentioned
in
a
configuration
's '
require
'
statements. If you are building a collection of your own elements, it may
make sense to compile that collection as a package. Then you can keep your
Click sources separate from your package sources.
This directory demonstrates how to write a simple package. You can copy
most of the files into your own package with minimal changes.
INSTALLATION
------------
This section describes how you can install this package -- which is
named '
sample
' -- and, by extension, any package you build based on this
one.
Before you can build a package, you must install Click into some
directory DIR. (You set DIR with the '
--
prefix
=
DIR
' option to Click'
s
'./configure'
.)
We
often
use
'/usr/local/click'
,
but
if
you
do
not
have
permission
on
that
directory
,
'$HOME'
or
'$HOME/click'
works
just
as
well
.
Now
you
must
configure
your
package
,
telling
it
where
the
Click
install
directory
is
.
The
best
way
to
do
this
is
to
run
'./configure --prefix=DIR'
,
where
DIR
is
the
Click
install
directory
.
The
package
will
be
installed
in
DIR
,
where
the
Click
drivers
can
find
it
.
(
The
package
'./configure'
has
several
interesting
options
,
like
'--disable-linuxmodule'
;
run
'./configure
--help'
to
see
them
.)
Next
,
just
run
'make install'
.
This
will
build
and
install
element
collections
for
both
drivers
,
manual
pages
for
the
package
's elements, and
an '
elementmap
' for the package.
We have supplied a simple configuration that tests the '
sample
'
package, '
test
.
click
'. Note the '
require
(
sample
);
' line: this is what tells
the Click drivers to load the '
sample
' package.
GUIDE TO THE SOURCE
-------------------
This section describes which files make up this simple package, and how
to alter those files for your own package. Creating a new package is very
simple: just create a directory for the package, copy and alter the
'
configure
.
ac
' and '
Makefile
.
in
' files, run '
autoconf
' and '
./
configure
',
and add your element sources.
'
configure
.
ac
'
..............
Autoconf generates '
./
configure
' from this script. Alter
'
configure
.
ac
' to refer to your package, rather than the "sample" package.
Packages rely on Click'
s
configuration
process
,
so
package
'configure.ac'
files
are
quite
short
.
Autoconf
has
a
useful
info
(
1
)
manual
.
'Makefile.in'
.............
'./configure'
generates
a
Makefile
from
'Makefile.in'
.
Most
of
'Makefile.in'
can
generally
stay
as
is
.
However
,
if
you
develop
a
complex
source
hierarchy
--
where
the
element
source
code
is
in
a
separate
directory
,
for
example
--
you
will
need
to
alter
it
.
Look
particularly
at
the
'top_builddir'
and
'subdir'
variables
.
Element
source
..............
Element
source
code
designed
for
a
package
looks
just
like
normal
element
source
code
.
This
is
normally
the
only
actual
C
++
code
you
will
need
to
write
;
Click
automatically
generates
the
boilerplate
that
turns
your
elements
into
a
package
.
Take
a
look
at
'sampleelt.cc'
and
'sampleelt.hh'
.
'make elemlist'
is
useful
when
you
add
or
remove
elements
from
the
package
.
It
rebuilds
the
lists
of
valid
element
source
files
stored
in
'kelements.conf'
and
'uelements.conf'
.
GENERATED
FILES
---------------
Building
a
package
creates
a
bunch
of
files
with
unusual
extensions
.
Here
are
the
files
,
and
what
they
are
for
.
'kelements.conf'
,
'uelements.conf'
..................................
These
files
list
the
element
source
code
to
be
compiled
into
the
kernel
package
and
user
-
level
package
,
respectively
.
They
are
automatically
generated
by
'click-buildtool findelem'
.
'Click-buildtool'
only
considers
C
++
source
files
named
'WHATEVER.cc'
that
contain
an
'EXPORT_ELEMENT'
or
'ELEMENT_PROVIDES'
line
.
Run
'make elemlist'
to
rebuild
'kelements.conf'
and
'uelements.conf'
.
'kelements.mk'
,
'uelements.mk'
..............................
These
files
contain
definitions
for
the
'ELEMENT_OBJS'
Make
variable
,
which
tell
Make
what
element
source
code
to
compile
.
They
are
generated
by
'click-buildtool elem2make'
from
'kelements.conf'
and
'uelements.conf'
,
respectively
.
'kpackage.cc'
,
'upackage.cc'
............................
These
files
define
the
'init_module'
and
'cleanup_module'
functions
that
actually
export
your
new
elements
to
the
relevant
driver
.
They
are
generated
by
'click-buildtool elem2package'
from
'kelements.conf'
and
'uelements.conf'
,
respectively
.
'FILE.ko'
,
'FILE.uo'
....................
These
are
object
files
destined
for
the
Linux
kernel
package
and
the
user
-
level
package
,
respectively
.
'FILE.kd'
,
'FILE.ud'
....................
These
files
automatically
track
dependencies
for
'.ko'
objects
and
'.uo'
objects
,
respectively
.
GCC
generates
them
.
'elementmap-PACKAGENAME.xml'
............................
This
file
lists
the
elements
included
in
the
package
.
Tools
like
'click-check'
,
'click-devirtualize'
,
and
'click-undead'
look
for
your
package
's elementmap in order to determine the properties of your elements.
It is generated by '
click
-
mkelemmap
'.
build/configure.ac
0 → 100644
View file @
722c6733
dnl -*- mode: shell-script -*-
dnl 'configure.ac' file for a sample Click package
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
dnl to deal in the Software without restriction, subject to the conditions
dnl listed in the Click LICENSE file. These conditions include: you must
dnl preserve this copyright notice, and you cannot mention the copyright
dnl holders in advertising related to the Software without their permission.
dnl The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
dnl notice is a summary of the Click LICENSE file; the license in that file is
dnl legally binding.
AC_INIT(click-samplepackage, 2.0.1)
AC_SUBST(ac_configure_args)
CLICKPACKAGENAME=click_for_comnet
AC_SUBST(CLICKPACKAGENAME)
dnl
dnl locate Click install directory
dnl
AC_ARG_WITH(click, [ --with-click[[=DIR]] Click install path is DIR [[PREFIX]]],
[clickprefix=$withval; if test -z "$withval" -o "$withval" = yes; then clickprefix=$prefix; fi],
clickprefix=NONE)
dnl Preset $prefix and $exec_prefix.
test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
test "x$clickprefix" != xNONE -a "x$prefix" = xNONE && prefix="$clickprefix"
test "x$clickprefix" = xNONE && clickprefix="$prefix"
clickdatadir="${clickprefix}/share/click"
if test ! -r $clickdatadir/config.mk; then
AC_MSG_ERROR([
==============================================
'$clickdatadir/config.mk' not found.
Are you sure '$clickprefix' is a Click install directory?
==============================================])
fi
clickbuild_prefix="$clickprefix"
. $clickdatadir/config.mk
AC_SUBST(clickbuild_prefix)
AC_SUBST(clickbuild_datadir)
dnl
dnl build userlevel? Linux module? FreeBSD module?
dnl
onezero () {
{ [[ "$1" = yes ]] && echo 1; } || echo 0
}
AC_ARG_ENABLE(userlevel, [ --enable-userlevel enable user-level driver],
[BUILD_USERLEVEL=`onezero $enableval`],
[BUILD_USERLEVEL=$CLICK_HAVE_USERLEVEL_DRIVER])
AC_ARG_ENABLE(linuxmodule, [ --enable-linuxmodule enable Linux kernel driver],
[BUILD_LINUXMODULE=`onezero $enableval`],
[BUILD_LINUXMODULE=$CLICK_HAVE_LINUXMODULE_DRIVER])
AC_ARG_ENABLE(bsdmodule, [ --enable-bsdmodule enable FreeBSD kernel driver
[[Default drivers are those Click supports.]]],
[BUILD_BSDMODULE=`onezero $enableval`],
[BUILD_BSDMODULE=$CLICK_HAVE_BSDMODULE_DRIVER])
AC_SUBST(BUILD_USERLEVEL)
AC_SUBST(BUILD_LINUXMODULE)
AC_SUBST(BUILD_BSDMODULE)
dnl
dnl Output
dnl
AC_OUTPUT(Makefile)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment