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.1 7LIBRARY = bsddialog 8LIBRARY_SO = lib${LIBRARY:=.so} 9LIBRARY_A = lib${LIBRARY:=.a} 10HEADERS = bsddialog.h bsddialog_theme.h bsddialog_progressview.h 11SOURCES = barbox.c formbox.c infobox.c libbsddialog.c lib_util.c menubox.c \ 12 messagebox.c textbox.c theme.c timebox.c 13OBJECTS = ${SOURCES:.c=.o} 14CFLAGS += -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 -lformw -lncursesw -ltinfow 18 19.if defined(DEBUG) 20# `make -DDEBUG` 21CFLAGS = -g -fPIC -Wall -Wextra 22.else 23CFLAGS += -O2 -pipe -std=gnu99 -Wno-format-zero-length \ 24 -fstack-protector-strong -Qunused-arguments 25.endif 26 27LOCALBASE = /usr/local 28LN = ln -s -f 29RM = rm -f 30CP = cp 31GZIP = gzip -cn 32LDCONFIG = /sbin/ldconfig -m 33MAN = ${OUTPUT}.3 34GZIP = gzip -cn 35MANDIR = ${LOCALBASE}/share/man/man3 36INSTALL = install 37RM = rm -f 38 39all : man ${LIBRARY} 40 41${LIBRARY}: ${LIBRARY_SO} ${LIBRARY_A} 42 43${LIBRARY_SO}.${VERSION}: ${OBJECTS} 44 ${CC} ${LDFLAGS} ${.ALLSRC} -o ${LIBRARY_SO}.${VERSION} 45 46${LIBRARY_SO}: ${LIBRARY_SO}.${VERSION} 47 ${LN} ${LIBRARY_SO}.${VERSION} ${LIBRARY_SO} 48 49${LIBRARY_A}: ${OBJECTS} 50 ${AR} cr ${.TARGET} ${OBJECTS} 51 ${RANLIB} ${.TARGET} 52 53.c.o: 54 ${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 55 56man: 57 ${GZIP} ${LIBRARY}.3 > ${LIBRARY}.3.gz 58 59clean: 60 ${RM} ${LIBRARY_SO}* *.o *~ *.gz ${LIBRARY_A} 61 62 63install: 64 ${INSTALL} -m 644 ${HEADERS} ${LOCALBASE}/include 65 ${INSTALL} -m 644 -s ${LIBRARY_SO}.${VERSION} ${LOCALBASE}/lib/ 66 ${INSTALL} -l rs ${LOCALBASE}/lib/${LIBRARY_SO}.${VERSION} ${LOCALBASE}/lib/${LIBRARY_SO} 67 ${INSTALL} -m 644 ${LIBRARY_A} ${LOCALBASE}/lib 68 ${LDCONFIG} ${LOCALBASE}/lib 69 ${INSTALL} -m 644 ${LIBRARY}.3.gz ${MNADIR} 70 71unistall: 72 ${RM} ${LOCALBASE}/include/${LIBRARY}*.h 73 ${RM} ${LOCALBASE}/lib/${LIBRARY_SO} 74 ${RM} ${LOCALBASE}/lib/${LIBRARY_SO}.${VERSION} 75 ${LDCONFIG} ${LOCALBASE}/lib 76 ${RM} ${MANDIR}/${LIBRARY}.3.gz 77