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