Hi! > >> Makefile example: > >> > >> top_srcdir ?= ../../../.. > >> > >> include $(top_srcdir)/include/mk/testcases.mk > >> > >> REQ_VERSION_MAJOR := 2 > >> REQ_VERSION_PATCH := 6 > >> > >> MODULE_NAMES := Module01 Module02 ... > >> MAKE_TARGETS := test01 test02 ... > >> > >> include $(top_srcdir)/include/mk/module.mk > >> include $(top_srcdir)/include/mk/generic_leaf_target.mk > > I redefine top_srcdir to make it absolute because when "make" cd to > kernel build directory and once again include LTP Makefile, the first > include of env_pre.mk leads to non-existed file and kernel build stops > with error. If top_srcdir absolute, no include errors in the kernel build. > > Actually we don't need this include of env_pre.mk in the kernel build > system because it does nothing with the module build and usually it > accomplished with the KERNELRELEASE variable or separate kbuild file. > But to preserve the LTP Makefile API and also have a chance to build > user-space tests, we include it and tell kernel build system that this > one have already been loaded (exporting ENV_PRE_LOAD).
Hmm, I think that it may be more clear to put the linux kernel Makefile part to the Makefile that is in the test directory, so that it will became: ifneq ($(KERNELRELEASE),) obj-m := $(addsuffix .o, $(MODULE_NAMES)) else top_srcdir ?= ../../../.. include $(top_srcdir)/include/mk/testcases.mk REQ_VERSION_MAJOR := 2 REQ_VERSION_PATCH := 6 MAKE_TARGETS := test01 test02 ... include $(top_srcdir)/include/mk/module.mk include $(top_srcdir)/include/mk/generic_leaf_target.mk endif Which moves all the common code into module.mk and just leaves the kernel recipe in the particular Makefile. That should guarantee that the LTP build system and kernel build system stay separated and won't interact. What do you think? Or to use Kbuild file which should be preffered over Makefile, unfortunately the documentation does not say which kernel version gets the support for Kbuild for extrenal modules, so if it's a recent feature we must go with the Makefile. -- Cyril Hrubis [email protected] ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
