build utils
This commit is contained in:
parent
91cbfcef04
commit
d1403cd681
4 changed files with 52 additions and 0 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use nix
|
||||||
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)
|
||||||
|
|
||||||
15
shell.nix
Normal file
15
shell.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{ pkgs ? import <nixpkgs> { } }:
|
||||||
|
|
||||||
|
with pkgs;
|
||||||
|
|
||||||
|
mkShell rec {
|
||||||
|
packages = [gdb clang-tools];
|
||||||
|
nativeBuildInputs = [ pkg-config ];
|
||||||
|
buildInputs = [
|
||||||
|
gcc
|
||||||
|
gnumake
|
||||||
|
glfw3
|
||||||
|
glm
|
||||||
|
];
|
||||||
|
LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue