Skip to content

Commit 4ec8495

Browse files
committed
bbexample: Initial commit of example Yocto autotooled recipe, building an executable with a depdency on a shared library
Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk>
1 parent 79b4683 commit 4ec8495

File tree

7 files changed

+110
-1
lines changed

7 files changed

+110
-1
lines changed

Makefile.am

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
AUTOMAKE_OPTIONS = foreign
2+
3+
CFLAGS = -Wall -pedantic
4+
include_HEADERS = bbexample.h
5+
6+
lib_LTLIBRARIES = libbbexample.la
7+
libbbexample_la_SOURCES = bbexamplelib.c
8+
libbbexample_la_LDFLAGS= -version-info 1:0:0
9+
10+
bin_PROGRAMS = bbexample
11+
bbexample_SOURCES = bbexample.c
12+
bbexample_LDADD = .libs/libbbexample.la

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
bb-example
22
==========
33

4-
Yocto example recipe
4+
Example Yocto/OpenEmbedded autotooled recipe, building an executable with a depdency on a shared library
5+

autogen.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
echo "Generating configure files... may take a while."
4+
5+
autoreconf --install --force && \
6+
echo "Preparing was successful if there was no error messages above." && \
7+
echo "Now type:" && \
8+
echo " ./configure && make" && \
9+
echo "Run './configure --help' for more information"

bbexample.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include <stdio.h>
4+
#include <stdlib.h>
5+
#include <stdint.h>
6+
#include <string.h>
7+
#include <unistd.h>
8+
9+
#include "bbexample.h"
10+
11+
int main(int argc, char *argv[])
12+
{
13+
printf("Hello Yocto World...\n");
14+
15+
LibHelloWorld();
16+
17+
return 0;
18+
}
19+
20+
21+
22+
23+

bbexample.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef BB_EXAMPLE_H
2+
#define BB_EXAMPLE_H
3+
4+
/* Some cross-platform definitions generated by autotools */
5+
#if HAVE_CONFIG_H
6+
# include <config.h>
7+
#endif /* HAVE_CONFIG_H */
8+
9+
/*
10+
* Example function
11+
*/
12+
extern void LibHelloWorld(void);
13+
14+
#endif /* BB_EXAMPLE_H */

bbexamplelib.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <stdlib.h>
2+
#include <stdio.h>
3+
#include <stdint.h>
4+
#include <string.h>
5+
#include <unistd.h>
6+
#include <errno.h>
7+
#include <string.h>
8+
#include <unistd.h>
9+
#include <linux/i2c-dev.h>
10+
#include <sys/ioctl.h>
11+
#include <sys/types.h>
12+
#include <sys/stat.h>
13+
#include <fcntl.h>
14+
15+
#include "bbexample.h"
16+
17+
void LibHelloWorld()
18+
{
19+
printf("Hello World (from a shared library!)\n");
20+
}

configure.ac

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# -*- Autoconf -*-
2+
# Process this file with autoconf to produce a configure script.
3+
4+
#AC_PREREQ(2.60)
5+
AC_INIT(bbexample, 0.1, ajlennon@dynamicdevices.co.uk)
6+
AC_CONFIG_SRCDIR([bbexample.c])
7+
AC_CONFIG_HEADER([config.h])
8+
AM_INIT_AUTOMAKE(bbexample, main)
9+
10+
# Checks for programs.
11+
AC_PROG_CC
12+
AC_PROG_INSTALL
13+
AC_PROG_MAKE_SET
14+
15+
# Checks for libraries.
16+
AM_PROG_LIBTOOL
17+
18+
# Set shared libraries
19+
AC_DISABLE_STATIC
20+
AC_ENABLE_SHARED
21+
22+
# Checks for header files.
23+
24+
# Checks for typedefs, structures, and compiler characteristics.
25+
26+
# Checks for library functions.
27+
28+
#AC_CONFIG_MACRO_DIR([m4])
29+
AC_CONFIG_FILES([Makefile])
30+
AC_OUTPUT

0 commit comments

Comments
 (0)