Revision 8c400302

View differences:

custompackages/hello-boost-lambda/Makefile
1
##############################################
2
# OpenWrt Makefile for hello-boost-lambda program
3
#
4
#
5
# Most of the variables used here are defined in
6
# the include directives below. We just need to
7
# specify a basic description of the package,
8
# where to build our program, where to find
9
# the source files, and where to install the
10
# compiled program on the router.
11
#
12
# Be very careful of spacing in this file.
13
# Indents should be tabs, not spaces, and
14
# there should be no trailing whitespace in
15
# lines that are not commented.
16
#
17
##############################################
18

  
19
include $(TOPDIR)/rules.mk
20

  
21
# Name and release number of this package
22
PKG_NAME:=hello-boost-lambda
23
PKG_RELEASE:=1
24

  
25
# This specifies the directory where we're going to build the program.
26
# The root build directory, $(BUILD_DIR), is by default the build_mipsel
27
# directory in your OpenWrt SDK directory
28
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
29

  
30

  
31
include $(INCLUDE_DIR)/package.mk
32

  
33

  
34
# Specify package information for this program.
35
# The variables defined here should be self explanatory.
36
define Package/hello-boost-lambda
37
	SECTION:=utils
38
	CATEGORY:=Utilities
39
	TITLE:=LibBoost Testing with Dynamic Linking-- multiply number by 3
40
	MAINTAINER:=Quynh Nguyen <quynh.xq@gmail.com>
41
	DEPENDS:=+libstdcpp +boost
42
endef
43

  
44
define Package/hello-boost-lambda/description
45
	A simple program to test one part of Boost library,
46
	more specifically, this execute the boost/lambda, with dynamic linking
47
endef
48

  
49
# Specify what needs to be done to prepare for building the package.
50
# In our case, we need to copy the source files to the build directory.
51
# This is NOT the default.  The default uses the PKG_SOURCE_URL and the
52
# PKG_SOURCE which is not defined here to download the source from the web.
53
# In order to just build a simple program that we have just written, it is
54
# much easier to do it this way.
55
define Build/Prepare
56
	mkdir -p $(PKG_BUILD_DIR)
57
	$(CP) ./src/* $(PKG_BUILD_DIR)/
58
endef
59

  
60

  
61
# We do not need to define Build/Configure or Build/Compile directives
62
# The defaults are appropriate for compiling a simple program such as this one
63

  
64

  
65
# Specify where and how to install the program. Since we only have one file,
66
# the hello-boost-lambda executable, install it by copying it to the /bin directory on
67
# the router. The $(1) variable represents the root directory on the router running
68
# OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare the install
69
# directory if it does not already exist.  Likewise $(INSTALL_BIN) contains the
70
# command to copy the binary file from its current location (in our case the build
71
# directory) to the install directory.
72
define Package/hello-boost-lambda/install
73
	$(INSTALL_DIR) $(1)/bin
74
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/hello-boost-lambda $(1)/bin/
75
endef
76

  
77

  
78
# This line executes the necessary commands to compile our program.
79
# The above define directives specify all the information needed, but this
80
# line calls BuildPackage which in turn actually uses this information to
81
# build a package.
82
$(eval $(call BuildPackage,hello-boost-lambda))
custompackages/hello-boost-lambda/src/Makefile
1
##############################################
2
# Makefile for hello-boost-lambda program
3
##############################################
4

  
5
hello-boost-lambda: hello-boost-lambda.o
6
	$(CXX) $(LDFLAGS) hello-boost-lambda.o -o hello-boost-lambda $(LIBS)
7

  
8
hello-boost-lambda.o: hello-boost-lambda.cpp
9
	$(CXX) $(CXXFLAGS) -c hello-boost-lambda.cpp
10

  
11
# remove object files and executable when user executes "make clean"
12
clean:
13
	rm *.o hello-boost-lambda
custompackages/hello-boost-lambda/src/hello-boost-lambda.cpp
1
// http://www.boost.org/doc/libs/1_59_0/more/getting_started/unix-variants.html
2

  
3
#include <boost/lambda/lambda.hpp>
4
#include <iostream>
5
#include <iterator>
6
#include <algorithm>
7

  
8
int main()
9
{
10
    using namespace boost::lambda;
11
    typedef std::istream_iterator<int> in;
12

  
13
    std::for_each(
14
        in(std::cin), in(), std::cout << (_1 * 10) << " " );
15
}

Also available in: Unified diff