summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile27
-rw-r--r--lib/conf-cc4
-rw-r--r--lib/conf-dyn4
-rw-r--r--lib/conf-ld5
-rw-r--r--lib/mylib.c7
-rw-r--r--lib/mylib.h8
6 files changed, 55 insertions, 0 deletions
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 <stdio.h>
+
+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 */