commit cadbf114a93d9742921d455611ea4ebd09a70d21
Author: amin <dev@aminmesbah.com>
Date: Mon, 14 May 2018 05:28:58 +0000
Start making a game
FossilOrigin-Name: 777697f3d48218be14de5b8c81567962dee2f7ab86a0f8c0fef53961633d0d88
Diffstat:
3 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1,7 @@
+*.out
+*.swp
+
+debug/*
+release/*
+
+tags
diff --git a/Makefile b/Makefile
@@ -0,0 +1,46 @@
+CC = clang
+CFLAGS = -std=c99 -Wall -Wextra -Wshadow -Wswitch-enum -Wno-unused-parameter -Wno-missing-braces
+LDFLAGS = -lglfw -lGL -lGLEW -lGLU -lm -lX11 -lpthread -lXrandr -lXi
+
+SRC_FILES = main.c
+SRC = $(addprefix src/, $(SRC_FILES))
+EXE_FILE = a_game
+
+DBGDIR = debug
+DBGEXE = $(DBGDIR)/$(EXE_FILE)
+DBGCFLAGS = -g -Og -Werror
+
+RELDIR = release
+RELEXE = $(RELDIR)/$(EXE_FILE)
+RELCFLAGS = -O2 -Os
+
+.PHONY: all clean compile_debug compile_release debug lib_debug lib_release memcheck prep run todo
+
+all: compile_debug compile_release
+
+clean:
+ rm -f $(RELDIR)/* $(DBGDIR)/*
+
+compile_debug: prep lib_debug
+ $(CC) $(CFLAGS) $(DBGCFLAGS) $(SRC) -o $(DBGEXE) $(LDFLAGS)
+
+compile_release: prep lib_release
+ $(CC) $(CFLAGS) $(RELCFLAGS) $(SRC) -o $(RELEXE) $(LDFLAGS)
+
+debug: compile_debug
+ gdb $(DBGEXE)
+
+memcheck: compile_debug
+ valgrind --track-origins=yes ./$(DBGEXE)
+
+prep:
+ @mkdir -p $(DBGDIR) $(RELDIR)
+
+run: compile_release
+ ./$(RELEXE)
+
+todo:
+ @grep -FIR --colour=never --ignore-case --line-number todo src/ \
+ | sed -re 's/^([^:]+):[[:space:]]*(.*)/\1\x01\2/' \
+ | sed -re 's/^([^:]+):[[:space:]]*(.*)/\1\x01\2/' \
+ | column -s $$'\x01' -t
diff --git a/src/main.c b/src/main.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main(void)
+{
+ printf("Hello, world");
+}