summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
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 $@ $<