Kbuild Makefile mechanism for samples and projects.
This commit adds the capability to the Kbuild system of adding samples and projects to the build process. This commits adds the hello_world and philosophers sample code as an example of how to configure a project into the build system. The project can be hosted inside the kernel source tree or outside the kernel source tree. Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com> Change-Id: Id980e959ac6e0061f8227d5d81191a169bfc8fc3
This commit is contained in:
parent
6de34008ab
commit
4ee8a8e042
31
Makefile.inc
Normal file
31
Makefile.inc
Normal file
|
@ -0,0 +1,31 @@
|
|||
PROJECT_BASE = $(shell pwd)
|
||||
ARCH?=x86
|
||||
|
||||
export ARCH CFLAGS LDFLAGS KBUILD_DEFCONFIG
|
||||
|
||||
all: FORCE
|
||||
$(Q)$(MAKE) -C $(TIMO_BASE) O=$(PROJECT_BASE) \
|
||||
PROJECT=$(PROJECT_BASE) VPFILE=$(VPFILE)
|
||||
|
||||
rm-files:= final-linker.cmd linker.cmd modules.order \
|
||||
staticIdt.o System.map tinymountain.lnk \
|
||||
tinymountain.map tinymountain.elf
|
||||
rm-dirs := arch drivers include kernel lib misc \
|
||||
scripts source
|
||||
|
||||
clean: FORCE
|
||||
$(shell rm $(rm-files))
|
||||
$(shell rm $(rm-dirs) -r)
|
||||
|
||||
mrproper: clean
|
||||
$(Q)$(MAKE) -C $(TIMO_BASE) \
|
||||
PROJECT=$(PROJECT_BASE) VPFILE=$(VPFILE) mrproper
|
||||
|
||||
%config: FORCE
|
||||
$(Q)$(MAKE) -C $(TIMO_BASE) O=$(PROJECT_BASE) \
|
||||
PROJECT=$(PROJECT_BASE) VPFILE=$(VPFILE) $@
|
||||
|
||||
PHONY += FORCE
|
||||
FORCE:
|
||||
|
||||
.PHONY: $(PHONY)
|
|
@ -1,2 +1,2 @@
|
|||
obj-y = configs.o
|
||||
obj-$(CONFIG_MICROKERNEL) += nodes/
|
||||
obj-$(SYSGEN_EXEC) += nodes/
|
||||
|
|
4
samples/microkernel/apps/hello_world/Makefile.kbuild
Normal file
4
samples/microkernel/apps/hello_world/Makefile.kbuild
Normal file
|
@ -0,0 +1,4 @@
|
|||
TIMO_BASE = $(strip $(subst /samples/microkernel/apps/hello_world,,$(shell pwd) ))
|
||||
VPFILE ?= prj.vpf
|
||||
|
||||
include ${TIMO_BASE}/Makefile.inc
|
3
samples/microkernel/apps/hello_world/src/Makefile
Normal file
3
samples/microkernel/apps/hello_world/src/Makefile
Normal file
|
@ -0,0 +1,3 @@
|
|||
EXTRA_CFLAGS += ${PROJECTINCLUDE}
|
||||
|
||||
obj-y = hello.o
|
4
samples/microkernel/apps/philosophers/Makefile.kbuild
Normal file
4
samples/microkernel/apps/philosophers/Makefile.kbuild
Normal file
|
@ -0,0 +1,4 @@
|
|||
TIMO_BASE = $(strip $(subst /samples/microkernel/apps/philosophers,,$(shell pwd) ))
|
||||
VPFILE ?= prj.vpf
|
||||
|
||||
include ${TIMO_BASE}/Makefile.inc
|
3
samples/microkernel/apps/philosophers/src/Makefile
Normal file
3
samples/microkernel/apps/philosophers/src/Makefile
Normal file
|
@ -0,0 +1,3 @@
|
|||
EXTRA_CFLAGS += ${PROJECTINCLUDE}
|
||||
|
||||
lib-y = phil_fiber.o phil_task.o
|
4
samples/nanokernel/apps/hello_world/Makefile.kbuild
Normal file
4
samples/nanokernel/apps/hello_world/Makefile.kbuild
Normal file
|
@ -0,0 +1,4 @@
|
|||
TIMO_BASE = $(strip $(subst /samples/nanokernel/apps/hello_world,,$(shell pwd) ))
|
||||
VPFILE ?= prj.vpf
|
||||
|
||||
include ${TIMO_BASE}/Makefile.inc
|
4
samples/nanokernel/apps/philosophers/Makefile.kbuild
Normal file
4
samples/nanokernel/apps/philosophers/Makefile.kbuild
Normal file
|
@ -0,0 +1,4 @@
|
|||
TIMO_BASE = $(strip $(subst /samples/nanokernel/apps/philosophers,,$(shell pwd) ))
|
||||
VPFILE ?= prj.vpf
|
||||
|
||||
include ${TIMO_BASE}/Makefile.inc
|
Loading…
Reference in a new issue