From 7e877be8fb34ab99421a2eaf3d8fb1b96ed95206 Mon Sep 17 00:00:00 2001 From: cheliequan <liequanche@126.com> Date: 星期四, 08 十二月 2022 21:06:52 +0800 Subject: [PATCH] 增加共享内存hash链表操作 --- src/Makefile | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index ec69481..5dd8487 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,6 +1,21 @@ -all: - gcc -g -c -Wall -Werror -fpic list_in_shm.c memfd.c -lpthread +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 +# 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 + rm -rf *.so *.o a.out shmht_mytests *.a -- Gitblit v1.8.0