blob: f66ef9695fa5523ce5dbe26fc2be1288593630bb [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
Jakub Grajciarb467b2a2017-09-14 14:12:10 +020020SRCS_C := $(shell find . -name "*.c" )
21SRCS_H := $(shell find . -name "*.h" )
22
Jakub Grajciar7c5c40d2017-08-30 10:13:25 +020023.PHONY: release
24release:
25 $(MAKE) AM_CPPFLAGS="-O3"
26
27.PHONY: doc
28doc:
29 @echo Building doxygen documentation...
30 doxygen doxygen.conf
31 @echo Doxygen documentation built in docs directory.
32
Jakub Grajciarb467b2a2017-09-14 14:12:10 +020033.PHONY: fixstyle
34fixstyle:
35 @echo Fixing code style...
36 indent $(SRCS_C) $(SRCS_H)
37 @echo Code style fixed!
38
Jakub Grajciar7c5c40d2017-08-30 10:13:25 +020039#
40# unit_test
41#
42unit_test_SOURCES = test/unit_test.c \
43 test/main_test.c \
44 test/socket_test.c \
45 src/main.c \
46 src/socket.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
49unit_test_CPPFLAGS = $(AM_CPPFLAGS) -Itest -Isrc -DMEMIF_UNIT_TEST -g $(CHECK_CFLAGS)
50unit_test_LDADD = $(CHECK_LIBS)
51
52#
53# main lib
54#
55libmemif_la_SOURCES = src/main.c src/socket.c
Damjan Marion23d4e8a2018-03-26 14:09:38 +020056libmemif_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src
Jakub Grajciar7c5c40d2017-08-30 10:13:25 +020057
58#
59# ICMP responder example
60#
61icmpr_SOURCES = examples/icmp_responder/main.c examples/icmp_responder/icmp_proto.c
62icmpr_LDADD = libmemif.la
Damjan Marion23d4e8a2018-03-26 14:09:38 +020063icmpr_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/examples/icmp_responder
Jakub Grajciar7c5c40d2017-08-30 10:13:25 +020064
65#
66# ICMP responder libmemif event polling example
67#
68icmpr_epoll_SOURCES = examples/icmp_responder-epoll/main.c \
69 examples/icmp_responder/icmp_proto.c
Jakub Grajciarfab38902017-11-07 11:04:05 +010070icmpr_epoll_LDADD = libmemif.la -lpthread
Damjan Marion23d4e8a2018-03-26 14:09:38 +020071icmpr_epoll_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/examples/icmp_responder
Jakub Grajciar7c5c40d2017-08-30 10:13:25 +020072
73#
74# ICMP responder multi-thread example
75#
76icmpr_mt_SOURCES = examples/icmp_responder-mt/main.c \
77 examples/icmp_responder/icmp_proto.c
78icmpr_mt_LDADD = libmemif.la -lpthread
Damjan Marion23d4e8a2018-03-26 14:09:38 +020079icmpr_mt_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/examples/icmp_responder
Jakub Grajciar7c5c40d2017-08-30 10:13:25 +020080
Jakub Grajciar93a5dd12018-08-20 14:26:32 +020081#
82# ICMP responder external buffer example
83#
84icmpr_eb_SOURCES = examples/icmp_responder-eb/main.c\
85 examples/icmp_responder/icmp_proto.c
86icmpr_eb_LDADD = libmemif.la -lpthread
87icmpr_eb_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/examples/icmp_responder
88
89noinst_PROGRAMS = icmpr icmpr-epoll icmpr-mt icmpr-eb
Jakub Grajciar7c5c40d2017-08-30 10:13:25 +020090
Damjan Marion23d4e8a2018-03-26 14:09:38 +020091include_HEADERS = src/libmemif.h
Jakub Grajciar7c5c40d2017-08-30 10:13:25 +020092
93lib_LTLIBRARIES = libmemif.la
94
Jakub Grajciarc62a63d2017-11-20 13:11:50 +010095if USE_CHECK
96check_PROGRAMS = unit_test
Jakub Grajciar7c5c40d2017-08-30 10:13:25 +020097TESTS = $(check_PROGRAMS)
Jakub Grajciarc62a63d2017-11-20 13:11:50 +010098endif