Skip to content

Commit

Permalink
build(Makefile): fix relinking issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Samih Abdelrahman committed Jan 22, 2024
1 parent d07fb53 commit 5dbefc4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,21 @@ TEST_SERVER:= $(TEST_DIR)/SERVER_main.cpp

OBJS_DIR:= objects
OBJS:= $(addprefix $(OBJS_DIR)/, $(SRCS:%.cpp=%.o))
OBJS_BASENAMES:= $(addprefix $(OBJS_DIR)/,$(notdir $(OBJS)))

NAME:= libserver.a

all: $(NAME)

$(NAME): $(OBJS)
@ar rcs $(NAME) $(OBJS_BASENAMES)
@ar rcs $(NAME) $(OBJS)
@echo "$(YELLOW)[ LIBRARY ]$(RESET) $(NAME) is ready.\n"

$(OBJS_DIR)/%.o: %.cpp | $(OBJS_DIR)
@$(CXX) $(CXXFLAGS) $(INCLUDES) -c $^ -o $(OBJS_DIR)/$(notdir $@)
$(OBJS_DIR)/%.o: %.cpp | $(OBJS_DIR)
@$(CXX) $(CXXFLAGS) $(INCLUDES) -c $^ -o $@
@echo "$(GREEN)[ COMPILE ]$(RESET) $<."

$(OBJS_DIR):
@mkdir -p objects
@mkdir -p objects objects/socket

debug: CXXFLAGS += $(DEBUGFLAGS)
debug: all
Expand Down

0 comments on commit 5dbefc4

Please sign in to comment.