Skip to content

Commit

Permalink
feat: [MINOR] Added Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
nots1dd committed Jul 9, 2024
1 parent a1c714d commit 1a7c1d7
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Compiler and flags
CXX = g++
CXXFLAGS = -std=c++17 -Wall -Wextra -pedantic

# Directories
SRC_DIR = headers/src
INC_DIR = headers
BUILD_DIR = build
EXECUTABLE = Litemus

# Source files
SRCS = litemus.cpp \
$(SRC_DIR)/executeCmd.cpp \
$(SRC_DIR)/lmus_cache.cpp \
$(SRC_DIR)/sfml_helpers.cpp \
$(SRC_DIR)/ncurses_helpers.cpp \
$(SRC_DIR)/parsers.cpp \
$(SRC_DIR)/checkSongDir.cpp \
$(SRC_DIR)/keyHandlers.cpp

# Object files
OBJS = $(SRCS:%.cpp=$(BUILD_DIR)/%.o)

# SFML and ncurses
SFML_LIBS = -lsfml-audio -lsfml-system
NCURSES_LIBS = -lncurses -lmenu

# nlohmann JSON (assuming it's installed globally)
JSON_LIBS = -lnlohmann_json

# Includes
INCLUDES = -I$(INC_DIR)

# Targets
all: $(EXECUTABLE)

$(EXECUTABLE): $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ $^ $(SFML_LIBS) $(NCURSES_LIBS) $(JSON_LIBS)

$(BUILD_DIR)/%.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@

clean:
rm -rf $(BUILD_DIR) $(EXECUTABLE)

.PHONY: all clean
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ This has only been tried and tested on Arch Linux 6.9 kernel (x86-64)

### Steps:

#### Building with CMAKE:

If you want to do this the hard way (without `build.sh`):

1. Clone this repository: `https://github.com/nots1dd/Litemus.git`
Expand All @@ -69,6 +71,16 @@ If you want to do this the hard way (without `build.sh`):

This will generate a `./build/Litemus` executable and will be able to read your custom keybinds. Run it to get the Litemus experience!

#### Building with MAKE:

If for some reason you do not like or have cmake, there is a `Makefile` for this project

-> In the current directory run: `make` (`sudo make` should NOT be necessary)

This should compile all the files and link them to a `Litemus` executable. Simply run it!

-> To clean up, run: `make clean`

> <span style="color: green;"><strong>Tip:</strong></span>
>
> <span style="color: white;">A simpler way is to just use the <code>build.sh</code> script that does everything for you (including adding the <code>lmus</code> alias to your shell rc!)</span>
Expand Down

0 comments on commit 1a7c1d7

Please sign in to comment.