proj: Restructure
This commit is contained in:
28
proj/intercept/Makefile
Normal file
28
proj/intercept/Makefile
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-std=c99 -pedantic -Wall -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_POSIX_C_SOURCE=200809L -g
|
||||
|
||||
.PHONY: all clean
|
||||
all: default
|
||||
default: bin intercept.so main_intercept
|
||||
|
||||
bin:
|
||||
mkdir -p bin/
|
||||
|
||||
bin/main.o: ../test1/src/main.c
|
||||
$(CC) -c -o $@ $^ $(CFLAGS)
|
||||
|
||||
bin/intercept_preload.o: src/intercept.c
|
||||
$(CC) -fPIC -c -o $@ $^ $(CFLAGS) -DINTERCEPT_PRELOAD
|
||||
|
||||
intercept.so: bin/intercept_preload.o
|
||||
$(CC) -shared -o $@ $^ $(CFLAGS) -lc -ldl
|
||||
|
||||
main_intercept: bin/main.o src/intercept.c
|
||||
$(CC) -o $@ $^ $(CFLAGS) -lc -Wl,--wrap=malloc,--wrap=free,--wrap=calloc,--wrap=realloc,--wrap=reallocarray,--wrap=getopt,--wrap=exit,--wrap=close,--wrap=sigaction,\
|
||||
--wrap=sem_init,--wrap=sem_open,--wrap=sem_post,--wrap=sem_wait,--wrap=sem_trywait,--wrap=sem_timedwait,--wrap=sem_getvalue,--wrap=sem_close,--wrap=sem_unlink,--wrap=sem_destroy,\
|
||||
--wrap=shm_open,--wrap=shm_unlink,--wrap=mmap,--wrap=munmap,\
|
||||
--wrap=ftruncate
|
||||
|
||||
clean:
|
||||
rm -rf main_intercept bin/* *.so *.ko *.o
|
||||
Reference in New Issue
Block a user