~arivigo/sline

ref: 0.4.0 sline/Makefile -rw-r--r-- 1.6 KiB
c2a72b29Ariadna Vigo sline 0.4.0 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# See LICENSE file for copyright and license details.

.POSIX:

include config.mk

SRC = history.c sline.c strlcpy.c
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

all: options libsline.a

options:
	@echo Build options:
	@echo "CPPFLAGS = ${CPPFLAGS}"
	@echo "CFLAGS   = ${CFLAGS}"
	@echo "LDFLAGS  = ${LDFLAGS}"
	@echo "CC       = ${CC}"
	@echo

history.o: strlcpy.h

sline.o: history.h sline.h strlcpy.h

strlcpy.o: strlcpy.h

${OBJ}: config.mk

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'.
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}

install-man:
	mkdir -p ${DESTDIR}${MANPREFIX}/man3
	for manpage in ${MAN}; do \
		sed "s/VERSION/${VERSION}/g" $$manpage \
		    > ${DESTDIR}${MANPREFIX}/man3/$${manpage#man/} ; \
	done
	chmod 644 ${DESTDIR}${MANPREFIX}/man3/sline*

install: all install-man
	mkdir -p ${DESTDIR}${PREFIX}/lib
	cp -f libsline.a ${DESTDIR}${PREFIX}/lib
	chmod 644 ${DESTDIR}${PREFIX}/lib/libsline.a
	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 \
	   ${DESTDIR}${PREFIX}/include/sline.h \
	   ${DESTDIR}${MANPREFIX}/man3/sline*

.PHONY: all options clean install install-man uninstall