From 09397c778731916891d660ac4ebbb6f3ac5a15fb Mon Sep 17 00:00:00 2001 From: Jérémy Zurcher Date: Mon, 6 Jan 2014 15:39:05 +0100 Subject: Initial commit --- lib/Makefile | 27 +++++++++++++++++++++++++++ lib/conf-cc | 4 ++++ lib/conf-dyn | 4 ++++ lib/conf-ld | 5 +++++ lib/mylib.c | 7 +++++++ lib/mylib.h | 8 ++++++++ 6 files changed, 55 insertions(+) create mode 100644 lib/Makefile create mode 100644 lib/conf-cc create mode 100644 lib/conf-dyn create mode 100644 lib/conf-ld create mode 100644 lib/mylib.c create mode 100644 lib/mylib.h (limited to 'lib') diff --git a/lib/Makefile b/lib/Makefile new file mode 100644 index 0000000..93c98d9 --- /dev/null +++ b/lib/Makefile @@ -0,0 +1,27 @@ +DIR=.. + +include ${DIR}/Makefile_base + +mylib.o : compile mylib.c mylib.h + @./compile mylib.c + +libtest.so : load mylib.o + @./load d libtest.so mylib.o + +# HIGH LEVEL SPECIFIC TARGETS + +SUBDIR= + +arch: buildarch + -@./buildarch ${SUBDIR} + +build: libtest.so + +doc : doxy_conf + @echo -e "$(CYAN)calling doxygen$(NORM)" + @doxygen doxy_conf + @echo -e "$(CYAN)done.$(NORM)" + +clean: cleanstd + @if [ -f main ] ; then rm main; fi + diff --git a/lib/conf-cc b/lib/conf-cc new file mode 100644 index 0000000..6f289e7 --- /dev/null +++ b/lib/conf-cc @@ -0,0 +1,4 @@ +gcc -O2 -Wall -fPIC -ansi -pedantic-errors -fomit-frame-pointer -D_GNU_SOURCE + + -fpic generate faster and smaller code, but has platform-dependent limitations and may not work +This will be used to compile .c files. diff --git a/lib/conf-dyn b/lib/conf-dyn new file mode 100644 index 0000000..6f289e7 --- /dev/null +++ b/lib/conf-dyn @@ -0,0 +1,4 @@ +gcc -O2 -Wall -fPIC -ansi -pedantic-errors -fomit-frame-pointer -D_GNU_SOURCE + + -fpic generate faster and smaller code, but has platform-dependent limitations and may not work +This will be used to compile .c files. diff --git a/lib/conf-ld b/lib/conf-ld new file mode 100644 index 0000000..2694d12 --- /dev/null +++ b/lib/conf-ld @@ -0,0 +1,5 @@ +gcc -s -shared -Wl,-soname, + +you may need to use -Wl,export-dynamic for reverse dependencies +remember to use -Wl,-rpath for library client program during developement +This will be used to link .o files into an executable. diff --git a/lib/mylib.c b/lib/mylib.c new file mode 100644 index 0000000..1b37e23 --- /dev/null +++ b/lib/mylib.c @@ -0,0 +1,7 @@ +#include "mylib.h" +#include + +void mylib() +{ + printf("hello world from a shared library.\n"); +} diff --git a/lib/mylib.h b/lib/mylib.h new file mode 100644 index 0000000..14b39a2 --- /dev/null +++ b/lib/mylib.h @@ -0,0 +1,8 @@ +#ifndef __MYLIB_H +#define __MYLIB_H + +#define MY_FLAG 3.1415926 + +void mylib(); + +#endif /* __MYLIB_H */ -- cgit v1.2.3