8cdc60d9440c912b4ab3e8c9f1960866f9ff58c1
[vpp.git] / src / vpp.am
1 # Copyright (c) 2015 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
14 bin_PROGRAMS += bin/vpp
15
16 bin_vpp_SOURCES =                               \
17   vpp/vnet/main.c                               \
18   vpp/app/vpe_cli.c                             \
19   vpp/app/version.c                             \
20   vpp/oam/oam.c                                 \
21   vpp/stats/stats.c
22
23 bin_vpp_SOURCES +=                              \
24   vpp/api/api.c                                 \
25   vpp/api/custom_dump.c                         \
26   vpp/api/json_format.c
27
28 if WITH_APICLI
29   bin_vpp_SOURCES +=                            \
30   vpp/api/api_format.c                          \
31   vpp/api/api_main.c                            \
32   vpp/api/plugin.c                              \
33   vpp/api/plugin.h
34 endif
35
36 # comment out to disable stats upload to gmond
37
38 bin_vpp_CFLAGS = @APICLI@
39 bin_vpp_SOURCES +=                              \
40   vpp/api/gmon.c
41
42 nobase_include_HEADERS +=                       \
43   vpp/api/vpe_all_api_h.h                       \
44   vpp/api/vpe_msg_enum.h                        \
45   vpp/api/vpe.api.h
46
47 API_FILES += vpp/api/vpe.api
48
49 BUILT_SOURCES += .version
50
51 vpp/app/version.o:      vpp/app/version.h
52
53 .PHONY: .version
54
55 VPP_VERSION = $(shell $(srcdir)/scripts/version)
56
57 # update version.h only when version changes, to avoid
58 # unnecessary re-linking of vpp binary
59
60 .version:
61         @if [ "$$(cat .version 2> /dev/null)" != "$(VPP_VERSION)" ] ; then              \
62           f="vpp/app/version.h"                                                         ;\
63           echo "  VERSION  $$f ($(VPP_VERSION))"                                        ;\
64           echo $(VPP_VERSION) > .version                                                ;\
65           echo "#define VPP_BUILD_DATE \"$$(date)\"" > $$f                              ;\
66           echo "#define VPP_BUILD_USER \"$$(whoami)\"" >> $$f                           ;\
67           echo "#define VPP_BUILD_HOST \"$$(hostname)\"" >> $$f                         ;\
68           echo -n "#define VPP_BUILD_TOPDIR " >> $$f                                    ;\
69           echo "\"$$(cd $(srcdir) && git rev-parse --show-toplevel)\"" >> $$f           ;\
70           echo "#define VPP_BUILD_VER \"$(VPP_VERSION)\"" >> $$f                        ;\
71         fi
72
73 bin_vpp_LDADD = \
74   libvlibmemory.la \
75   libvlib.la \
76   libvnet.la \
77   libsvm.la \
78   libsvmdb.la \
79   libvppinfra.la \
80   -lrt -lm -lpthread -ldl
81
82 bin_vpp_LDFLAGS = -Wl,--export-dynamic
83
84 if ENABLE_TESTS
85 noinst_PROGRAMS += bin/test_client
86
87 bin_test_client_SOURCES = \
88   vpp/api/test_client.c
89
90 bin_test_client_LDADD = \
91   libvlibmemoryclient.la \
92   libsvm.la \
93   libvppinfra.la \
94   -lpthread -lm -lrt
95
96 noinst_PROGRAMS += bin/test_client bin/test_ha
97
98 bin_test_ha_SOURCES = \
99   vpp/api/test_ha.c
100
101 bin_test_ha_LDADD = \
102   libvlibmemoryclient.la \
103   libvlibapi.la \
104   libsvm.la \
105   libvppinfra.la \
106   -lpthread -lm -lrt
107 endif
108
109 noinst_PROGRAMS += bin/summary_stats_client
110
111 bin_summary_stats_client_SOURCES = \
112   vpp/api/summary_stats_client.c
113
114 bin_summary_stats_client_LDADD = \
115   libvlibmemoryclient.la \
116   libsvm.la \
117   libvppinfra.la \
118   -lpthread -lm -lrt
119
120 bin_PROGRAMS += bin/vpp_get_metrics
121
122 bin_vpp_get_metrics_SOURCES = \
123   vpp/api/vpp_get_metrics.c
124
125 bin_vpp_get_metrics_LDADD = \
126   libsvmdb.la \
127   libsvm.la \
128   libvppinfra.la \
129   -lpthread -lm -lrt
130
131 CLEANFILES += vpp/app/version.h
132
133 # vi:syntax=automake