Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
Fixed path separator issue
Browse files Browse the repository at this point in the history
  • Loading branch information
xfnty committed Jun 29, 2023
1 parent 195d7a8 commit 1b69a8b
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
MAKEFLAGS=--no-print-directory --quiet

ifdef OS
path = $(subst /,\,$1)
else
path = $1
endif

PROJECT_NAME=flappy-bird
CMAKE_DIR=.cmake
OUTPUT_DIR=bin
EXE=$(OUTPUT_DIR)/$(PROJECT_NAME)
CMAKE_DIR:=.cmake
OUTPUT_DIR:=bin
EXE=$(call path, $(OUTPUT_DIR)/$(PROJECT_NAME))

CONFIGURE=configure c
BUILD=build b
RUN=run r
DEBUG=debug d
CONFIGURE:=configure c
BUILD:=build b
RUN:=run r
DEBUG:=debug d

all: configure build run

$(CONFIGURE):
echo ----- Configuring -----
mkdir -p $(CMAKE_DIR)
cmake -B $(CMAKE_DIR) -S . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1
cp -f $(CMAKE_DIR)/compile_commands.json ./compile_commands.json
cp -f $(call path, $(CMAKE_DIR)/compile_commands.json) compile_commands.json

$(BUILD):
echo ----- Building -----
Expand All @@ -25,13 +31,13 @@ $(BUILD):

$(RUN):
echo ----- Running -----
cp -rf ./assets $(OUTPUT_DIR)
cp -rf assets $(OUTPUT_DIR)
cd $(OUTPUT_DIR)
$(EXE)

$(DEBUG):
echo ----- Debugging -----
cp -rf ./assets $(OUTPUT_DIR)
cp -rf assets $(OUTPUT_DIR)
cd $(OUTPUT_DIR)
gdb -q --return-child-result $(EXE)

Expand Down

0 comments on commit 1b69a8b

Please sign in to comment.