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