summaryrefslogtreecommitdiff
path: root/datapath/Makefile.am
blob: e4dd0c7044d4653b3f83b525953178225f148622 (plain)
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
50
51
52
53
54
55
56
57
58
59
60
SUBDIRS =
if LINUX_ENABLED
SUBDIRS += linux
endif

EXTRA_DIST = $(dist_headers) $(dist_sources) $(dist_extras)

# Suppress warnings about GNU extensions in Modules.mk files.
AUTOMAKE_OPTIONS = -Wno-portability

include Modules.mk
include linux/Modules.mk

# The following is based on commands for the Automake "distdir" target.
distfiles: Makefile
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
	for file in $$list; do echo $$file; done | \
	  sed -e "s|^$$srcdirstrip/||;t" \
	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | sort -u > $@
CLEANFILES = distfiles

# Print name of all modules.
print-build-modules:
	@if test -z "$(build_modules)"; \
	then \
	   echo "Could not find any kernel module."; \
	   exit 1; \
	fi
	@echo "$(build_modules)" | tr '_' '-';

if !WIN32
COMPAT_GET_FUNCTIONS := find $(top_srcdir)/datapath/linux/compat -name "*.h" \
	-exec sed -n '/^[a-z][a-z]* \*\?[A-Za-z0-9_][A-Za-z0-9_]*([a-z]/p; /^struct [a-z0-9_][a-z0-9_]* \*\?[A-Za-z0-9_][A-Za-z0-9_]*([a-z]/p' {} \; | tr -d '*' | cut -d '(' -f1 | rev | cut -d ' ' -f1 | rev
COMPAT_GET_EXPORTS := find $(top_srcdir)/datapath/linux/compat -name "*.c" \
	-exec sed -n 's/^EXPORT_SYMBOL[A-Z_]*(\([a-z_][a-z_]*\));$$/\1/p' {} \;
COMPAT_FUNCTIONS := $(shell $(COMPAT_GET_FUNCTIONS))
COMPAT_EXPORTS := $(shell $(COMPAT_GET_EXPORTS))

# Checks that all public functions are 'rpl_' or 'ovs_' prefixed.
# Checks that all EXPORT_SYMBOL_GPL() export 'rpl_' or 'ovs_' prefixed functions.
check-export-symbol:
	@for fun_ in $(COMPAT_FUNCTIONS); do \
	   if ! grep -- $${fun_} $(top_srcdir)/datapath/linux/compat/build-aux/export-check-allow-list > /dev/null; then \
	      if ! echo $${fun_} | grep -q -E '^(rpl|ovs)_'; then \
	         echo "error: $${fun_}() needs to be prefixed with 'rpl_' or 'ovs_'."; \
	         exit 1; \
	      fi; \
	   fi; \
	done
	@for fun_ in $(COMPAT_EXPORTS); do \
	   if ! echo $${fun_} | grep -q -E '^(rpl|ovs)_'; then \
	      echo "error: $${fun_}() needs to be prefixed with 'rpl_' or 'ovs_'."; \
	      exit 1; \
	   fi; \
	done

all-local: check-export-symbol
endif