splex/Makefile

69 lines
2.1 KiB
Makefile

-include config.mk
VERSION = 0.6
CFLAGS_STD ?= -std=c99 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -DNDEBUG
CFLAGS_STD += -DVERSION=\"${VERSION}\"
LDFLAGS_STD ?= -lc -lutil
STRIP ?= strip
INSTALL ?= install
PREFIX ?= /usr/local
SHAREDIR ?= ${PREFIX}/share
all: abduco splex
config.h:
cp config.def.h config.h
config.mk:
@touch $@
splex: config.h config.mk splex.c client.c debug.c forkpty-aix.c forkpty-sunos.c server.c
${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_AUTO} ${CFLAGS_EXTRA} splex.c ${LDFLAGS} ${LDFLAGS_STD} ${LDFLAGS_AUTO} -o $@
abduco: config.h config.mk abduco.c client.c debug.c forkpty-aix.c forkpty-sunos.c server.c
${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_AUTO} ${CFLAGS_EXTRA} abduco.c ${LDFLAGS} ${LDFLAGS_STD} ${LDFLAGS_AUTO} -o $@
debug: clean
make CFLAGS_EXTRA='${CFLAGS_DEBUG}'
clean:
@echo cleaning
@rm -f abduco splex abduco-*.tar.gz
dist: clean
@echo creating dist tarball
@git archive --prefix=abduco-${VERSION}/ -o abduco-${VERSION}.tar.gz HEAD
installdirs:
@${INSTALL} -d ${DESTDIR}${PREFIX}/bin \
${DESTDIR}${MANPREFIX}/man1
install: abduco installdirs
@echo installing executable file to ${DESTDIR}${PREFIX}/bin
@${INSTALL} -m 0755 abduco ${DESTDIR}${PREFIX}/bin
@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
@mkdir -p ${DESTDIR}${MANPREFIX}/man1
@sed "s/VERSION/${VERSION}/g" < abduco.1 > ${DESTDIR}${MANPREFIX}/man1/abduco.1
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/abduco.1
install-strip: install
${STRIP} ${DESTDIR}${PREFIX}/bin/abduco
install-completion:
@echo installing zsh completion file to ${DESTDIR}${SHAREDIR}/zsh/site-functions
@install -Dm644 contrib/abduco.zsh ${DESTDIR}${SHAREDIR}/zsh/site-functions/_abduco
uninstall:
@echo removing executable file from ${DESTDIR}${PREFIX}/bin
@rm -f ${DESTDIR}${PREFIX}/bin/abduco
@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
@rm -f ${DESTDIR}${MANPREFIX}/man1/abduco.1
@echo removing zsh completion file from ${DESTDIR}${SHAREDIR}/zsh/site-functions
@rm -f ${DESTDIR}${SHAREDIR}/zsh/site-functions/_abduco
.PHONY: all clean dist install installdirs install-strip install-completion uninstall debug