activated LED support
[openadk.git] / target / Makefile
blobb3f266ee00302bf6d07dd17928823607e332c464
1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 include $(TOPDIR)/rules.mk
5 include $(TOPDIR)/mk/rootfs.mk
7 all: install
9 ### Kernel .config Creation
10 # The following target combines all kernel-related variables and
11 # config files into a single one to be used as the final kernel
12 # configuration when building. This is how it's done:
13 # 1) fetch all ADK_KPACKAGE_KMOD_* vars into
14 # .kernelconfig.modules and set them to "m"
15 # 2) fetch all enabled ADK_KERNEL_* vars into
16 # .kernelconfig.kernel (no conversion, as they are booleans)
17 # 3) repeat 2) for the disabled ones and save them into
18 # .kernelconfig.nokernel (to overwrite defaults)
19 # 4) get the device-specific static kernel config and place it into
20 # .kernelconfig.board
21 # 5) prepare for merging:
22 # * if a variable is disabled in .kernelconfig.board and
23 # enabled in either of .kernelconfig.{modules,kernel},
24 # remove it from .kernelconfig.board
25 # * append ${FS_CMDLINE} to the kernel commandline inside
26 # .kernelconfig.board
27 # 6) merge (cat) it all together into .kernelconfig.tmp
28 # 7) check if .kernelconfig.tmp differs from the current one
29 # (.kernelconfig) at all, overwriting the current one
30 # only if it does (so the timestamp stays intact)
31 # 8) remove the temporary .kernelconfig.tmp
32 ###
33 config-prepare: $(TOPDIR)/.config
34 @sed -n '/^ADK_KPACKAGE_KMOD/s//CONFIG/p' ${TOPDIR}/.config | \
35 sed 's/=y/=m/' >${BUILD_DIR}/.kernelconfig.modules
36 @sed -n '/^ADK_KERNEL/s//CONFIG/p' ${TOPDIR}/.config \
37 >${BUILD_DIR}/.kernelconfig.kernel
38 @sed -n '/^ADK_MOD_KERNEL/s//CONFIG/p' ${TOPDIR}/.config | \
39 sed 's/=y/=m/' >${BUILD_DIR}/.kernelconfig.modkernel
40 @sed -n '/^# ADK_KERNEL/s//# CONFIG/p' ${TOPDIR}/.config \
41 >${BUILD_DIR}/.kernelconfig.nokernel
42 # if native build, first try /proc/config.gz
43 ifeq ($(ADK_NATIVE),y)
44 @if [ -f /proc/config.gz ];then zcat /proc/config.gz > ${BUILD_DIR}/.kernelconfig.board; else cp ${ADK_TARGET}/kernel.config.$(ARCH) ${BUILD_DIR}/.kernelconfig.board; fi
45 else
46 @cp ${ADK_TARGET}/kernel.config ${BUILD_DIR}/.kernelconfig.board
47 endif
48 @(cat ${BUILD_DIR}/.kernelconfig.{modules,kernel} | \
49 while IFS='=' read symbol value; do \
50 sed -i -e "/^# $$symbol/d" ${BUILD_DIR}/.kernelconfig.board; \
51 done;)
52 @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 ${FS_CMDLINE}"#' \
53 ${BUILD_DIR}/.kernelconfig.board
54 ifeq ($(ADK_KERNEL_DEBUG_WITH_KGDB),y)
55 @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 kgdbwait kgdboc=ttyS0,115200"#' \
56 ${BUILD_DIR}/.kernelconfig.board
57 endif
58 @cd ${BUILD_DIR} && cat .kernelconfig.board .kernelconfig.nokernel \
59 .kernelconfig.kernel .kernelconfig.modkernel .kernelconfig.modules \
60 >.kernelconfig.tmp
61 @cd ${BUILD_DIR} && cmp -s .kernelconfig.tmp .kernelconfig || \
62 cp .kernelconfig.tmp .kernelconfig
63 @-rm -f ${BUILD_DIR}/.kernelconfig.tmp
65 prepare: $(ADK_TARGET)-prepare
66 compile: $(ADK_TARGET)-compile
67 image: $(ADK_TARGET)-imageclean $(ADK_TARGET)-imageinstall
68 install: $(ADK_TARGET)-imageclean $(ADK_TARGET)-install $(ADK_TARGET)-imageinstall
69 clean: $(ADK_TARGET)-clean $(ADK_TARGET)-imageclean
71 %-clean:
72 $(TRACE) target/$(patsubst %-clean,%,$@)-clean
73 $(MAKE) -C $(patsubst %-clean,%,$@) clean
74 %-imageclean:
75 $(TRACE) target/$(patsubst %-imageclean,%,$@)-imageclean
76 $(MAKE) -C $(patsubst %-imageclean,%,$@) imageclean
77 %-prepare:
78 $(TRACE) target/$(patsubst %-prepare,%,$@)-prepare
79 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare
80 %-imageprepare:
81 $(TRACE) target/$(patsubst %-imageprepare,%,$@)-imageprepare
82 $(MAKE) -C $(patsubst %-imageprepare,%,$@) imageprepare
83 %-compile: %-prepare
84 $(TRACE) target/$(patsubst %-compile,%,$@)-compile
85 $(MAKE) -C $(patsubst %-compile,%,$@) compile
86 %-install: %-compile
87 $(TRACE) target/$(patsubst %-install,%,$@)-install
88 $(MAKE) -C $(patsubst %-install,%,$@) install
89 %-imageinstall: %-imageprepare
90 $(TRACE) target/$(patsubst %-imageinstall,%,$@)-imageinstall
91 $(MAKE) -C $(patsubst %-imageinstall,%,$@) imageinstall