diff options
Diffstat (limited to 'kBuild/doc/example1')
-rw-r--r-- | kBuild/doc/example1/Config.kmk | 25 | ||||
-rw-r--r-- | kBuild/doc/example1/Makefile.kmk | 43 | ||||
-rw-r--r-- | kBuild/doc/example1/hello.c | 21 | ||||
-rw-r--r-- | kBuild/doc/example1/hellolib.c | 20 | ||||
-rw-r--r-- | kBuild/doc/example1/libhello/Makefile.kmk | 30 | ||||
-rw-r--r-- | kBuild/doc/example1/libhello/libhello.c | 24 |
6 files changed, 163 insertions, 0 deletions
diff --git a/kBuild/doc/example1/Config.kmk b/kBuild/doc/example1/Config.kmk new file mode 100644 index 0000000..31eeb84 --- /dev/null +++ b/kBuild/doc/example1/Config.kmk @@ -0,0 +1,25 @@ +# $Id: Config.kmk 2343 2009-04-19 21:44:50Z bird $ +## @file +# kBuild Example no. 1 - Config.kmk - The global configuration file. +# + +# +# The author disclaims copyright to this example script and places +# it in the public domain. +# +# include full-legal-disclaimer.kmk +# + +# +# Some templates. +# +TEMPLATE_ExampleNo1Exe = For creating a program or static library for linking into a program. +TEMPLATE_ExampleNo1Exe_TOOL = GCC +TEMPLATE_ExampleNo1Exe_DEFS = MY_DEFINE=42 MY_OTHER_DEFINE + +TEMPLATE_ExampleNo1Dll = For creating a DLL/SO/DYLIB or static library for linking into a DLL/SO/DYLIB +TEMPLATE_ExampleNo1Dll_EXTENDS = ExampleNo1Exe +TEMPLATE_ExampleNo1Dll_EXTENDS_BY = appending +TEMPLATE_ExampleNo1Dll_DEFS = MY_DLL_INDICATOR + + diff --git a/kBuild/doc/example1/Makefile.kmk b/kBuild/doc/example1/Makefile.kmk new file mode 100644 index 0000000..ecb9350 --- /dev/null +++ b/kBuild/doc/example1/Makefile.kmk @@ -0,0 +1,43 @@ +# $Id: Makefile.kmk 2343 2009-04-19 21:44:50Z bird $ +## @file +# kBuild Example no. 1 - Makefile.kmk - The top-level makefile. +# + +# +# The author disclaims copyright to this example script and places +# it in the public domain. +# +# include full-legal-disclaimer.kmk +# + +SUB_DEPTH = . +include $(KBUILD_PATH)/subheader.kmk + +# +# Include sub-makefiles. +# +include $(PATH_CURRENT)/libhello/Makefile.kmk + +# +# The targets. +# +PROGRAMS += \ + hello \ + hellolib + +# +# Hello world program. +# +hello_TEMPLATE = ExampleNo1Exe +hello_SOURCES = hello.c + +# +# A hello world variant that has some of the code in the libhello directory, +# i.e. linking with a library built by the sub-makefile included above. +# +hellolib_TEMPLATE = ExampleNo1Exe +hellolib_SOURCES = hellolib.c +hellolib_LIBS = $(libhello_1_TARGET) + +include $(FILE_KBUILD_SUB_FOOTER) + diff --git a/kBuild/doc/example1/hello.c b/kBuild/doc/example1/hello.c new file mode 100644 index 0000000..71f37fe --- /dev/null +++ b/kBuild/doc/example1/hello.c @@ -0,0 +1,21 @@ +/* $Id: hello.c 2343 2009-04-19 21:44:50Z bird $ */ +/** @file + * Example no. 1 - hello.c - Hello world program. + */ + +/* + * The author disclaims copyright to this example code and places + * it in the public domain. + * + * #include <full-legal-disclaimer.h> + * + */ + +#include <stdio.h> + +int main() +{ + printf("Hello world!\n"); + return 0; +} + diff --git a/kBuild/doc/example1/hellolib.c b/kBuild/doc/example1/hellolib.c new file mode 100644 index 0000000..feff4c6 --- /dev/null +++ b/kBuild/doc/example1/hellolib.c @@ -0,0 +1,20 @@ +/* $Id: hellolib.c 2343 2009-04-19 21:44:50Z bird $ */ +/** @file + * Example no. 1 - hellolib.c - Hello world program w/ lib. + */ + +/* + * The author disclaims copyright to this example code and places + * it in the public domain. + * + * #include <full-legal-disclaimer.h> + * + */ + +extern int print_hello_world(void); + +int main() +{ + return print_hello_world(); +} + diff --git a/kBuild/doc/example1/libhello/Makefile.kmk b/kBuild/doc/example1/libhello/Makefile.kmk new file mode 100644 index 0000000..674c8b3 --- /dev/null +++ b/kBuild/doc/example1/libhello/Makefile.kmk @@ -0,0 +1,30 @@ +# $Id: Makefile.kmk 2343 2009-04-19 21:44:50Z bird $ +## @file +# kBuild Example no. 1 - libhello/Makefile.kmk - The libhello sub-makefile. +# + +# +# The author disclaims copyright to this example script and places +# it in the public domain. +# +# include full-legal-disclaimer.kmk +# + +SUB_DEPTH = .. +include $(KBUILD_PATH)/subheader.kmk + +# +# The targets. +# +LIBRARIES += libhello + +# +# The hello world library. +# +libhello_TEMPLATE = ExampleNo1Exe +libhello_SOURCES = libhello.c + +## @todo Create a DLL variant. + +include $(FILE_KBUILD_SUB_FOOTER) + diff --git a/kBuild/doc/example1/libhello/libhello.c b/kBuild/doc/example1/libhello/libhello.c new file mode 100644 index 0000000..5a9024d --- /dev/null +++ b/kBuild/doc/example1/libhello/libhello.c @@ -0,0 +1,24 @@ +/* $Id: libhello.c 2343 2009-04-19 21:44:50Z bird $ */ +/** @file + * Example no. 1 - libhello.c - Hello world library. + */ + +/* + * The author disclaims copyright to this example code and places + * it in the public domain. + * + * #include <full-legal-disclaimer.h> + * + */ + +#include <stdio.h> + +extern int print_hello_world(void); + +int print_hello_world(void) +{ + printf("Hello library world!\n"); + return 0; +} + + |