diff options
Diffstat (limited to 'example')
| -rw-r--r-- | example/libfib/Makefile | 12 | ||||
| -rw-r--r-- | example/libfib/fib.c | 11 | ||||
| -rw-r--r-- | example/libfib/fib.h | 9 | ||||
| -rw-r--r-- | example/libfib/fib.o | bin | 0 -> 640 bytes | |||
| -rw-r--r-- | example/libfib/libfib.a | bin | 0 -> 824 bytes | |||
| -rwxr-xr-x | example/libfib/libfib.so.1.1 | bin | 0 -> 16784 bytes | |||
| -rw-r--r-- | example/test/Makefile | 13 | ||||
| -rw-r--r-- | example/test/main.c | 8 | ||||
| l--------- | example/tools | 1 |
9 files changed, 54 insertions, 0 deletions
diff --git a/example/libfib/Makefile b/example/libfib/Makefile new file mode 100644 index 0000000..c610923 --- /dev/null +++ b/example/libfib/Makefile @@ -0,0 +1,12 @@ +LIB = fib +SHLIB_MAJOR = 1 +SHLIB_MINOR = 1 +CFLAGS = -Wall \ + -Werror \ + -Wextra \ + -Wpedantic \ + -std=c17 +SRCS = fib.c + +include ../tools/mcd.lib.mk + diff --git a/example/libfib/fib.c b/example/libfib/fib.c new file mode 100644 index 0000000..707215d --- /dev/null +++ b/example/libfib/fib.c @@ -0,0 +1,11 @@ +#include "fib.h" + +uint64_t fib(const uint64_t n) { + if (n <= 0) { + return 0; + } else if (n == 1) { + return 1; + } + return (fib(n - 1) + fib(n - 2)); +} + diff --git a/example/libfib/fib.h b/example/libfib/fib.h new file mode 100644 index 0000000..66615c5 --- /dev/null +++ b/example/libfib/fib.h @@ -0,0 +1,9 @@ +#ifndef FIB_H_ +#define FIB_H_ + +#include <stdint.h> + +uint64_t fib(uint64_t); + +#endif // FIB_H_ + diff --git a/example/libfib/fib.o b/example/libfib/fib.o Binary files differnew file mode 100644 index 0000000..9380b6f --- /dev/null +++ b/example/libfib/fib.o diff --git a/example/libfib/libfib.a b/example/libfib/libfib.a Binary files differnew file mode 100644 index 0000000..1fe78c4 --- /dev/null +++ b/example/libfib/libfib.a diff --git a/example/libfib/libfib.so.1.1 b/example/libfib/libfib.so.1.1 Binary files differnew file mode 100755 index 0000000..2ed114c --- /dev/null +++ b/example/libfib/libfib.so.1.1 diff --git a/example/test/Makefile b/example/test/Makefile new file mode 100644 index 0000000..5b29575 --- /dev/null +++ b/example/test/Makefile @@ -0,0 +1,13 @@ +PROG = main +SRCS = main.c +CFLAGS = -Wall \ + -Werror \ + -Wextra \ + -Wpedantic \ + -I../libfib \ + -std=c17 +LDFLAGS = -L../libfib \ + -lfib + +include ../tools/mcd.prog.mk + diff --git a/example/test/main.c b/example/test/main.c new file mode 100644 index 0000000..9580704 --- /dev/null +++ b/example/test/main.c @@ -0,0 +1,8 @@ +#include <stdio.h> +#include "fib.h" + +int main(void) { + printf("fib(9) = %llu\n", fib(9)); + return 0; +} + diff --git a/example/tools b/example/tools new file mode 120000 index 0000000..add5f73 --- /dev/null +++ b/example/tools @@ -0,0 +1 @@ +../mk
\ No newline at end of file |
