aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Makefile b/src/Makefile
index 9858cdf..47d0dd4 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -4,23 +4,27 @@ CC ?= gcc
WARNFLAGS ?= -Wall -Wextra
COMMONFLAGS ?= -fno-builtin -fPIC -DPIC -pthread
-OPTFLAGS ?= -O3 -DNDEBUG
+OPTFLAGS ?= -O0 -g
CFLAGS ?= $(OPTFLAGS) $(WARNFLAGS) $(COMMONFLAGS)
LDFLAGS ?= -pthread -static-libgcc
+MEMSIZE_KB=$(shell free -t | tail -1 | tr -s ' ' | cut -d ' ' -f 2)
+MEMSIZE=$(shell echo $(MEMSIZE_KB)"* 1024" | bc)
+
.PHONY: all clean
all: $(OBJDIR)/print_status_on_exit.so $(OBJDIR)/allocators/bumpptr_alloc.so
-$(OBJDIR)/allocators/bumpptr_alloc.so: bumpptr_alloc.c | $(OBJDIR)/allocators
+$(OBJDIR)/allocators/bumpptr_alloc.so: bumpptr_alloc.c Makefile | $(OBJDIR)/allocators
@echo "Compiling $@...";
- $(CC) $(LDFLAGS) -shared $(CFLAGS) -o $@ $<
+ $(CC) $(LDFLAGS) -shared -DMEMSIZE=$(MEMSIZE) $(CFLAGS) -o $@ $<
+ # $(CC) $(LDFLAGS) -shared $(CFLAGS) -o $@ $<
-$(OBJDIR)/print_status_on_exit.so: print_status_on_exit.c | $(OBJDIR)
+$(OBJDIR)/print_status_on_exit.so: print_status_on_exit.c Makefile | $(OBJDIR)
@echo "Compiling $@...";
- $(CC) $(LDFLAGS) -shared -O2 $(CFLAGS) -o $@ $<
+ $(CC) $(LDFLAGS) -shared $(CFLAGS) -o $@ $<
$(OBJDIR)/allocators:
mkdir -p $@