summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
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)