Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add static library compile #62

Merged
merged 1 commit into from
Mar 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add static library compile
fawdlstty committed Mar 25, 2021
commit a52c776c780a9c92b1f2d3706b39fe294670cc92
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -24,20 +24,26 @@ INCLUDES = -Iinclude \
LIBS = -lcurl -lpthread
CCFLAGS = -g -Wall -O0 -fPIC
OUTPUT = nacos-cli.out
OUTLIB = libnacos-cli.so
OUTLIB1 = libnacos-cli.so
OUTLIB2 = libnacos-cli.a

vpath %.cpp $(ALL_SRCS_DIRS)

all :$(DEPS) $(OUTPUT) $(OUTLIB)
all :$(DEPS) $(OUTPUT) $(OUTLIB1) $(OUTLIB2)

$(OUTPUT) : $(ALL_OBJS)
$(info Linking $@ ...)
@$(CC) $^ -o $@ $(INCLUDES) $(LIBS) $(CCFLAGS)

$(OUTLIB) : $(OBJS)
$(info Linking $@ ...)
$(OUTLIB1) : $(OBJS)
$(info Linking Dynamic $@ ...)
@$(CC) $^ -o $@ $(INCLUDES) $(LIBS) $(CCFLAGS) -shared

$(OUTLIB2) : $(OBJS)
$(info Linking Static $@ ...)
ar cru $(OUTLIB2) $(OBJS)
ranlib $(OUTLIB2)

$(ALL_OBJS) : $(OBJ_DIR)/%.o : %.cpp
$(info Building $@ ...)
@mkdir -p "$(OBJ_DIR)"