1
0

Add test_wrap.c

This commit is contained in:
2024-12-31 12:19:20 +01:00
parent ab0b73af5b
commit 8316726635
7 changed files with 131 additions and 15 deletions

View File

@@ -5,13 +5,16 @@ LDFLAGS=-lc
.PHONY: all clean
all: default
default: main test.so
default: main main_wrapped test_preload.so
test.so: src
$(CC) -shared -fPIC -o $@ $< $(CFLAGS) $(LDFLAGS)
test_preload.so: src/test_preload.c
$(CC) -shared -fPIC -o $@ $^ $(CFLAGS) $(LDFLAGS)
main: src
$(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
main: src/main.c
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
main_wrapped: src/main.c src/test_wrap.c
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS) -Wl,--wrap=malloc -Wl,--wrap=free -Wl,--wrap=calloc -Wl,--wrap=realloc -Wl,--wrap=getopt
clean:
rm -rf main test.so
rm -rf main test_preload.so main_wrapped