Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Makefile update.
Browse files Browse the repository at this point in the history
  • Loading branch information
JustWhit3 committed Jun 29, 2022
1 parent ae75e20 commit 3b0d408
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#====================================================
# VARIABLES
# Variables
#====================================================
TARGET_EXEC := main
TEST_EXEC := tests
Expand All @@ -10,40 +10,30 @@ TEST_DIR := test
OBJ_DIR := obj

#====================================================
# SOURCE FILES
# Source files
#====================================================
SRC := $(shell find $(SRC_DIR) -name '*.cpp')
TEST := $(shell find $(SRC_DIR) -type f | grep -v 'main.cpp') $(shell find $(TEST_DIR) -name '*.cpp')
OBJ := $(SRC:%=$(OBJ_DIR)/%.o)
TEST_OBJ := $(TEST:%=$(OBJ_DIR)/%.o)

#====================================================
# DEPENDENCIES AND FLAGS
# Dependencies and flags
#====================================================
DEPS := $(OBJ:.o=.d)
INC_DIR := $(shell find $(SRC_DIR) -type d)
INC_FLAGS := $(addprefix -I,$(INC_DIR))
WFLAGS := -Wall -Wextra -Wno-unused
CPPFLAGS := -std=c++17 -g $(LDFLAGS) $(INC_FLAGS) -MMD -MP $(WFLAGS)
LDFLAGS := -L/usr/local/lib -losmanip -larsenalgear -static
LDFLAGS := -losmanip -larsenalgear

#====================================================
# OS DETECTION
#====================================================

# Windows (Cygwin)
ifeq ($(OS), Windows_NT)
TARGET_EXEC += .exe
TEST_EXEC += .exe
endif

#====================================================
# ALIASES
# Aliases
#====================================================
.PHONY: clean all

#====================================================
# BUILDING
# Building
#====================================================

#Building all:
Expand All @@ -67,12 +57,12 @@ $(OBJ_DIR)/%.cpp.o: %.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@

#====================================================
# CLEAN
# Clean
#====================================================
clean:
rm -r $(OBJ_DIR) $(BUILD_DIR)

#====================================================
# INCLUDE
# Include
#====================================================
-include $(DEPS)

0 comments on commit 3b0d408

Please sign in to comment.