Skip to content

Commit

Permalink
Shared lib support
Browse files Browse the repository at this point in the history
  • Loading branch information
extrowerk committed Aug 13, 2019
1 parent 6b28e06 commit a6d548e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ CFLAGS = -Os -Wall -Wextra
SRC = linenoise.c utf8.c
OBJ = $(SRC:.c=.o)
LIB = liblinenoise.a
SLIB = liblinenoise.so
INC = linenoise.h utf8.h
MAN = linenoise.3

all: $(LIB) example
all: $(LIB) $(SLIB) example

$(LIB): $(OBJ)
$(AR) -rcs $@ $(OBJ)

$(SLIB): $(OBJ)
$(CC) -shared $(OBJ) -o $@

example: example.o $(LIB)
$(CC) -o $@ example.o $(LIB)

Expand All @@ -24,7 +28,7 @@ example: example.o $(LIB)

install: $(LIB) $(INC) $(MAN)
mkdir -p $(DESTDIR)$(LIBDIR)
cp $(LIB) $(DESTDIR)$(LIBDIR)/$(LIB)
cp $(LIB) $(SLIB) $(DESTDIR)$(LIBDIR)
mkdir -p $(DESTDIR)$(INCDIR)
cp -t $(DESTDIR)$(INCDIR) $(INC)
mkdir -p $(DESTDIR)$(MANDIR)/man3
Expand Down

0 comments on commit a6d548e

Please sign in to comment.