summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authoreroen2015-07-10 22:59:24 +0200
committereroen2015-07-10 22:59:24 +0200
commit1ff4e0626696cce79347cea1f8af03ff0df5c3fd (patch)
tree434448c9801009a8365e67a3130571042468c3f2 /Makefile
downloaddynsymlink-1ff4e0626696cce79347cea1f8af03ff0df5c3fd.tar.gz
dynsymlink-1ff4e0626696cce79347cea1f8af03ff0df5c3fd.tar.bz2
dynsymlink-1ff4e0626696cce79347cea1f8af03ff0df5c3fd.tar.xz
Simple LD_PRELOAD demo
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile29
1 files changed, 29 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..433667c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,29 @@
+all: libdynsymlink.so
+PHONY: all
+
+libdynsymlink.so: libdynsymlink.o
+ clang -o libdynsymlink.so --shared libdynsymlink.o -ldl
+
+test1: test1.o libdynsymlink.so
+ clang -o test1 test1.o libdynsymlink.so
+
+test2: test2.o
+ clang -o test2 test2.o
+
+libdynsymlink.o: libdynsymlink.c
+ clang -o libdynsymlink.o -fPIC -c libdynsymlink.c
+
+test1.o: test1.c
+ clang -o test1.o -c test1.c
+
+test2.o: test2.c
+ clang -o test2.o -c test2.c
+
+check: test1 test2 libdynsymlink.so
+ LD_LIBRARY_PATH=. ./test1
+ LD_PRELOAD=./libdynsymlink.so ./test2
+PHONY: check
+
+clean:
+ +rm -f test1 test2 test1.o test2.o libdynsymlink.so libdynsymlink.o
+PHONY: clean