proj: Restructure
This commit is contained in:
@@ -4,7 +4,7 @@ CFLAGS=-std=c99 -pedantic -Wall -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -
|
||||
|
||||
.PHONY: all clean
|
||||
all: default
|
||||
default: bin main intercept.so main_intercept #test_kernel.ko
|
||||
default: bin main
|
||||
|
||||
bin:
|
||||
mkdir -p bin/
|
||||
@@ -12,26 +12,14 @@ bin:
|
||||
bin/main.o: 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
|
||||
|
||||
test_kernel.ko: src/test_kernel.c
|
||||
$(CC) -D__KERNEL__ -DMODULE -I/usr/src/linux/include -o $@ $^
|
||||
|
||||
main: bin/main.o
|
||||
$(CC) -o $@ $^ $(CFLAGS) -lc -lpthread
|
||||
|
||||
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 main_wrapped bin/* *.so *.ko *.o
|
||||
rm -rf main bin/* *.so *.ko *.o
|
||||
|
||||
|
||||
#ifneq ($(KERNELRELEASE),)
|
||||
|
||||
Reference in New Issue
Block a user