--- /dev/null
+# Sample Makefile to build simple project.
+#
+# This Makefile expect all source files (.c) to be at the same level, in the
+# current working directory.
+#
+# It will automatically generate dependencies, compile all files, and produce a
+# binary using the provided name.
+#
+# Set BINARY_NAME to the name of the binary file to build.
+# Set BUILD_TYPE to either debug or release
+#
+# Automatic dependencies code from:
+# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#tldr
+BINARY_NAME=exo1
+BINARY_PATH:=src
+LIBRARY_NAME=libexo1
+LIBRARY_PATH:=lib
+#LDLIBS=-L$(LIBRARY_PATH) -l$(BINARY_NAME)
+BUILD_TYPE=debug
+
+# ====================================
+# DO NOT CHANGE STUFF BEYOND THIS LINE
+# ====================================
+
+all: $(BINARY_NAME) $(BINARY_NAME).dynamic $(BINARY_NAME).static
+
+CC=gcc
+LD=gcc
+AR=ar
+
+WARN_FLAGS = -Wall -Wextra
+STD_FLAG = -std=c11
+
+ifeq ($(BUILD_TYPE),debug)
+BUILDDIR := .build/debug
+DEBUG_FLAG = -g
+STRIP_FLAG =
+OPTI_FLAG = -O0
+else
+BUILDDIR := .build/release
+DEBUG_FLAG =
+STRIP_FLAG = -s
+OPTI_FLAG = -O3
+endif
+
+#FIXME: Add a way to better control the library build flag
+CFLAGS := -fPIC $(CFLAGS) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG)
+LDFLAGS := $(LDFLAGS) $(STRIP_FLAG)
+LIBLDFLAGS := -shared $(LDFLAGS)
+STATICLIBLDFLAGS := -static $(LDFLAGS)
+
+OBJDIR := $(BUILDDIR)/objs
+$(shell mkdir -p $(OBJDIR))
+
+SRCS=$(wildcard $(BINARY_PATH)/*.c)
+LIBSRCS=$(wildcard $(LIBRARY_PATH)/*.c)
+OBJS=$(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(SRCS)))
+LIBOBJS=$(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(LIBSRCS)))
+
+DEPDIR := $(BUILDDIR)/deps
+$(shell mkdir -p $(DEPDIR))
+DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$(notdir $*).Td
+POSTCOMPILE = mv -f $(DEPDIR)/$(notdir $*).Td $(DEPDIR)/$(notdir $*).d
+
+print:
+ @echo $(basename $(notdir $(SRCS)))
+ @echo $(notdir $(SRCS))
+ @echo $(DEPDIR)/%d
+ @echo $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS))))
+ @echo $(OBJS) $(LIBOBJS)
+ @echo $(SRCS) $(LIBSRCS)
+ @echo $(POSTCOMPILE)
+
+$(LIBRARY_PATH)/$(LIBRARY_NAME).a: $(LIBOBJS)
+ @echo "[AR StO] $@"
+ @$(AR) rcs $@ $^
+
+$(LIBRARY_PATH)/$(LIBRARY_NAME).so: $(LIBOBJS)
+ @echo "[LD ShO] $@"
+ @$(LD) $(CFLAGS) $(LIBLDFLAGS) $^ $(LDLIBS) -o $@
+
+#$(BINARY_NAME): $(OBJS) $(LIBOBJS)
+# @echo "[LD ] $@"
+# $(LD) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
+
+$(BINARY_NAME): $(OBJS) $(LIBRARY_PATH)/$(LIBRARY_NAME).a
+ @echo "[LD ] $@"
+ @$(LD) $(CFLAGS) $(LDFLAGS) $^ $(LOCALLDLIBS) $(LDLIBS) -o $@
+
+LOCALLDLIBS=-L$(LIBRARY_PATH) -l$(BINARY_NAME)
+$(BINARY_NAME).static: $(OBJS) $(LIBRARY_PATH)/$(LIBRARY_NAME).a
+ @echo "[LD ] $@"
+ @$(LD) $(CFLAGS) $(STATICLIBLDFLAGS) $^ $(LOCALLDLIBS) $(LDLIBS) -o $@
+
+#$(BINARY_NAME).staticlocal: $(OBJS) $(LIBRARY_PATH)/$(LIBRARY_NAME).a
+# @echo "[LD ] $@"
+# @$(LD) $(CFLAGS) $(LDFLAGS) $^ $(LOCALLDLIBS) $(LDLIBS) -o $@
+
+$(BINARY_NAME).dynamic: $(OBJS) $(LIBRARY_PATH)/$(LIBRARY_NAME).so
+ @echo "[LD ] $@"
+ @$(LD) $(CFLAGS) $(LDFLAGS) $^ $(LOCALLDLIBS) $(LDLIBS) -o $@
+
+$(OBJS): $(SRCS) $(DEPDIR)/%.d
+ @echo "[C ] $*"
+ @$(CC) $(DEPFLAGS) $(CFLAGS) -c $< -o $@
+ @$(POSTCOMPILE)
+
+include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS))))
+
+$(LIBOBJS): $(LIBSRCS) $(DEPDIR)/%.d
+ @echo "[C ] $*"
+ @$(CC) $(DEPFLAGS) $(CFLAGS) -c $< -o $@
+ @$(POSTCOMPILE)
+
+include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(LIBSRCS))))
+
+$(DEPDIR)/%.d: ;
+
+.PRECIOUS: $(DEPDIR)/%.d
+
+clean:
+ @echo "[CLN]"
+ -@rm -r $(BUILDDIR)
+ -@rm $(BINARY_NAME)
+ -@rm $(BINARY_NAME).static
+ -@rm $(BINARY_NAME).dynamic
+ -@rm $(LIBRARY_PATH)/$(LIBRARY_NAME).a
+ -@rm $(LIBRARY_PATH)/$(LIBRARY_NAME).so
+
+disassemble: $(BINARY_NAME)
+ objdump -d $< | less
+
+symbols: $(BINARY_NAME)
+ objdump -t $< | sort | less