run script should use the loader
[ldtrace] / Makefile
1 CFLAGS=-std=c99 -Os -g
2 #CFLAGS+=-fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables
3 LDFLAGS=-g
4 CC=musl-gcc
5 all: wrap.so hello stress wrapasm.so
6 hello: hello.o
7 stress: stress.o
8 wrap.o: head.h func.h
9 wrap.so: wrap.o
10         $(CC) $(LDFLAGS) -shared -o $@ $< -ldl -lm -lrt -lpthread -lutil -lcrypt
11 func.s: funcnames
12         ./genasm.sh <$< >$@
13 func.o: func.s
14 wrapasm.so: func.o wrap_help.o
15         $(CC) $(LDFLAGS) -shared -o $@ $^ -ldl -lm -lrt -lpthread -lutil -lcrypt
16 clean:
17         rm -f wrap.so hello stress *.o wrapasm.so
18 test: all
19         LD_PRELOAD=./wrap.so ./hello
20         LD_PRELOAD=./wrap.so ./stress 2>&1 |wc -l