aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile29
1 files changed, 29 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1b36766
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,29 @@
+NAME=poc
+CC = gcc
+CFLAGS = -Isrc
+# Standard compliance
+CFLAGS += -std=c99 -pedantic
+
+PREFIX = /usr/local
+MANPREFIX = $(PREFIX)/man
+
+all: bin/$(NAME)
+
+debug: CFLAGS += -Wall -DEBUG -g
+debug: bin/$(NAME)
+
+sources = $(wildcard src/*.c)
+objects = $(patsubst src/%.c, bin/%.o, $(sources))
+
+bin/$(NAME): $(objects)
+ mkdir -p $$(dirname $@)
+ $(CC) $(CFLAGS) $^ -o $@ $(LIBS)
+
+bin/%.o: src/%.c
+ mkdir -p $$(dirname $@)
+ $(CC) $(CFLAGS) -c $< -o $@
+
+clean:
+ rm -rf bin/
+
+.PHONY: clean