swarmc/Makefile

34 lines
608 B
Makefile
Raw Permalink Normal View History

2024-11-21 21:22:14 +00:00
SHELL = /bin/bash
SRC_DIR = ./src
INC_DIR = ./include
OBJ_DIR = ./obj
HEADERS = $(wildcard $(INC_DIR)/*.hpp)
SRC_FILES = $(wildcard $(SRC_DIR)/*.cpp)
DEP_FILES = $(OBJ_FILES:.o=.d)
2024-11-21 21:22:14 +00:00
OBJ_FILES = $(addprefix $(OBJ_DIR)/,$(notdir $(SRC_FILES:.cpp=.o)))
CXXFLAGS += -Wall -std=c++20 -O2 -I $(INC_DIR)
2024-11-21 21:22:14 +00:00
all: bin/swarm
bin/swarm: $(OBJ_FILES)
@mkdir -p bin
$(CXX) $(CXXFLAGS) -o $@ $^
2024-11-21 21:22:14 +00:00
.PHONY: debug
debug: CXXFLAGS += -O0 -g
debug: clean bin/swarm
.PHONY: clean
clean:
$(RM) obj/*.o
$(RM) bin/swarm
-include $(DEP_FILES)
$(OBJ_DIR)/%.o : src/%.cpp
mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -MMD -c $< -o $@