build utils
This commit is contained in:
parent
91cbfcef04
commit
d1403cd681
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.direnv
|
||||||
|
*.o
|
||||||
34
makefile
Normal file
34
makefile
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user