Uploading files to Git
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
|
||||
# Compiler and flags
|
||||
CC := g++
|
||||
CXXFLAGS := -std=c++14 -Wall -Iinclude
|
||||
|
||||
# Directories
|
||||
SRC_DIR := src
|
||||
INC_DIR := include
|
||||
OBJ_DIR := obj
|
||||
BIN_DIR := bin
|
||||
|
||||
|
||||
#
|
||||
# === Executable Name ===
|
||||
TARGET := $(BIN_DIR)/abc_lab
|
||||
|
||||
# === Find all .cpp files recursively in src/ ===
|
||||
SRCS := $(shell find $(SRC_DIR) -name '*.cpp')
|
||||
|
||||
# === Convert src/foo/bar.cpp → obj/foo/bar.o ===
|
||||
OBJS := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRCS))
|
||||
|
||||
# === Default Target ===
|
||||
all: $(TARGET)
|
||||
|
||||
# === Linking final executable ===
|
||||
$(TARGET): $(OBJS)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) $(CXXFLAGS) -o $@ $^
|
||||
|
||||
# === Compiling source files to object files ===
|
||||
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
# Clean up
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(OBJ_DIR) $(BIN_DIR)
|
||||
|
||||
# Optional: print debug info
|
||||
.PHONY: info
|
||||
info:
|
||||
@echo "Source files: $(SRCS)"
|
||||
@echo "Object files: $(OBJS)"
|
||||
@echo "CXXFLAGS: $(CXXFLAGS)"
|
||||
Reference in New Issue
Block a user