1# PUBLIC DOMAIN - NO WARRANTY, see: 2# <http://creativecommons.org/publicdomain/zero/1.0/> 3# 4# Written in 2021 by Alfonso Sabato Siciliano 5 6VERSION = 0.4 7LIBRARY = bsddialog 8LIBRARY_SO = lib${LIBRARY:=.so} 9LIBRARY_A = lib${LIBRARY:=.a} 10HEADERS = bsddialog.h bsddialog_theme.h bsddialog_progressview.h 11SOURCES = barbox.c calendarbox.c formbox.c infobox.c libbsddialog.c \ 12 lib_util.c menubox.c messagebox.c textbox.c theme.c timebox.c 13OBJECTS = ${SOURCES:.c=.o} 14CFLAGS += -D_XOPEN_SOURCE_EXTENDED -fPIC -Wall -Wextra 15LDFLAGS += -fstack-protector-strong -shared -Wl,-x -Wl,--fatal-warnings \ 16 -Wl,--warn-shared-textrel -Wl,-soname,${LIBRARY_SO}.${VERSION} \ 17 -L/usr/lib -lncursesw -ltinfow 18 19.if defined(DEBUG) 20# `make -DDEBUG` 21CFLAGS = -g -D_XOPEN_SOURCE_EXTENDED -fPIC -Wall -Wextra 22.else 23CFLAGS += -std=gnu99 -fstack-protector-strong 24.endif 25 26LOCALBASE = /usr/local 27LN = ln -s -f 28RM = rm -f 29CP = cp 30GZIP = gzip -cn 31LDCONFIG = /sbin/ldconfig -m 32MAN = ${OUTPUT}.3 33GZIP = gzip -cn 34MANDIR = ${LOCALBASE}/share/man/man3 35INSTALL = install 36RM = rm -f 37 38all : man ${LIBRARY} 39 40${LIBRARY}: ${LIBRARY_SO} ${LIBRARY_A} 41 42${LIBRARY_SO}.${VERSION}: ${OBJECTS} 43 ${CC} ${LDFLAGS} ${.ALLSRC} -o ${LIBRARY_SO}.${VERSION} 44 45${LIBRARY_SO}: ${LIBRARY_SO}.${VERSION} 46 ${LN} ${LIBRARY_SO}.${VERSION} ${LIBRARY_SO} 47 48${LIBRARY_A}: ${OBJECTS} 49 ${AR} cr ${.TARGET} ${OBJECTS} 50 ${RANLIB} ${.TARGET} 51 52.c.o: 53 ${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 54 55man: 56 ${GZIP} ${LIBRARY}.3 > ${LIBRARY}.3.gz 57 58clean: 59 ${RM} ${LIBRARY_SO}* *.o *~ *.gz ${LIBRARY_A} 60 61 62install: 63 ${INSTALL} -m 644 ${HEADERS} ${LOCALBASE}/include 64 ${INSTALL} -m 644 -s ${LIBRARY_SO}.${VERSION} ${LOCALBASE}/lib/ 65 ${INSTALL} -l rs ${LOCALBASE}/lib/${LIBRARY_SO}.${VERSION} ${LOCALBASE}/lib/${LIBRARY_SO} 66 ${INSTALL} -m 644 ${LIBRARY_A} ${LOCALBASE}/lib 67 ${LDCONFIG} ${LOCALBASE}/lib 68 ${INSTALL} -m 644 ${LIBRARY}.3.gz ${MANDIR} 69 70unistall: 71 ${RM} ${LOCALBASE}/include/${LIBRARY}*.h 72 ${RM} ${LOCALBASE}/lib/${LIBRARY_SO} 73 ${RM} ${LOCALBASE}/lib/${LIBRARY_SO}.${VERSION} 74 ${LDCONFIG} ${LOCALBASE}/lib 75 ${RM} ${MANDIR}/${LIBRARY}.3.gz 76