diff options
-rw-r--r-- | example/Makefile | 20 | ||||
-rw-r--r-- | example/Makefile.config | 4 | ||||
-rw-r--r-- | example/libfoo.pc.in | 10 | ||||
-rw-r--r-- | example/src1/Makefile | 7 | ||||
-rw-r--r-- | example/src1/foo.c | 7 | ||||
-rw-r--r-- | example/src1/foo.h | 6 | ||||
-rw-r--r-- | example/src2/Makefile | 4 | ||||
-rw-r--r-- | example/src2/bar.c | 5 | ||||
-rw-r--r-- | example/test/Makefile | 4 | ||||
-rw-r--r-- | example/test/foo.c | 12 | ||||
-rw-r--r-- | example/test2/Makefile | 4 | ||||
-rw-r--r-- | example/test2/foo.c | 12 |
12 files changed, 95 insertions, 0 deletions
diff --git a/example/Makefile b/example/Makefile new file mode 100644 index 0000000..ed757c7 --- /dev/null +++ b/example/Makefile @@ -0,0 +1,20 @@ +# Define the component name +COMPONENT := foo +# And the component type +COMPONENT_TYPE := lib-static +# Set the executable extension +EXEEXT := +# And the library extension +LIBEXT := .a +# Define our target platform +TARGET := linux + +# We're using a modern GCC, so can compile and generate dependencies together +CC_CAN_BUILD_AND_DEP := yes + +# Grab the core makefile +include build/makefiles/Makefile.top + +# Add extra install rules for our pkg-config control file and the library itself +INSTALL_ITEMS := $(INSTALL_ITEMS) /lib/pkgconfig:lib$(COMPONENT).pc.in +INSTALL_ITEMS := $(INSTALL_ITEMS) /lib:$(BUILDDIR)/lib$(COMPONENT)$(LIBEXT) diff --git a/example/Makefile.config b/example/Makefile.config new file mode 100644 index 0000000..ffec918 --- /dev/null +++ b/example/Makefile.config @@ -0,0 +1,4 @@ +# Configuration makefile fragment + +# Local configuration changes +-include Makefile.config.override diff --git a/example/libfoo.pc.in b/example/libfoo.pc.in new file mode 100644 index 0000000..eab313b --- /dev/null +++ b/example/libfoo.pc.in @@ -0,0 +1,10 @@ +prefix=PREFIX +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libfoo +Description: Pointless example library +Version: 0.0.1 +Libs: -L${libdir} +Cflags: -I${includedir} diff --git a/example/src1/Makefile b/example/src1/Makefile new file mode 100644 index 0000000..f986d31 --- /dev/null +++ b/example/src1/Makefile @@ -0,0 +1,7 @@ +# Sources in this directory +DIR_SOURCES := foo.c +# Items to install from this directory +DIR_INSTALL_ITEMS := /include:foo.h + +# Grab the core makefile +include build/makefiles/Makefile.subdir diff --git a/example/src1/foo.c b/example/src1/foo.c new file mode 100644 index 0000000..7c9cb25 --- /dev/null +++ b/example/src1/foo.c @@ -0,0 +1,7 @@ +#include "foo.h" + +int foo(void) +{ + return -1; +} + diff --git a/example/src1/foo.h b/example/src1/foo.h new file mode 100644 index 0000000..5deb13c --- /dev/null +++ b/example/src1/foo.h @@ -0,0 +1,6 @@ +#ifndef foo_h_ +#define foo_h_ + +extern int foo(void); + +#endif diff --git a/example/src2/Makefile b/example/src2/Makefile new file mode 100644 index 0000000..2fc4c9e --- /dev/null +++ b/example/src2/Makefile @@ -0,0 +1,4 @@ +# Sources in this directory +DIR_SOURCES := bar.c + +include build/makefiles/Makefile.subdir diff --git a/example/src2/bar.c b/example/src2/bar.c new file mode 100644 index 0000000..9160a87 --- /dev/null +++ b/example/src2/bar.c @@ -0,0 +1,5 @@ +extern int bar(void) +{ + return -1; +} + diff --git a/example/test/Makefile b/example/test/Makefile new file mode 100644 index 0000000..a91e328 --- /dev/null +++ b/example/test/Makefile @@ -0,0 +1,4 @@ +# Test sources in this directory +DIR_TEST_SOURCES := foo.c + +include build/makefiles/Makefile.subdir diff --git a/example/test/foo.c b/example/test/foo.c new file mode 100644 index 0000000..c12a44f --- /dev/null +++ b/example/test/foo.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +#include "foo.h" + +int main(void) +{ + foo(); + + printf("PASS\n"); + + return 0; +} diff --git a/example/test2/Makefile b/example/test2/Makefile new file mode 100644 index 0000000..a91e328 --- /dev/null +++ b/example/test2/Makefile @@ -0,0 +1,4 @@ +# Test sources in this directory +DIR_TEST_SOURCES := foo.c + +include build/makefiles/Makefile.subdir diff --git a/example/test2/foo.c b/example/test2/foo.c new file mode 100644 index 0000000..c12a44f --- /dev/null +++ b/example/test2/foo.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +#include "foo.h" + +int main(void) +{ + foo(); + + printf("PASS\n"); + + return 0; +} |