# Compiler and flags CXX = g++ CXXFLAGS = -std=c++17 -Wall -Wextra -O3 LDFLAGS = -static -lncurses -ltinfo # Directories SRC_DIR = src OBJ_DIR = build BIN_DIR = bin # File extensions SRC_EXT = cpp OBJ_EXT = o # Find all source files and generate object files SOURCES = $(wildcard $(SRC_DIR)/*.$(SRC_EXT)) OBJECTS = $(SOURCES:$(SRC_DIR)/%.$(SRC_EXT)=$(OBJ_DIR)/%.$(OBJ_EXT)) # Output executable EXEC = $(BIN_DIR)/fissh # Default target: build everything all: $(EXEC) # Rule to link the object files into the final executable $(EXEC): $(OBJECTS) @mkdir -p $(BIN_DIR) # Make sure the bin dir exists $(CXX) $(OBJECTS) -o $(EXEC) $(LDFLAGS) # Rule to compile .cpp files into .o files $(OBJ_DIR)/%.o: $(SRC_DIR)/%.$(SRC_EXT) @mkdir -p $(OBJ_DIR) # Make sure the obj dir exists $(CXX) $(CXXFLAGS) -c $< -o $@ # Clean up the build directory clean: rm -rf $(OBJ_DIR) $(BIN_DIR) # Phony targets .PHONY: all clean run