shm implemented as memfd syscall
cheliequan
2022-12-08 7e877be8fb34ab99421a2eaf3d8fb1b96ed95206
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
CC=gcc
AR=ar
CFLAGS=-g -D __SHMT_DEBUG_MODE__=1 -Wall  -I${INCLUDE}  
INCLUDE=-I. -I ../include
all:shmht shmht_mytests
    gcc -g -c -Wall -Werror -I${INCLUDE} -fpic list_in_shm.c  memfd.c -lpthread
    gcc -shared -o liblistInShm.so list_in_shm.o memfd.o
#    gcc test_list_in_shm.c liblistInShm.so -lpthread
shmht: shmht.o memfd.o
    $(CC) -o libshmht.so $(CFLAGS) -shared $^
    $(AR) rcs libshmht.a  $^
shmht.o: shmht.c shmht.h
    $(CC) $(CFLAGS) $(INCLUDE) -fPIC -c shmht.c
shmht_mytests: shmht_mytests.o shmht.o memfd.o 
    $(CC) $(CFLAGS) $(INCLUDE)   -L .  -pthread  -o $@ $^ 
shmht_mytests.o: shmht.h
    $(CC) $(CFLAGS) $(INCLUDE) -fPIC -c shmht_mytests.c
memfd.o:
    $(CC) $(CFLAGS) $(INCLUDE) -fPIC -c memfd.c
clean:
    rm -rf *.so *.o a.out shmht_mytests *.a