aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2019-05-16 10:39:55 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2019-05-16 10:39:55 +0200
commit5bf1de3227199c7f300a93035b5ed65df7209d0d (patch)
treeccb5ebfe103f8d82725bc3c0a21cf1bbf0eb4d7e /Makefile
downloadbbs-5bf1de3227199c7f300a93035b5ed65df7209d0d.tar.gz
Initial
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..78c3d29
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,35 @@
+CC = clang
+CFLAGS = -Wall
+LDFLAGS =
+BUILDDIR = build
+SOURCEDIR = src
+OBJECTDIR = obj
+
+OUTPUT = program
+
+SRCS = $(wildcard $(SOURCEDIR)/*.c)
+OBJS = $(SRCS:.c=.o)
+OBJ = $(OBJS:$(SOURCEDIR)/%=$(OBJECTDIR)/%)
+
+build: dir $(OBJ)
+ @echo [LD] $(OBJ)
+ @$(CC) $(CFLAGS) -o $(BUILDDIR)/$(OUTPUT) $(OBJ) $(LDFLAGS)
+
+debug: CFLAGS += -g -D _DEBUG
+debug: build;
+
+dir:
+ @mkdir -p $(OBJECTDIR)
+ @mkdir -p $(BUILDDIR)
+
+$(OBJECTDIR)/%.o: $(SOURCEDIR)/%.c
+ @echo [CC] $<
+ @$(CC) $(CFLAGS) -c $< -o $@
+
+.PHONY: clean
+
+clean:
+ @echo [RM] $(OBJ)
+ @echo [RM] $(BUILDDIR)/$(OUTPUT)
+ @rm -df $(OBJ)
+ @rm -Rdf $(BUILDDIR) $(OBJECTDIR)