diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6db681c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.direnv +*.o diff --git a/makefile b/makefile new file mode 100644 index 0000000..d8e6240 --- /dev/null +++ b/makefile @@ -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) + diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..de6315c --- /dev/null +++ b/shell.nix @@ -0,0 +1,15 @@ +{ pkgs ? import { } }: + +with pkgs; + +mkShell rec { + packages = [gdb clang-tools]; + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ + gcc + gnumake + glfw3 + glm + ]; + LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs; +}