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