From 302ae4427b04a25e4f1ee8acadbb05bf902f47f7 Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期一, 06 七月 2020 19:09:58 +0800 Subject: [PATCH] update --- squeue/Makefile | 54 +++++++++++++++++++++++++++++------------------------- 1 files changed, 29 insertions(+), 25 deletions(-) diff --git a/squeue/Makefile b/squeue/Makefile index 2251b9c..8333f37 100644 --- a/squeue/Makefile +++ b/squeue/Makefile @@ -2,35 +2,41 @@ # Makefile for common library. # ROOT=.. -PLATFORM=$(shell $(ROOT)/systype.sh) -INCLUDE+=-I./ -I./include -I$(ROOT)/common/include -LIBCOMMON=$(ROOT)/common/libusgcommon.a -LIBSQUEUE = libsqueue.a -DLIBSQUEUE = libsqueue.so -LDLIBS =-L$(ROOT)/common -lusgcommon $(EXTRALIBS) +#LDLIBS+=-Wl,-rpath=$(ROOT)/common:$(ROOT)/lib/jsoncpp +# 寮�婧愬伐鍏峰寘璺緞 +#LDDIR += -L$(ROOT)/lib/jsoncpp -L$(ROOT)/lib/nng +# 寮�婧愬伐鍏峰寘 +#LDLIBS += -ljsoncpp -lnng -lpthread + +#INCLUDE += -I$(ROOT)/device/include + +PLATFORM=$(shell $(ROOT)/systype.sh) include $(ROOT)/Make.defines.$(PLATFORM) +LIBSQUEUE = libsqueue.a +DLIBSQUEUE = libsqueue.so -OBJS = mm.o pcsem.o hashtable.o +SOURCES := $(wildcard *.c) +OBJS = $(patsubst %.c, %.o, $(SOURCES)) -all: $(LIBSQUEUE) +MYLIBS = $(LIBSQUEUE) -mm.o: $(LIBCOMMON) +all: build + -pcsem.o: $(LIBCOMMON) - -test: $(OBJS) $(LIBCOMMON) - +build: $(MYLIBS) #static lib -$(LIBSQUEUE): $(OBJS) $(LIBCOMMON) +$(LIBSQUEUE): $(OBJS) $(AR) rv $@ $? $(RANLIB) $@ #dynamic lib -$(DLIBSQUEUE): $(OBJS) $(LIBCOMMON) - $(CC) -fPIC -shared -o $@ $^ +$(DLIBSQUEUE): $(SOURCES) + rm -f *.o + $(CC) -fPIC -shared $(CFLAGS) $^ -o $@ $(LDFLAGS) + #PREFIX is environment variable, but if it is not set, then set default value ifeq ($(PREFIX),) @@ -38,15 +44,13 @@ endif # 浣跨敤鏂瑰紡锛� g++ test1.c -lcommon -install: $(DLIBSQUEUE) $(LIBSQUEUE) - sudo install -d $(PREFIX)/lib/ - sudo install -m 644 $^ $(PREFIX)/lib/ - sudo install -d $(PREFIX)/include/ - sudo install -m 644 include/* $(PREFIX)/include/ +install: $(MYLIBS) + install -d $(PREFIX)/lib/ + install -m 644 $^ $(PREFIX)/lib/ + install -d $(PREFIX)/include/ + install -m 644 include/* $(PREFIX)/include/ clean: - rm -f *.o a.out core temp.* *.a *.so + rm -f $(TEMPFILES) - - -include $(ROOT)/Make.common.inc +.PHONY: build clean install -- Gitblit v1.8.0