-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (28 loc) · 728 Bytes
/
Makefile
File metadata and controls
37 lines (28 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Nombre del ejecutable
TARGET = treefiles
# Compilador y flags
CXX = g++
CXXFLAGS = -Wall -Wextra -std=c++17 -std=c++17 -Iinclude
# Librerías necesarias
LIBS = -lncurses
# Directorios
SRC_DIR = src
INC_DIR = include
BUILD_DIR = build
# Archivos fuente y objeto
SRC = $(wildcard $(SRC_DIR)/*.cpp)
OBJ = $(patsubst $(SRC_DIR)/%.cpp, $(BUILD_DIR)/%.o, $(SRC))
# Regla por defecto
all: $(BUILD_DIR) $(TARGET)
# Crear ejecutable
$(TARGET): $(OBJ)
$(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
# Crear carpeta build si no existe
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
# Regla para compilar .cpp a .o
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
# Limpiar archivos generados
clean:
rm -rf $(BUILD_DIR) $(TARGET)