~arivigo/sline

42f17154ecceef68ba6d0c3de2ebe4ad858ed95c — Ariadna Vigo 7 months ago 24e9f2b
Dyn library support
3 files changed, 21 insertions(+), 8 deletions(-)

M .gitignore
M Makefile
M config.mk
M .gitignore => .gitignore +1 -1
@@ 1,4 1,4 @@
*.o
*.tar.gz
libsline.a
libsline.*
sline_test

M Makefile => Makefile +16 -6
@@ 9,7 9,7 @@ OBJ = ${SRC:%.c=%.o}
MAN = man/sline.3 man/sline_end.3 man/sline_errmsg.3 man/sline_setup.3 \
      man/sline_set_prompt.3 man/sline_version.3

all: options libsline.a
all: options libsline.a ${LIBFULLNAME}

options:
	@echo Build options:


@@ 27,17 27,23 @@ strlcpy.o: strlcpy.h

${OBJ}: config.mk

.c.o:
	${CC} ${CPPFLAGS} ${CFLAGS} -fPIC -c -o $@ $<

libsline.a: ${OBJ}
	ar -rcs $@ ${OBJ}

# sline_test: Test program which will always use the development version of 
# sline as compiled in the source directory, never the library installed on the 
# system. This program isn't installed by `make install'.
${LIBFULLNAME}: ${OBJ}
	${CC} ${LDFLAGS} -o $@ ${OBJ}

# sline_test: Test program which will always use the *static* development 
# version of sline as compiled in the source directory, never the library 
# installed on the system. This program isn't installed by `make install'.
sline_test: options libsline.a sline.h sline_test.c
	${CC} ${CFLAGS} ${CPPFLAGS} -o $@ sline_test.c libsline.a

clean:
	rm -f libsline.a sline_test ${OBJ}
	rm -f libsline.a ${LIBFULLNAME} sline_test ${OBJ}

install-man:
	mkdir -p ${DESTDIR}${MANPREFIX}/man3


@@ 51,12 57,16 @@ install: all install-man
	mkdir -p ${DESTDIR}${PREFIX}/lib
	cp -f libsline.a ${DESTDIR}${PREFIX}/lib
	chmod 644 ${DESTDIR}${PREFIX}/lib/libsline.a
	cp -f ${LIBFULLNAME} ${DESTDIR}${PREFIX}/lib/${LIBFULLNAME}
	chmod 755 ${DESTDIR}${PREFIX}/lib/${LIBFULLNAME}
	ln -s -f ${LIBFULLNAME} ${DESTDIR}${PREFIX}/lib/${LIBSONAME}
	ln -s -f ${LIBFULLNAME} ${DESTDIR}${PREFIX}/lib/libsline.so
	mkdir -p ${DESTDIR}${PREFIX}/include
	cp -f sline.h ${DESTDIR}${PREFIX}/include
	chmod 644 ${DESTDIR}${PREFIX}/include/sline.h

uninstall:
	rm -f ${DESTDIR}${PREFIX}/lib/libsline.a \
	rm -f ${DESTDIR}${PREFIX}/lib/libsline.* \
	   ${DESTDIR}${PREFIX}/include/sline.h \
	   ${DESTDIR}${MANPREFIX}/man3/sline*


M config.mk => config.mk +4 -1
@@ 1,6 1,9 @@
# sline version
VERSION = 0.6.3

LIBFULLNAME = libsline.so.${VERSION}
LIBSONAME = libsline.so.0

# Customize below to your needs

# Paths


@@ 11,7 14,7 @@ MANPREFIX = ${PREFIX}/man
CPPFLAGS = -DVERSION=\"${VERSION}\" -D_POSIX_C_SOURCE=200809L
#CFLAGS = -g -std=c99 -Wpedantic -Wall -Wextra
CFLAGS = -std=c99 -Wpedantic -Wall -Wextra
LDFLAGS =
LDFLAGS = -shared -Wl,-soname,${LIBSONAME}

# Compiler and linker
CC = cc