Initial commit

This commit is contained in:
Jose
2025-12-29 09:16:47 +01:00
parent 8fa3dba5f5
commit a680d83b4e
9 changed files with 374 additions and 0 deletions

38
Makefile Normal file
View File

@@ -0,0 +1,38 @@
# Compilador
CC = gcc
CFLAGS = -Wall -Wextra -g -Iincludes $(shell sdl2-config --cflags)
LDFLAGS = $(shell sdl2-config --libs) -lm
# Carpetas
SRC_DIR = src
OBJ_DIR = build
BIN_DIR = bin
# Fuentes y objetos
SRC = $(wildcard $(SRC_DIR)/*.c)
OBJ = $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRC))
TARGET = $(BIN_DIR)/graphs
# Regla por defecto
all: $(TARGET)
# Linkar el ejecutable
$(TARGET): $(OBJ) | $(BIN_DIR)
$(CC) -o $@ $^ $(LDFLAGS)
# Compilar cada .c a .o en build/
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
$(CC) -c $(CFLAGS) $< -o $@
# Crear carpetas si no existen
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
$(BIN_DIR):
mkdir -p $(BIN_DIR)
# Limpiar objetos y binario
clean:
rm -rf $(OBJ_DIR)/* $(BIN_DIR)/*
.PHONY: all clean