Skip to content

Commit

Permalink
Add second try
Browse files Browse the repository at this point in the history
  • Loading branch information
dchansen06 committed Dec 19, 2024
1 parent 78dacee commit e2a4079
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ CXXFLAGS = -Wall -Wextra
LDLIBS = $(shell sdl2-config --libs) $(shell sdl2-config --libs)_mixer

SRC_DIR = src
CLIENT_SRC := $(wildcard $(SRC_DIR)/client*.cpp)
CLIENT_SRC := $(wildcard $(SRC_DIR)/client.cpp)
CLIENT2_SRC := $(wildcard $(SRC_DIR)/client2.cpp)
SERVER_SRC := $(wildcard $(SRC_DIR)/server*.cpp)

# Heavily inspired by https://stackoverflow.com/a/30602701
BUILD_DIR = build
BIN_DIR = $(BUILD_DIR)/bin
OBJ_DIR = $(BUILD_DIR)/obj
CLIENT_OBJ := $(CLIENT_SRC:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)
CLIENT2_OBJ := $(CLIENT2_SRC:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)
SERVER_OBJ := $(SERVER_SRC:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)

PROGRAM = $(BIN_DIR)/client $(BIN_DIR)/server
PROGRAM = $(BIN_DIR)/client $(BIN_DIR)/server $(BIN_DIR)/client2

.DELETE_ON_ERROR:
.PHONY: all clean
Expand All @@ -34,6 +36,9 @@ $(BIN_DIR)/server: $(SERVER_OBJ) | $(BIN_DIR)
$(BIN_DIR)/client: $(CLIENT_OBJ) | $(BIN_DIR)
$(CXX) $(CXXFLAGS) $(^) -o $(@)

$(BIN_DIR)/client2: $(CLIENT2_OBJ) | $(BIN_DIR)
$(CXX) $(CXXFLAGS) $(^) -o $(@)

$(BIN_DIR) $(OBJ_DIR):
mkdir -p $@

Expand Down
11 changes: 5 additions & 6 deletions src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ int main(int argc, char* argv[])

fspath path;

if (argc > 1)
{
// if (argc > 1) {
path = argv[1];
} else {
cout << "Enter directory ";
cin >> path;
}
// } else {
// cout << "Enter directory ";
// cin >> path;
// }

music_list validmusic = findMusicFiles(path);
shuffleMusic(validmusic);
Expand Down

0 comments on commit e2a4079

Please # to comment.