Files: ab3324be477b2663196e0cc73d96aa38d59da65a / Makefile
2738 bytesRaw
1 | # Configuration |
2 | |
3 | VERSION=$(shell ./genver.sh -r) |
4 | ENABLE_REGEX=1 # Enable regex probes |
5 | USELIBCONFIG=1 # Use libconfig? (necessary to use configuration files) |
6 | USELIBPCRE=1 # Use libpcre? (needed for regex on musl) |
7 | USELIBWRAP?= # Use libwrap? |
8 | USELIBCAP= # Use libcap? |
9 | COV_TEST= # Perform test coverage? |
10 | PREFIX?=/usr |
11 | BINDIR?=$(PREFIX)/sbin |
12 | MANDIR?=$(PREFIX)/share/man/man8 |
13 | |
14 | MAN=sslh.8.gz # man page name |
15 | |
16 | # End of configuration -- the rest should take care of |
17 | # itself |
18 | |
19 | ifneq ($(strip $(COV_TEST)),) |
20 | CFLAGS_COV=-fprofile-arcs -ftest-coverage |
21 | endif |
22 | |
23 | CC ?= gcc |
24 | CFLAGS ?=-Wall -g $(CFLAGS_COV) |
25 | |
26 | LIBS= |
27 | OBJS=common.o sslh-main.o probe.o tls.o |
28 | |
29 | ifneq ($(strip $(USELIBWRAP)),) |
30 | LIBS:=$(LIBS) -lwrap |
31 | CPPFLAGS+=-DLIBWRAP |
32 | endif |
33 | |
34 | ifneq ($(strip $(ENABLE_REGEX)),) |
35 | CPPFLAGS+=-DENABLE_REGEX |
36 | endif |
37 | |
38 | ifneq ($(strip $(USELIBPCRE)),) |
39 | CPPFLAGS+=-DLIBPCRE |
40 | LIBS:=$(LIBS) -lpcre |
41 | endif |
42 | |
43 | ifneq ($(strip $(USELIBCONFIG)),) |
44 | LIBS:=$(LIBS) -lconfig |
45 | CPPFLAGS+=-DLIBCONFIG |
46 | endif |
47 | |
48 | ifneq ($(strip $(USELIBCAP)),) |
49 | LIBS:=$(LIBS) -lcap |
50 | CPPFLAGS+=-DLIBCAP |
51 | endif |
52 | |
53 | all: sslh $(MAN) echosrv |
54 | |
55 | .c.o: *.h |
56 | $(CC) $(CFLAGS) $(CPPFLAGS) -c $< |
57 | |
58 | version.h: |
59 | ./genver.sh >version.h |
60 | |
61 | sslh: sslh-fork sslh-select |
62 | |
63 | sslh-fork: version.h $(OBJS) sslh-fork.o Makefile common.h |
64 | $(CC) $(CFLAGS) $(LDFLAGS) -o sslh-fork sslh-fork.o $(OBJS) $(LIBS) |
65 | #strip sslh-fork |
66 | |
67 | sslh-select: version.h $(OBJS) sslh-select.o Makefile common.h |
68 | $(CC) $(CFLAGS) $(LDFLAGS) -o sslh-select sslh-select.o $(OBJS) $(LIBS) |
69 | #strip sslh-select |
70 | |
71 | echosrv: $(OBJS) echosrv.o |
72 | $(CC) $(CFLAGS) $(LDFLAGS) -o echosrv echosrv.o probe.o common.o tls.o $(LIBS) |
73 | |
74 | $(MAN): sslh.pod Makefile |
75 | pod2man --section=8 --release=$(VERSION) --center=" " sslh.pod | gzip -9 - > $(MAN) |
76 | |
77 | # Create release: export clean tree and tag current |
78 | # configuration |
79 | release: |
80 | git archive master --prefix="sslh-$(VERSION)/" | gzip > /tmp/sslh-$(VERSION).tar.gz |
81 | |
82 | # generic install: install binary and man page |
83 | install: sslh $(MAN) |
84 | mkdir -p $(DESTDIR)/$(BINDIR) |
85 | mkdir -p $(DESTDIR)/$(MANDIR) |
86 | install -p sslh-fork $(DESTDIR)/$(BINDIR)/sslh |
87 | install -p -m 0644 $(MAN) $(DESTDIR)/$(MANDIR)/$(MAN) |
88 | |
89 | # "extended" install for Debian: install startup script |
90 | install-debian: install sslh $(MAN) |
91 | sed -e "s+^PREFIX=+PREFIX=$(PREFIX)+" scripts/etc.init.d.sslh > /etc/init.d/sslh |
92 | chmod 755 /etc/init.d/sslh |
93 | update-rc.d sslh defaults |
94 | |
95 | uninstall: |
96 | rm -f $(DESTDIR)$(BINDIR)/sslh $(DESTDIR)$(MANDIR)/$(MAN) $(DESTDIR)/etc/init.d/sslh $(DESTDIR)/etc/default/sslh |
97 | update-rc.d sslh remove |
98 | |
99 | distclean: clean |
100 | rm -f tags cscope.* |
101 | |
102 | clean: |
103 | rm -f sslh-fork sslh-select echosrv version.h $(MAN) *.o *.gcov *.gcno *.gcda *.png *.html *.css *.info |
104 | |
105 | tags: |
106 | ctags --globals -T *.[ch] |
107 | |
108 | cscope: |
109 | -find . -name "*.[chS]" >cscope.files |
110 | -cscope -b -R |
111 | |
112 | test: |
113 | ./t |
114 |
Built with git-ssb-web