-all_modules = $(dist_modules)
-dist_modules = openflow
+# Some modules should be built and distributed, e.g. openflow.
+#
+# Some modules should be distributed but not built, e.g. we do not build
+# veth if the kernel in question already has it.
+#
+# Some modules should be built but not distributed, e.g. third-party
+# hwtable modules.
+both_modules = openflow
+build_modules = $(both_modules) # Modules to build
+dist_modules = $(both_modules) # Modules to distribute
openflow_sources = \
chain.c \
dist_sources = $(foreach module,$(dist_modules),$($(module)_sources))
dist_headers = $(foreach module,$(dist_modules),$($(module)_headers))
-all_sources = $(foreach module,$(all_modules),$($(module)_sources))
-all_headers = $(foreach module,$(all_modules),$($(module)_headers))
-all_links = $(notdir $(all_sources))
-all_objects = $(notdir $(patsubst %.c,%.o,$(all_sources)))
+build_sources = $(foreach module,$(build_modules),$($(module)_sources))
+build_headers = $(foreach module,$(build_modules),$($(module)_headers))
+build_links = $(notdir $(build_sources))
+build_objects = $(notdir $(patsubst %.c,%.o,$(build_sources)))
# Specify the module to build.
-all_modules += hwtable_dummy
+build_modules += hwtable_dummy
# Specify the source files that comprise the module.
hwtable_dummy_sources = \
override CFLAGS := $(OF_CFLAGS)
# Multipart objects
-list-multi := $(patsubst %,%_mod.o,$(all_modules))
+list-multi := $(patsubst %,%_mod.o,$(build_modules))
# Module objects that we can build
obj-m += $(list-multi)
define parts_template
$(1)_mod-objs = $$(patsubst %.c,%.o,$(notdir $($(1)_sources)))
endef
-$(foreach module,$(all_modules),$(eval $(call parts_template,$(module))))
+$(foreach module,$(build_modules),$(eval $(call parts_template,$(module))))
# Objects that export symbols
-export-objs = $(all_objects)
+export-objs = $(build_objects)
# Include the kernel's global Rules.make
include $(TOPDIR)/Rules.make
$(1)_mod.o: $($(1)_mod-objs)
$(LD) -r -o $$@ $($(1)_mod-objs)
endef
-$(foreach module,$(all_modules),$(eval $(call link_template,$(module))))
+$(foreach module,$(build_modules),$(eval $(call link_template,$(module))))
# Build system rewrite May 2008: Bobby Holley <bh10@stanford.edu>
#
include $(srcdir)/Modules.mk
include @HW_TABLES@
-default: $(all_links)
-$(foreach m,$(all_modules), \
+default: $(build_links)
+$(foreach m,$(build_modules), \
$(foreach s,$($(m)_sources), \
$(eval $(notdir $(s)): ; ln -s $(srcdir)/../$(s) .)))
check: all
clean:
rm -f *.o *_mod.o .*.o.flags
- for d in $(all_links); do if test -h $$d; then rm $$d; fi; done
+ for d in $(build_links); do if test -h $$d; then rm $$d; fi; done
ifneq (,$(KSRC))
-dist_modules += compat24
+both_modules += compat24
compat24_sources = \
linux-2.4/compat-2.4/attr.c \
# right place, even though it's conceptually incorrect.
NOSTDINC_FLAGS += -I$(srcdir)/compat-2.6 -I$(srcdir)/compat-2.6/include
-obj-m := $(patsubst %,%_mod.o,$(all_modules))
+obj-m := $(patsubst %,%_mod.o,$(build_modules))
define module_template
$(1)_mod-y = $$(notdir $$(patsubst %.c,%.o,$($(1)_sources)))
endef
-$(foreach module,$(all_modules),$(eval $(call module_template,$(module))))
+$(foreach module,$(build_modules),$(eval $(call module_template,$(module))))
include $(srcdir)/Modules.mk
include @HW_TABLES@
-default: $(all_links)
+default: $(build_links)
-$(foreach s,$(sort $(foreach m,$(all_modules),$($(m)_sources))), \
+$(foreach s,$(sort $(foreach m,$(build_modules),$($(m)_sources))), \
$(eval $(notdir $(s)): ; ln -s $(srcdir)/../$(s) $@))
distclean: clean
check: all
clean:
rm -f *.o *.ko *_mod.* Module.symvers *.cmd kcompat.h.new
- for d in $(all_links); do if test -h $$d; then rm $$d; fi; done
+ for d in $(build_links); do if test -h $$d; then rm $$d; fi; done
ifneq ($(KSRC),)
-dist_modules += brcompat
-
openflow_sources += \
linux-2.6/compat-2.6/genetlink-openflow.c \
linux-2.6/compat-2.6/random32.c
-
openflow_headers += \
linux-2.6/compat-2.6/compat26.h \
linux-2.6/compat-2.6/include/asm-generic/bug.h \
linux-2.6/compat-2.6/include/net/genetlink.h \
linux-2.6/compat-2.6/include/net/netlink.h
+both_modules += brcompat
brcompat_sources = \
linux-2.6/compat-2.6/genetlink-brcompat.c \
brcompat.c \