2013-07-10 17:09:40 -04:00
|
|
|
# Configuration
|
|
|
|
|
2013-08-06 08:29:56 -04:00
|
|
|
VERSION=$(shell ./genver.sh -r)
|
2013-07-10 17:15:38 -04:00
|
|
|
USELIBCONFIG=1 # Use libconfig? (necessary to use configuration files)
|
2015-07-09 09:31:42 -04:00
|
|
|
USELIBPCRE=1 # Use libpcre? (necessary to use regex probe)
|
2014-07-22 13:36:29 -04:00
|
|
|
USELIBWRAP?= # Use libwrap?
|
2014-02-24 11:52:58 -05:00
|
|
|
USELIBCAP= # Use libcap?
|
2013-07-10 17:14:15 -04:00
|
|
|
COV_TEST= # Perform test coverage?
|
2015-06-22 00:25:18 -04:00
|
|
|
PREFIX?=/usr
|
|
|
|
BINDIR?=$(PREFIX)/sbin
|
|
|
|
MANDIR?=$(PREFIX)/share/man/man8
|
2013-07-10 17:09:40 -04:00
|
|
|
|
2013-07-10 17:10:43 -04:00
|
|
|
MAN=sslh.8.gz # man page name
|
2013-07-10 17:09:40 -04:00
|
|
|
|
|
|
|
# End of configuration -- the rest should take care of
|
|
|
|
# itself
|
|
|
|
|
2013-07-10 17:14:15 -04:00
|
|
|
ifneq ($(strip $(COV_TEST)),)
|
|
|
|
CFLAGS_COV=-fprofile-arcs -ftest-coverage
|
|
|
|
endif
|
|
|
|
|
2013-07-10 17:19:33 -04:00
|
|
|
CC ?= gcc
|
|
|
|
CFLAGS ?=-Wall -g $(CFLAGS_COV)
|
2013-07-10 17:09:40 -04:00
|
|
|
|
2013-09-17 00:17:23 -04:00
|
|
|
LIBS=
|
2015-07-12 23:10:53 -04:00
|
|
|
OBJS=common.o sslh-main.o probe.o tls.o
|
2013-07-10 17:09:40 -04:00
|
|
|
|
|
|
|
ifneq ($(strip $(USELIBWRAP)),)
|
|
|
|
LIBS:=$(LIBS) -lwrap
|
2013-09-17 00:18:15 -04:00
|
|
|
CPPFLAGS+=-DLIBWRAP
|
2013-07-10 17:09:40 -04:00
|
|
|
endif
|
|
|
|
|
2015-07-09 09:31:42 -04:00
|
|
|
ifneq ($(strip $(USELIBPCRE)),)
|
|
|
|
CPPFLAGS+=-DLIBPCRE
|
|
|
|
endif
|
|
|
|
|
2013-07-10 17:15:38 -04:00
|
|
|
ifneq ($(strip $(USELIBCONFIG)),)
|
|
|
|
LIBS:=$(LIBS) -lconfig
|
2013-09-17 00:18:15 -04:00
|
|
|
CPPFLAGS+=-DLIBCONFIG
|
2013-07-10 17:15:38 -04:00
|
|
|
endif
|
|
|
|
|
2013-10-20 14:59:00 -04:00
|
|
|
ifneq ($(strip $(USELIBCAP)),)
|
|
|
|
LIBS:=$(LIBS) -lcap
|
|
|
|
CPPFLAGS+=-DLIBCAP
|
|
|
|
endif
|
|
|
|
|
2013-07-10 17:14:15 -04:00
|
|
|
all: sslh $(MAN) echosrv
|
2013-07-10 17:10:43 -04:00
|
|
|
|
2013-07-10 17:12:42 -04:00
|
|
|
.c.o: *.h
|
2013-09-17 00:18:15 -04:00
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
|
2013-07-10 17:12:42 -04:00
|
|
|
|
2013-08-06 08:29:56 -04:00
|
|
|
version.h:
|
|
|
|
./genver.sh >version.h
|
2013-07-10 17:12:42 -04:00
|
|
|
|
2013-09-17 02:41:10 -04:00
|
|
|
sslh: sslh-fork sslh-select
|
2013-07-10 17:12:42 -04:00
|
|
|
|
2013-09-17 02:41:10 -04:00
|
|
|
sslh-fork: version.h $(OBJS) sslh-fork.o Makefile common.h
|
2013-09-17 00:17:23 -04:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o sslh-fork sslh-fork.o $(OBJS) $(LIBS)
|
2013-07-10 17:14:15 -04:00
|
|
|
#strip sslh-fork
|
2013-07-10 17:12:42 -04:00
|
|
|
|
2013-09-17 02:41:10 -04:00
|
|
|
sslh-select: version.h $(OBJS) sslh-select.o Makefile common.h
|
2013-09-17 00:17:23 -04:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o sslh-select sslh-select.o $(OBJS) $(LIBS)
|
2013-07-10 17:14:15 -04:00
|
|
|
#strip sslh-select
|
2013-07-10 17:12:42 -04:00
|
|
|
|
2013-07-10 17:14:15 -04:00
|
|
|
echosrv: $(OBJS) echosrv.o
|
2015-07-12 23:10:53 -04:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o echosrv echosrv.o probe.o common.o tls.o $(LIBS)
|
2013-07-10 17:09:40 -04:00
|
|
|
|
2013-07-10 17:10:43 -04:00
|
|
|
$(MAN): sslh.pod Makefile
|
|
|
|
pod2man --section=8 --release=$(VERSION) --center=" " sslh.pod | gzip -9 - > $(MAN)
|
|
|
|
|
2013-07-10 17:19:33 -04:00
|
|
|
# Create release: export clean tree and tag current
|
|
|
|
# configuration
|
|
|
|
release:
|
2013-07-27 10:25:04 -04:00
|
|
|
git archive master --prefix="sslh-$(VERSION)/" | gzip > /tmp/sslh-$(VERSION).tar.gz
|
2013-07-10 17:19:33 -04:00
|
|
|
|
2013-07-10 17:10:43 -04:00
|
|
|
# generic install: install binary and man page
|
|
|
|
install: sslh $(MAN)
|
2015-06-22 00:25:18 -04:00
|
|
|
mkdir -p $(DESTDIR)/$(BINDIR)
|
|
|
|
mkdir -p $(DESTDIR)/$(MANDIR)
|
|
|
|
install -p sslh-fork $(DESTDIR)/$(BINDIR)/sslh
|
|
|
|
install -p -m 0644 $(MAN) $(DESTDIR)/$(MANDIR)/$(MAN)
|
2013-07-10 17:10:43 -04:00
|
|
|
|
|
|
|
# "extended" install for Debian: install startup script
|
|
|
|
install-debian: install sslh $(MAN)
|
|
|
|
sed -e "s+^PREFIX=+PREFIX=$(PREFIX)+" scripts/etc.init.d.sslh > /etc/init.d/sslh
|
|
|
|
chmod 755 /etc/init.d/sslh
|
|
|
|
update-rc.d sslh defaults
|
|
|
|
|
|
|
|
uninstall:
|
2015-06-22 00:25:18 -04:00
|
|
|
rm -f $(DESTDIR)$(BINDIR)/sslh $(DESTDIR)$(MANDIR)/$(MAN) $(DESTDIR)/etc/init.d/sslh $(DESTDIR)/etc/default/sslh
|
2013-07-10 17:10:43 -04:00
|
|
|
update-rc.d sslh remove
|
2013-07-10 17:09:40 -04:00
|
|
|
|
2013-08-05 13:33:32 -04:00
|
|
|
distclean: clean
|
2013-08-05 13:33:34 -04:00
|
|
|
rm -f tags cscope.*
|
2013-08-05 13:33:32 -04:00
|
|
|
|
2013-07-10 17:10:43 -04:00
|
|
|
clean:
|
2013-09-23 18:30:40 -04:00
|
|
|
rm -f sslh-fork sslh-select echosrv version.h $(MAN) *.o *.gcov *.gcno *.gcda *.png *.html *.css *.info
|
2013-07-10 17:12:42 -04:00
|
|
|
|
|
|
|
tags:
|
2013-07-10 17:16:50 -04:00
|
|
|
ctags --globals -T *.[ch]
|
2013-07-10 17:12:42 -04:00
|
|
|
|
2013-08-05 13:33:34 -04:00
|
|
|
cscope:
|
|
|
|
-find . -name "*.[chS]" >cscope.files
|
|
|
|
-cscope -b -R
|
|
|
|
|
2013-07-10 17:12:42 -04:00
|
|
|
test:
|
|
|
|
./t
|