OpenGL/makefile
2024-12-06 12:28:35 -05:00

35 lines
651 B
Makefile

CC := gcc
CXX := g++
CFLAGS := -Wall -Wextra -I headers -ggdb
CXXFLAGS := -Wall -Wextra -I headers -l glfw -ggdb
# List all the source files
C_FILES := $(wildcard src/*.c)
CPP_FILES := $(wildcard src/*.cpp)
# Generate corresponding object file names
OBJ_FILES := $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o)
# Define the target executable
TARGET := ogl
# Default target
all: $(TARGET)
# Linking rule
$(TARGET): $(OBJ_FILES)
$(CXX) $(CXXFLAGS) $^ -o $@
# Compilation rule for C files
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
# Compilation rule for C++ files
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
# Clean rule
clean:
rm -f $(TARGET) $(OBJ_FILES)