Files: 6cc33820d166bc790c79f8e42aec8f53bcefd2ba / Makefile
3074 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 | $(OBJS): version.h |
71 | |
72 | sslh-fork: version.h $(OBJS) sslh-fork.o Makefile common.h |
73 | $(CC) $(CFLAGS) $(LDFLAGS) -o sslh-fork sslh-fork.o $(OBJS) $(LIBS) |
74 | #strip sslh-fork |
75 | |
76 | sslh-select: version.h $(OBJS) sslh-select.o Makefile common.h |
77 | $(CC) $(CFLAGS) $(LDFLAGS) -o sslh-select sslh-select.o $(OBJS) $(LIBS) |
78 | #strip sslh-select |
79 | |
80 | systemd-sslh-generator: systemd-sslh-generator.o |
81 | $(CC) $(CFLAGS) $(LDFLAGS) -o systemd-sslh-generator systemd-sslh-generator.o -lconfig |
82 | |
83 | echosrv: $(OBJS) echosrv.o |
84 | $(CC) $(CFLAGS) $(LDFLAGS) -o echosrv echosrv.o probe.o common.o tls.o $(LIBS) |
85 | |
86 | $(MAN): sslh.pod Makefile |
87 | pod2man --section=8 --release=$(VERSION) --center=" " sslh.pod | gzip -9 - > $(MAN) |
88 | |
89 | # Create release: export clean tree and tag current |
90 | # configuration |
91 | release: |
92 | git archive master --prefix="sslh-$(VERSION)/" | gzip > /tmp/sslh-$(VERSION).tar.gz |
93 | |
94 | # generic install: install binary and man page |
95 | install: sslh $(MAN) |
96 | mkdir -p $(DESTDIR)/$(BINDIR) |
97 | mkdir -p $(DESTDIR)/$(MANDIR) |
98 | install -p sslh-fork $(DESTDIR)/$(BINDIR)/sslh |
99 | install -p -m 0644 $(MAN) $(DESTDIR)/$(MANDIR)/$(MAN) |
100 | |
101 | # "extended" install for Debian: install startup script |
102 | install-debian: install sslh $(MAN) |
103 | sed -e "s+^PREFIX=+PREFIX=$(PREFIX)+" scripts/etc.init.d.sslh > /etc/init.d/sslh |
104 | chmod 755 /etc/init.d/sslh |
105 | update-rc.d sslh defaults |
106 | |
107 | uninstall: |
108 | rm -f $(DESTDIR)$(BINDIR)/sslh $(DESTDIR)$(MANDIR)/$(MAN) $(DESTDIR)/etc/init.d/sslh $(DESTDIR)/etc/default/sslh |
109 | update-rc.d sslh remove |
110 | |
111 | distclean: clean |
112 | rm -f tags cscope.* |
113 | |
114 | clean: |
115 | rm -f sslh-fork sslh-select echosrv version.h $(MAN) systemd-sslh-generator *.o *.gcov *.gcno *.gcda *.png *.html *.css *.info |
116 | |
117 | tags: |
118 | ctags --globals -T *.[ch] |
119 | |
120 | cscope: |
121 | -find . -name "*.[chS]" >cscope.files |
122 | -cscope -b -R |
123 | |
124 | test: |
125 | ./t |
126 |
Built with git-ssb-web