Skip to content

Commit 1ede24b

Browse files
Update makefile
1 parent faf46cc commit 1ede24b

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

Makefile

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
CXX = g++
2-
CXXFLAGS = -Wall -std=c++17 -Iinclude
3-
LDFLAGS = -L/usr/local/lib -lboost_system -pthread
4-
5-
# Define the source directory and build directory
6-
SRC_DIR = src
71
BUILD_DIR = build
82

9-
# Define targets
10-
all: serial_server serial_client
11-
12-
serial_server: $(SRC_DIR)/server.cpp
13-
$(CXX) $(CXXFLAGS) -o $(BUILD_DIR)/$@ $< $(LDFLAGS)
3+
clean:
4+
@rm -rf ${BUILD_DIR}/*
145

15-
serial_client: $(SRC_DIR)/client.cpp
16-
$(CXX) $(CXXFLAGS) -o $(BUILD_DIR)/$@ $< $(LDFLAGS)
6+
build:
7+
@cmake -S . -B build
8+
@cmake --build build
179

18-
clean:
19-
rm -f $(BUILD_DIR)/serial_server $(BUILD_DIR)/serial_client
10+
test: build
11+
@cd build && ctest
2012

21-
.PHONY: all clean
13+
.PHONY: clean build test

0 commit comments

Comments
 (0)