aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile34
1 files changed, 34 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f07c32b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,34 @@
+CC ?= gcc
+CFLAGS := -Wall -O2 -std=c99
+LDFLAGS :=
+LDLIBS :=
+
+SRCDIR := src
+BINDIR := bin
+OBJDIR := obj
+DIRS := $(SRCDIR) $(BINDIR) $(OBJDIR)
+
+SRC := $(shell find $(SRCDIR) -type f -printf "%f ")
+DEPS := $(OBJ:.o=.d)
+OBJ := $(SRC:%.c=$(OBJDIR)/%.o)
+
+TARGET := $(BINDIR)/cgit_auth
+
+# Rules
+.PHONY: all clean
+
+all: $(TARGET)
+
+$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
+ $(CC) $(CFLAGS) -o $@ -c $<
+
+$(DIRS):
+ @mkdir -p $@
+
+-include $(DEPS)
+
+$(TARGET): $(OBJ) | $(BINDIR)
+ $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) $(LDLIBS)
+
+clean:
+ rm -rf $(BINDIR) $(OBJDIR)