xref: /freebsd/contrib/bsddialog/lib/Makefile (revision ec0ea6efa1ad229d75c394c1a9b9cac33af2b1d3)
1# Any copyright is dedicated to the Public Domain, see:
2#     <http://creativecommons.org/publicdomain/zero/1.0/>
3#
4# Written in 2021 by Alfonso Sabato Siciliano
5
6VERSION = 0.0.1
7LIBRARY = bsddialog
8LIBRARY_SO = lib${LIBRARY:=.so}
9HEADERS = bsddialog.h bsddialog_theme.h
10SOURCES = barbox.c formbox.c infobox.c libbsddialog.c lib_util.c menubox.c \
11	messagebox.c textbox.c theme.c timebox.c
12OBJECTS= ${SOURCES:.c=.o}
13FBSDFLAGS= -O2 -pipe -std=gnu99 -Wno-format-zero-length \
14	-fstack-protector-strong -Qunused-arguments
15CFLAGS = -fPIC -Wall -Wextra
16.if defined(DEBUG)
17CFLAGS += -g
18.else
19CFLAGS += ${FBSDFLAGS}
20.endif
21LDFLAGS = -fstack-protector-strong -shared -Wl,-x -Wl,--fatal-warnings \
22	-Wl,--warn-shared-textrel -Wl,-soname,${LIBRARY_SO}.${VERSION}
23
24INSTALL_PREFIX=/usr/local
25LN = ln -s -f
26RM = rm -f
27CP = cp
28GZIP = gzip -cn
29LDCONFIG = /sbin/ldconfig -m
30
31.if defined(PORTNCURSES)
32# PORT ncurses `make -DPORTNCURSES`
33CFLAGS += -DPORTNCURSES -I/usr/local/include
34LDFLAGS += -L/usr/local/lib -lform -lncurses -ltinfo
35.else
36# BASE ncurses
37LDFLAGS += -L/usr/lib -lform -lncurses -ltinfo
38.endif
39
40MAN= ${OUTPUT}.3
41GZIP= gzip -cn
42MANDIR= /usr/local/share/man/man3
43
44INSTALL= install
45RM= rm -f
46
47#all : man ${LIBRARY}
48all : ${LIBRARY}
49
50${LIBRARY}: ${OBJECTS}
51	${CC} ${LDFLAGS} ${.ALLSRC} -o ${LIBRARY_SO}.${VERSION}
52	# LN for devel
53	${LN} ${LIBRARY_SO}.${VERSION} ${LIBRARY_SO}
54
55.c.o:
56	${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
57
58man:
59	${GZIP} ${LIBRARY}.3 > ${LIBRARY}.3.gz
60
61clean:
62	${RM} ${LIBRARY_SO}* *.o *~ *.gz
63
64
65install:
66	${CP} ${LIBRARY}.h ${INSTALL_PREFIX}/include
67	${CP} ${LIBRARY_SO}.${VERSION} ${INSTALL_PREFIX}/lib/
68	${LN} ${INSTALL_PREFIX}/lib/${LIBRARY_SO}.${VERSION} ${INSTALL_PREFIX}/lib/${LIBRARY_SO}
69	${LDCONFIG} ${INSTALL_PREFIX}/lib
70	${CP} ${LIBRARY}.3.gz ${INSTALL_PREFIX}/man/man3/
71
72unistall:
73	${RM} ${INSTALL_PREFIX}/include/${LIBRARY}.h
74	${RM} ${INSTALL_PREFIX}/lib/${LIBRARY_SO}
75	${RM} ${INSTALL_PREFIX}/lib/${LIBRARY_SO}.${VERSION}
76	${LDCONFIG} ${INSTALL_PREFIX}/lib
77	${RM} ${INSTALL_PREFIX}/man/man3/${LIBRARY}.3.gz
78