From 3841022b1eb4ed63933f49ba2626bc0d3d358f8b Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Tue, 30 Jun 2020 10:35:16 -0400 Subject: add Makefile --- Makefile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Makefile 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) -- cgit v1.2.1