summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-06-30 10:35:16 -0400
committerJakob Kaivo <jkk@ung.org>2020-06-30 10:35:16 -0400
commit3841022b1eb4ed63933f49ba2626bc0d3d358f8b (patch)
tree9c84b2f5bb4ab71ec1c2f86c43e3434701baca8b /Makefile
parentb4784b4d809aede70aa21fd436e1de8cc7642463 (diff)
add Makefile
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile26
1 files changed, 26 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0dd5261
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,26 @@
+.POSIX:
+
+LIBDIR=lib
+OBJDIR=obj
+SRCDIR=src
+INCDIR=include
+CFLAGS=-I$(INCDIR) -Wall -Wextra -Wpedantic -g
+
+OBJECTS=$(OBJDIR)/mapalloc.o
+
+all: $(LIBDIR)/libmapalloc.a $(LIBDIR)/libmapalloc.so
+
+$(OBJDIR)/mapalloc.o: $(SRCDIR)/mapalloc.c $(INCDIR)/mapalloc.h
+ @mkdir -p $(@D)
+ $(CC) -c -o $@ $(CFLAGS) $(SRCDIR)/$(*F).c
+
+$(LIBDIR)/libmapalloc.a: $(OBJECTS)
+ @mkdir -p $(@D)
+ $(AR) $(ARFLAGS) $@ $<
+
+$(LIBDIR)/libmapalloc.so: $(OBJECTS)
+ @mkdir -p $(@D)
+ $(CC) -o $@ -shared $(OBJECTS)
+
+clean:
+ $(RM) -rf $(LIBDIR) $(OBJDIR)