blob: 48e4bb89b86a4af99081031f2081b25231d68398 [file] [log] [blame]
Jakub Grajciar7c5c40d2017-08-30 10:13:25 +02001# Copyright (c) 2017 Cisco and/or its affiliates.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at:
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14AUTOMAKE_OPTIONS = foreign subdir-objects
15
16ACLOCAL_AMFLAGS = -I m4
17
18AM_CPPFLAGS = -g -DMEMIF_DBG -DICMP_DBG
19
20.PHONY: release
21release:
22 $(MAKE) AM_CPPFLAGS="-O3"
23
24.PHONY: doc
25doc:
26 @echo Building doxygen documentation...
27 doxygen doxygen.conf
28 @echo Doxygen documentation built in docs directory.
29
30#
31# unit_test
32#
33unit_test_SOURCES = test/unit_test.c \
34 test/main_test.c \
35 test/socket_test.c \
36 src/main.c \
37 src/socket.c
38# macro MEMIF_UNIT_TEST -> compile functions without static keyword
39# and declare them in header files, so they can be called from unit tests
40unit_test_CPPFLAGS = $(AM_CPPFLAGS) -Itest -Isrc -DMEMIF_UNIT_TEST -g $(CHECK_CFLAGS)
41unit_test_LDADD = $(CHECK_LIBS)
42
43#
44# main lib
45#
46libmemif_la_SOURCES = src/main.c src/socket.c
47libmemif_la_CPPFLAGS = $(AM_CPPFLAGS) -Isrc
48
49#
50# ICMP responder example
51#
52icmpr_SOURCES = examples/icmp_responder/main.c examples/icmp_responder/icmp_proto.c
53icmpr_LDADD = libmemif.la
54icmpr_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -Iexamples/icmp_responder
55
56#
57# ICMP responder libmemif event polling example
58#
59icmpr_epoll_SOURCES = examples/icmp_responder-epoll/main.c \
60 examples/icmp_responder/icmp_proto.c
61icmpr_epoll_LDADD = libmemif.la
62icmpr_epoll_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -Iexamples/icmp_responder
63
64#
65# ICMP responder multi-thread example
66#
67icmpr_mt_SOURCES = examples/icmp_responder-mt/main.c \
68 examples/icmp_responder/icmp_proto.c
69icmpr_mt_LDADD = libmemif.la -lpthread
70icmpr_mt_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -Iexamples/icmp_responder
71
72noinst_PROGRAMS = icmpr icmpr-epoll icmpr-mt
73
74check_PROGRAMS = unit_test
75
76include_HEADERS = src/libmemif.h
77
78lib_LTLIBRARIES = libmemif.la
79
80TESTS = $(check_PROGRAMS)