aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2019-08-30 03:46:11 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2019-08-30 03:46:11 +0200
commit9e5b432b18b80e3206cad70c64618b462291d84f (patch)
tree21526c5d466a0819456dd7bfaf2c6ab58a27fb01 /Makefile
downloaddns-9e5b432b18b80e3206cad70c64618b462291d84f.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..5b3dcac
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,35 @@
+CC = clang
+CFLAGS = -Wall
+LDFLAGS =
+BUILDDIR = build
+SOURCEDIR = src
+OBJECTDIR = obj
+
+OUTPUT = dns
+
+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)