1 # 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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
14 AUTOMAKE_OPTIONS = foreign subdir-objects
16 ACLOCAL_AMFLAGS = -I m4
18 AM_CPPFLAGS = -g -DMEMIF_DBG -DICMP_DBG
20 SRCS_C := $(shell find . -name "*.c" )
21 SRCS_H := $(shell find . -name "*.h" )
25 $(MAKE) AM_CPPFLAGS="-O3"
29 @echo Building doxygen documentation...
31 @echo Doxygen documentation built in docs directory.
35 @echo Fixing code style...
36 indent $(SRCS_C) $(SRCS_H)
37 @echo Code style fixed!
42 unit_test_SOURCES = test/unit_test.c \
47 # macro MEMIF_UNIT_TEST -> compile functions without static keyword
48 # and declare them in header files, so they can be called from unit tests
49 unit_test_CPPFLAGS = $(AM_CPPFLAGS) -Itest -Isrc -DMEMIF_UNIT_TEST -g $(CHECK_CFLAGS)
50 unit_test_LDADD = $(CHECK_LIBS)
55 libmemif_la_SOURCES = src/main.c src/socket.c
56 libmemif_la_CPPFLAGS = $(AM_CPPFLAGS) -Isrc
59 # ICMP responder example
61 icmpr_SOURCES = examples/icmp_responder/main.c examples/icmp_responder/icmp_proto.c
62 icmpr_LDADD = libmemif.la
63 icmpr_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -Iexamples/icmp_responder
66 # ICMP responder libmemif event polling example
68 icmpr_epoll_SOURCES = examples/icmp_responder-epoll/main.c \
69 examples/icmp_responder/icmp_proto.c
70 icmpr_epoll_LDADD = libmemif.la -lpthread
71 icmpr_epoll_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -Iexamples/icmp_responder
74 # ICMP responder multi-thread example
76 icmpr_mt_SOURCES = examples/icmp_responder-mt/main.c \
77 examples/icmp_responder/icmp_proto.c
78 icmpr_mt_LDADD = libmemif.la -lpthread
79 icmpr_mt_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -Iexamples/icmp_responder
81 noinst_PROGRAMS = icmpr icmpr-epoll icmpr-mt
83 include_HEADERS = src/libmemif.h src/memif.h
85 lib_LTLIBRARIES = libmemif.la
88 check_PROGRAMS = unit_test
89 TESTS = $(check_PROGRAMS)