diff options
author | Ali Fardan <raiz@stellarbound.space> | 2020-10-23 16:57:56 +0300 |
---|---|---|
committer | Ali Fardan <raiz@stellarbound.space> | 2020-10-23 16:57:56 +0300 |
commit | f0c842e82a7304f75feee03bd22b9b822747deff (patch) | |
tree | 6c64da28730d63a1fc8bce1e59211d3fb81b1d83 | |
parent | b3d5ce68acdeafe6a9c28bc25b44db8061d7ccce (diff) | |
download | libgemtext-f0c842e82a7304f75feee03bd22b9b822747deff.tar.gz |
update makefile to build dynamic library object and add install rule
-rw-r--r-- | Makefile | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/Makefile b/Makefile index 1c51187..7bc8f5d 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,33 @@ -CFLAGS = -Wall -Wextra -fPIC -g +AR = ar +CC = cc +CFLAGS = -g -O0 -Wall -Wextra +LDFLAGS = -shared +TARGET_LIB_DYNAMIC = libgemtext.so +TARGET_LIB_STATIC = libgemtext.a -OBJ = free.o decode.o encode.o gemtext.o strlcpy.o strlcat.o +PREFIX = /usr -all: libgemtext.a +OBJS = decode.o encode.o free.o gemtext.o strlcat.o strlcpy.o +MANPAGES = gemtext_decode.3 gemtext_encode.3 gemtext_free.3\ + gemtext_text_new.3 gemtext_text_string.3 gemtext_type.3 -libgemtext.a: $(OBJ) +all: $(TARGET_LIB_STATIC) $(TARGET_LIB_DYNAMIC) + +$(TARGET_LIB_STATIC): $(OBJS) $(AR) rcs $@ $^ +$(TARGET_LIB_DYNAMIC): $(OBJS) + $(CC) -shared -o $@ $^ + +install: + mkdir -p $(PREFIX)/lib + cp -r $(TARGET_LIB_STATIC) $(PREFIX)/lib + cp -r $(TARGET_LIB_DYNAMIC) $(PREFIX)/lib + ldconfig -n $(PREFIX)/lib + mkdir -p $(PREFIX)/share/man/man3 + cp $(MANPAGES) $(PREFIX)/share/man/man3 + clean: - rm -f $(OBJ) libgemtext.a + rm -f $(TARGET_LIB_STATIC) $(TARGET_LIB_DYNAMIC) $(OBJS) .PHONY: all clean |