summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2021-12-11 18:04:43 -0500
committerJon Santmyer <jon@jonsantmyer.com>2021-12-11 18:04:43 -0500
commit0170e838d18369c10439c25720e11a79d65c4bff (patch)
tree1f724e14a91467cca757add1731d77cd98a96523 /Makefile
downloaddiheap-0170e838d18369c10439c25720e11a79d65c4bff.tar.gz
diheap-0170e838d18369c10439c25720e11a79d65c4bff.tar.bz2
diheap-0170e838d18369c10439c25720e11a79d65c4bff.zip
initial commit. working alloc and free
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files changed, 24 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b8de4df
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,24 @@
+CFILES := $(wildcard *.c)
+OFILES := $(patsubst %.c,%.o,$(CFILES))
+
+SHARED ?= 1
+STATIC ?= 0
+
+CC ?= gcc
+AR ?= ar
+
+WARNS ?= -Wall -Wextra -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wrestrict -Wnull-dereference -Wdouble-promotion -Wshadow -Wcast-align
+CFLAGS ?= $(WARNS) -L$(shell pwd)
+OUT := libmoditheap
+
+.PHONY: all
+all: $(OFILES)
+ifeq ($(SHARED),1)
+ $(CC) -shared $(CFLAGS) -o $(OUT).so -fPIC $(CFILES)
+endif
+ifeq ($(STATIC),1)
+ $(AR) rcs $(OUT).a $^
+endif
+
+%.o:%.c
+ $(CC) -c -o $@ $<