Initial import.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 18 Oct 2012 09:29:15 +0000 (11:29 +0200)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 18 Oct 2012 09:29:15 +0000 (11:29 +0200)
Makefile [new file with mode: 0644]
module.c [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..01ae45a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,40 @@
+CC=gcc
+COMPILE=libtool --mode=compile $(CC) $(CFLAGS) $(CPPFLAGS)
+LINK=libtool --mode=link $(CC) $(LDFLAGS)
+
+MAJOR=2
+MINOR=4
+REVISION=6
+OFFSET=0
+LT_CURRENT=$(shell let a=$(MAJOR)+$(MINOR); echo $$a)
+LT_AGE=$(MINOR)
+LT_REVISION=$(REVISION)
+LT_MAJ=$(shell let a=$(MAJOR)+$(OFFSET); echo $$a)
+LT_VER=$(LT_MAJ).$(LT_AGE).$(LT_REVISION)
+
+lib=libtest.la
+
+all: libtool
+
+libtool: libtest.la
+
+raw: libtest.so
+
+clean:
+       rm -rfv .libs
+       rm -fv *.so *.so.* *.o *.la *.lo
+
+libtest.la: module.lo
+       $(LINK) -shared -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -rpath /usr/lib $< -o $@
+
+libtest.so: module.o
+       $(CC) $(LDFLAGS) -shared -fPIC -DPIC -Wl,-soname -Wl,libtest.so.$(LT_MAJ) $< -o $@.$(LT_VER)
+       ln -s $@.$(LT_VER) $@
+
+%.lo: %.c
+       $(COMPILE) -c $<
+
+.c.o: %.o: %c
+       $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -DPIC -c $<
+
+.PHONY: all libtool raw clean
diff --git a/module.c b/module.c
new file mode 100644 (file)
index 0000000..e300c67
--- /dev/null
+++ b/module.c
@@ -0,0 +1,3 @@
+int func1() {
+       return 1;
+}