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