summary refs log tree commit diff stats
path: root/Makefile
diff options
context:
space:
mode:
authorAli Fardan <raiz@stellarbound.space>2020-11-18 10:55:20 +0300
committerAli Fardan <raiz@stellarbound.space>2020-11-18 10:55:20 +0300
commit6f3d10a3ec09cc278041ced4d4e506cb89a7c69a (patch)
tree5b5c7db3104d805d71029534cffcfd5d9c2aca0b /Makefile
downloadlibyuri-6f3d10a3ec09cc278041ced4d4e506cb89a7c69a.tar.gz
initial commit; todo: thorough testing
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile36
1 files changed, 36 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a3036be
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,36 @@
+AR = ar
+CC = cc
+CFLAGS = -g -O0 -Wall -Wextra -Wno-discarded-qualifiers
+TARGET_LIB_DYNAMIC = libyuri.so
+TARGET_LIB_STATIC = libyuri.a
+
+PREFIX = /usr
+
+OBJS = yuri.o decode.o encode.o normalize.o strlcpy.o strlcat.o
+MANPAGES = 
+
+all: $(TARGET_LIB_STATIC) $(TARGET_LIB_DYNAMIC)
+
+$(TARGET_LIB_STATIC): $(OBJS)
+	$(AR) rcs $@ $(OBJS)
+
+$(TARGET_LIB_DYNAMIC): $(OBJS)
+	$(CC) -shared -o $@ $(OBJS)
+
+test: $(TARGET_LIB_STATIC)
+	$(CC) -O0 -g -o $@ test.c $(TARGET_LIB_STATIC)
+
+install: all
+	mkdir -p $(PREFIX)/lib
+	cp $(TARGET_LIB_STATIC) $(PREFIX)/lib
+	cp $(TARGET_LIB_DYNAMIC) $(PREFIX)/lib
+	ldconfig -n $(PREFIX)/lib
+	mkdir -p $(PREFIX)/include
+	cp gemtext.h $(PREFIX)/include
+	mkdir -p $(PREFIX)/share/man/man3
+	cp $(MANPAGES) $(PREFIX)/share/man/man3
+
+clean:
+	rm -f $(TARGET_LIB_STATIC) $(TARGET_LIB_DYNAMIC) $(OBJS) test
+
+.PHONY: all clean