diff options
Diffstat (limited to 'doc/examples/strict-mode/files')
-rw-r--r-- | doc/examples/strict-mode/files/hello/Makefile.dynamic | 12 | ||||
-rw-r--r-- | doc/examples/strict-mode/files/hello/Makefile.static | 12 | ||||
-rw-r--r-- | doc/examples/strict-mode/files/hello/hello.c | 20 | ||||
-rw-r--r-- | doc/examples/strict-mode/files/libhello/Makefile | 21 | ||||
-rw-r--r-- | doc/examples/strict-mode/files/libhello/libhello.c | 9 | ||||
-rw-r--r-- | doc/examples/strict-mode/files/libhello/libhello.h | 8 |
6 files changed, 82 insertions, 0 deletions
diff --git a/doc/examples/strict-mode/files/hello/Makefile.dynamic b/doc/examples/strict-mode/files/hello/Makefile.dynamic new file mode 100644 index 000000000..52b0f72cd --- /dev/null +++ b/doc/examples/strict-mode/files/hello/Makefile.dynamic @@ -0,0 +1,12 @@ +# Sample makefile for hello.c +# +.PHONY: all install + +all: hello + +install: all + install -d ${DESTDIR}${PREFIX}/bin + install -m 755 hello ${DESTDIR}${PREFIX}/bin + +hello: hello.c + $(CC) -Wall -o $@ $< -lhello diff --git a/doc/examples/strict-mode/files/hello/Makefile.static b/doc/examples/strict-mode/files/hello/Makefile.static new file mode 100644 index 000000000..87fb51206 --- /dev/null +++ b/doc/examples/strict-mode/files/hello/Makefile.static @@ -0,0 +1,12 @@ +# Sample makefile for hello.c +# +.PHONY: all install + +all: hello + +install: all + install -d ${DESTDIR}${PREFIX}/bin + install -m 755 hello ${DESTDIR}${PREFIX}/bin + +hello: hello.c + $(CC) -Wall -o $@ $< /usr/lib/libhello.a diff --git a/doc/examples/strict-mode/files/hello/hello.c b/doc/examples/strict-mode/files/hello/hello.c new file mode 100644 index 000000000..83e762c29 --- /dev/null +++ b/doc/examples/strict-mode/files/hello/hello.c @@ -0,0 +1,20 @@ +/* + * hello.c - Simple hello program + */ +#include <stdio.h> +#include <libhello.h> + +int main(int argc, char *argv[]) +{ + const char *person = NULL; + + if (argc > 1) + person = argv[1]; + + if (person) + hello(person); + else + hello("stranger"); + + return 0; +} diff --git a/doc/examples/strict-mode/files/libhello/Makefile b/doc/examples/strict-mode/files/libhello/Makefile new file mode 100644 index 000000000..cdc20a30a --- /dev/null +++ b/doc/examples/strict-mode/files/libhello/Makefile @@ -0,0 +1,21 @@ +# Sample makefile for hello library +# +.PHONY: all install + +all: libhello.so libhello.a + +install: all + install -d ${DESTDIR}${PREFIX}/lib + install -d ${DESTDIR}${PREFIX}/include + install -m 644 libhello.so ${DESTDIR}${PREFIX}/lib + install -m 644 libhello.a ${DESTDIR}${PREFIX}/lib + install -m 644 libhello.h ${DESTDIR}${PREFIX}/include + +%.o: %.c %.h + $(CC) -c $< -o $@ -Wall + +libhello.a: libhello.o + $(AR) rcs $@ $^ + +libhello.so: libhello.o + $(CC) -shared -o $@ $< diff --git a/doc/examples/strict-mode/files/libhello/libhello.c b/doc/examples/strict-mode/files/libhello/libhello.c new file mode 100644 index 000000000..7d0eca340 --- /dev/null +++ b/doc/examples/strict-mode/files/libhello/libhello.c @@ -0,0 +1,9 @@ +/* + * libhello.c - The hello library + */ +#include <stdio.h> + +void hello(const char *person) +{ + printf("Good morning %s\n", person); +} diff --git a/doc/examples/strict-mode/files/libhello/libhello.h b/doc/examples/strict-mode/files/libhello/libhello.h new file mode 100644 index 000000000..f714f3659 --- /dev/null +++ b/doc/examples/strict-mode/files/libhello/libhello.h @@ -0,0 +1,8 @@ +/* + * libhello.h - The hello library + */ + +/* + * A function to say hello to @person + */ +void hello(const char *person); |