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 *.c) CPP_FILES := $(wildcard *.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)