netdev: do not allow devices to be opened with conflicting types
[cascardo/ovs.git] / datapath / Makefile.am
1 SUBDIRS =
2 if LINUX_ENABLED
3 SUBDIRS += linux
4 endif
5
6 EXTRA_DIST = $(dist_headers) $(dist_sources) $(dist_extras)
7
8 # Suppress warnings about GNU extensions in Modules.mk files.
9 AUTOMAKE_OPTIONS = -Wno-portability
10
11 include Modules.mk
12 include linux/Modules.mk
13
14 # The following is based on commands for the Automake "distdir" target.
15 distfiles: Makefile
16         @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
17         topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
18         list='$(DISTFILES)'; \
19         for file in $$list; do echo $$file; done | \
20           sed -e "s|^$$srcdirstrip/||;t" \
21               -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | sort -u > $@
22 CLEANFILES = distfiles
23
24 # Print name of all modules.
25 print-build-modules:
26         @if test -z "$(build_modules)"; \
27         then \
28            echo "Could not find any kernel module."; \
29            exit 1; \
30         fi
31         @echo "$(build_modules)" | tr '_' '-';
32
33 if !WIN32
34 COMPAT_GET_FUNCTIONS := find $(top_srcdir)/datapath/linux/compat -name "*.h" \
35         -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
36 COMPAT_GET_EXPORTS := find $(top_srcdir)/datapath/linux/compat -name "*.c" \
37         -exec sed -n 's/^EXPORT_SYMBOL[A-Z_]*(\([a-z_][a-z_]*\));$$/\1/p' {} \;
38 COMPAT_FUNCTIONS := $(shell $(COMPAT_GET_FUNCTIONS))
39 COMPAT_EXPORTS := $(shell $(COMPAT_GET_EXPORTS))
40
41 # Checks that all public functions are 'rpl_' or 'ovs_' prefixed.
42 # Checks that all EXPORT_SYMBOL_GPL() export 'rpl_' or 'ovs_' prefixed functions.
43 check-export-symbol:
44         @for fun_ in $(COMPAT_FUNCTIONS); do \
45            if ! grep -- $${fun_} $(top_srcdir)/datapath/linux/compat/build-aux/export-check-whitelist > /dev/null; then \
46               if ! echo $${fun_} | grep -q -E '^(rpl|ovs)_'; then \
47                  echo "error: $${fun_}() needs to be prefixed with 'rpl_' or 'ovs_'."; \
48                  exit 1; \
49               fi; \
50            fi; \
51         done
52         @for fun_ in $(COMPAT_EXPORTS); do \
53            if ! echo $${fun_} | grep -q -E '^(rpl|ovs)_'; then \
54               echo "error: $${fun_}() needs to be prefixed with 'rpl_' or 'ovs_'."; \
55               exit 1; \
56            fi; \
57         done
58
59 all-local: check-export-symbol
60 endif