-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (38 loc) · 1.63 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
# libproxyprotocol is an ANSI C library to parse and create PROXY protocol v1 and v2 headers
# Copyright (C) 2022 Kosmas Valianos (kosmas.valianos@gmail.com)
#
# The libproxyprotocol library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# The libproxyprotocol library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
CFLAGS := -Wall -Wextra -Wshadow -Wimplicit-fallthrough=0 -ansi -fshort-enums -fpic
all: build tests example
build: libs_dir libs/libproxyprotocol.so
libs_dir:
mkdir -p libs
libs/libproxyprotocol.so: src/proxy_protocol.o
$(CC) -shared -o $@ $+
src/%.o: %.c src/proxy_protocol.h
$(CC) ${CFLAGS} -c -o $@ $<
tests: tests/test_libproxyprotocol
LD_LIBRARY_PATH=libs/ $<
tests/test_libproxyprotocol: tests/test.o libs/libproxyprotocol.so
$(CC) -Llibs/ ${CFLAGS} -o $@ $< -lproxyprotocol
example: examples/client_server
LD_LIBRARY_PATH=libs/ $<
examples/client_server: examples/client_server.o libs/libproxyprotocol.so
$(CC) -Llibs/ ${CFLAGS} -o $@ $< -lproxyprotocol
clean:
$(RM) src/*.o libs/libproxyprotocol.so
$(RM) tests/*.o tests/test_libproxyprotocol
$(RM) examples/*.o examples/client_server