2021-12-21 16:13:00 +01:00

77 lines
2.0 KiB
Makefile

# Any copyright is dedicated to the Public Domain, see:
# <http://creativecommons.org/publicdomain/zero/1.0/>
#
# Written in 2021 by Alfonso Sabato Siciliano
VERSION = 0.0.2
LIBRARY = bsddialog
LIBRARY_SO = lib${LIBRARY:=.so}
HEADERS = bsddialog.h bsddialog_theme.h bsddialog_progressview.h
SOURCES = barbox.c formbox.c infobox.c libbsddialog.c lib_util.c menubox.c \
messagebox.c textbox.c theme.c timebox.c
OBJECTS= ${SOURCES:.c=.o}
CFLAGS = -I/usr/local/include -fPIC -Wall -Wextra
LDFLAGS = -fstack-protector-strong -shared -Wl,-x -Wl,--fatal-warnings \
-Wl,--warn-shared-textrel -Wl,-soname,${LIBRARY_SO}.${VERSION}
.if defined(DEBUG)
# `make -DDEBUG`
CFLAGS += -g
.else
CFLAGS += -O2 -pipe -std=gnu99 -Wno-format-zero-length \
-fstack-protector-strong -Qunused-arguments
.endif
.if defined(PORTNCURSES)
# PORT ncurses `make -DPORTNCURSES`
CFLAGS += -DPORTNCURSES -I/usr/local/include
LDFLAGS += -L/usr/local/lib -lformw -lncursesw -ltinfow
.else
# BASE ncurses
LDFLAGS += -L/usr/lib -lformw -lncursesw -ltinfow
.endif
INSTALL_PREFIX=/usr/local
LN = ln -s -f
RM = rm -f
CP = cp
GZIP = gzip -cn
LDCONFIG = /sbin/ldconfig -m
MAN= ${OUTPUT}.3
GZIP= gzip -cn
MANDIR= /usr/local/share/man/man3
INSTALL= install
RM= rm -f
#all : man ${LIBRARY}
all : ${LIBRARY}
${LIBRARY}: ${OBJECTS}
${CC} ${LDFLAGS} ${.ALLSRC} -o ${LIBRARY_SO}.${VERSION}
# LN for devel
${LN} ${LIBRARY_SO}.${VERSION} ${LIBRARY_SO}
.c.o:
${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
man:
${GZIP} ${LIBRARY}.3 > ${LIBRARY}.3.gz
clean:
${RM} ${LIBRARY_SO}* *.o *~ *.gz
install:
${CP} ${LIBRARY}.h ${INSTALL_PREFIX}/include
${CP} ${LIBRARY_SO}.${VERSION} ${INSTALL_PREFIX}/lib/
${LN} ${INSTALL_PREFIX}/lib/${LIBRARY_SO}.${VERSION} ${INSTALL_PREFIX}/lib/${LIBRARY_SO}
${LDCONFIG} ${INSTALL_PREFIX}/lib
${CP} ${LIBRARY}.3.gz ${INSTALL_PREFIX}/man/man3/
unistall:
${RM} ${INSTALL_PREFIX}/include/${LIBRARY}.h
${RM} ${INSTALL_PREFIX}/lib/${LIBRARY_SO}
${RM} ${INSTALL_PREFIX}/lib/${LIBRARY_SO}.${VERSION}
${LDCONFIG} ${INSTALL_PREFIX}/lib
${RM} ${INSTALL_PREFIX}/man/man3/${LIBRARY}.3.gz