firefox honours cflags, testing on lemote again
[openadk.git] / target / Makefile
blob470e9e4e98ea041535a1e4b7be6a548faf8cd34d
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 # fetch all ADK_KERNEL_MOD_* vars into
16 # .kernelconfig.modules and set them to "m"
17 # 2) fetch all enabled ADK_KERNEL_* vars into
18 # .kernelconfig.kernel (no conversion, as they are booleans)
19 # 3) repeat 2) for the disabled ones and save them into
20 # .kernelconfig.nokernel (to overwrite defaults)
21 # 4) get the device-specific static kernel config and place it into
22 # .kernelconfig.board
23 # 5) prepare for merging:
24 # * if a variable is disabled in .kernelconfig.board and
25 # enabled in either of .kernelconfig.{modules,kernel},
26 # remove it from .kernelconfig.board
27 # * append ${FS_CMDLINE} to the kernel commandline inside
28 # .kernelconfig.board
29 # 6) merge (cat) it all together into .kernelconfig.tmp
30 # 7) check if .kernelconfig.tmp differs from the current one
31 # (.kernelconfig) at all, overwriting the current one
32 # only if it does (so the timestamp stays intact)
33 # 8) remove the temporary .kernelconfig.tmp
34 ###
35 ADK_PACKAGE_CRYPTINIT_ROOT:=$(strip $(subst ",, $(ADK_PACKAGE_CRYPTINIT_ROOT)))
36 ADK_PACKAGE_CRYPTINIT_SWAP:=$(strip $(subst ",, $(ADK_PACKAGE_CRYPTINIT_SWAP)))
37 ADK_PACKAGE_CMDLINE:=root=$(ADK_PACKAGE_CRYPTINIT_ROOT) swap=$(ADK_PACKAGE_CRYPTINIT_SWAP) resume=/dev/mapper/swapcrypt
39 ifeq (${ADK_TARGET_KERNEL_CUSTOMISING},y)
40 config-prepare: $(TOPDIR)/.config
41 @sed -n '/^ADK_KPACKAGE_KMOD/s//CONFIG/p' ${TOPDIR}/.config | \
42 sed 's/=y/=m/' >${BUILD_DIR}/.kernelconfig.modules
43 @sed -n '/^ADK_KERNEL_MOD/s//CONFIG/p' ${TOPDIR}/.config | \
44 sed 's/=y/=m/' >>${BUILD_DIR}/.kernelconfig.modules
45 @sed -n '/^ADK_KERNEL/s//CONFIG/p' ${TOPDIR}/.config \
46 >${BUILD_DIR}/.kernelconfig.kernel
47 @sed -n '/^# ADK_KERNEL/s//# CONFIG/p' ${TOPDIR}/.config \
48 >${BUILD_DIR}/.kernelconfig.nokernel
49 ifeq ($(ADK_NATIVE),y)
50 @if [ -f /etc/adktarget ];then \
51 cp $(TOPDIR)/target/$(ARCH)/kernel.config ${BUILD_DIR}/.kernelconfig.board; \
52 else \
53 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; \
55 else
56 if [ -f ${ADK_TARGET_ARCH}/kernel.config.$(ADK_TARGET_SYSTEM) ];then \
57 cp ${ADK_TARGET_ARCH}/kernel.config.$(ADK_TARGET_SYSTEM) ${BUILD_DIR}/.kernelconfig.board; \
58 else \
59 cp ${ADK_TARGET_ARCH}/kernel.config ${BUILD_DIR}/.kernelconfig.board; \
61 endif
62 @(cat ${BUILD_DIR}/.kernelconfig.{modules,kernel} | \
63 while IFS='=' read symbol value; do \
64 sed -i -e "/^# $$symbol/d" ${BUILD_DIR}/.kernelconfig.board; \
65 done;)
66 @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 ${FS_CMDLINE}"#' \
67 ${BUILD_DIR}/.kernelconfig.board
68 ifneq ($(ADK_TARGET_CMDLINE),)
69 @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 ${ADK_TARGET_CMDLINE}"#' \
70 ${BUILD_DIR}/.kernelconfig.board
71 endif
72 ifneq ($(ADK_PACKAGE_CRYPTINIT_ROOT),)
73 @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 ${ADK_PACKAGE_CMDLINE}"#' \
74 ${BUILD_DIR}/.kernelconfig.board
75 endif
76 ifeq ($(ADK_QUIET_KERNEL),y)
77 @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 quiet"#' \
78 ${BUILD_DIR}/.kernelconfig.board
79 endif
80 ifeq ($(ADK_KERNEL_DEBUG_WITH_KGDB),y)
81 @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 kgdbwait kgdboc=ttyS0,115200"#' \
82 ${BUILD_DIR}/.kernelconfig.board
83 endif
84 @cd ${BUILD_DIR} && cat .kernelconfig.board .kernelconfig.nokernel \
85 .kernelconfig.kernel .kernelconfig.modules \
86 >.kernelconfig.tmp
87 @cd ${BUILD_DIR} && cmp -s .kernelconfig.tmp .kernelconfig || \
88 cp .kernelconfig.tmp .kernelconfig
89 @-rm -f ${BUILD_DIR}/.kernelconfig.tmp
90 else
91 config-prepare: $(TOPDIR)/.config
92 if [ -f ${ADK_TARGET_ARCH}/kernel.config.$(ADK_TARGET_SYSTEM) ];then \
93 cp ${ADK_TARGET_ARCH}/kernel.config.$(ADK_TARGET_SYSTEM) ${BUILD_DIR}/.kernelconfig.board; \
94 else \
95 cp ${ADK_TARGET_ARCH}/kernel.config ${BUILD_DIR}/.kernelconfig.board; \
97 endif
99 prepare: $(ADK_TARGET_ARCH)-prepare
100 compile: $(ADK_TARGET_ARCH)-compile
101 image: $(ADK_TARGET_ARCH)-imageclean $(ADK_TARGET_ARCH)-imageinstall
102 install: $(ADK_TARGET_ARCH)-imageclean $(ADK_TARGET_ARCH)-install $(ADK_TARGET_ARCH)-imageinstall
103 clean: $(ADK_TARGET_ARCH)-clean $(ADK_TARGET_ARCH)-imageclean
105 %-clean:
106 $(TRACE) target/$(patsubst %-clean,%,$@)-clean
107 $(MAKE) -C $(patsubst %-clean,%,$@) clean
108 %-imageclean:
109 $(TRACE) target/$(patsubst %-imageclean,%,$@)-imageclean
110 $(MAKE) -C $(patsubst %-imageclean,%,$@) imageclean
111 %-prepare:
112 $(TRACE) target/$(patsubst %-prepare,%,$@)-prepare
113 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare
114 %-imageprepare:
115 $(TRACE) target/$(patsubst %-imageprepare,%,$@)-imageprepare
116 $(MAKE) -C $(patsubst %-imageprepare,%,$@) imageprepare
117 %-compile: %-prepare
118 $(TRACE) target/$(patsubst %-compile,%,$@)-compile
119 $(MAKE) -C $(patsubst %-compile,%,$@) compile
120 %-install: %-compile
121 $(TRACE) target/$(patsubst %-install,%,$@)-install
122 $(MAKE) -C $(patsubst %-install,%,$@) install
123 %-imageinstall: %-imageprepare
124 $(TRACE) target/$(patsubst %-imageinstall,%,$@)-imageinstall
125 $(MAKE) -C $(patsubst %-imageinstall,%,$@) imageinstall
126 @echo 'Login as user root with password ${ADK_RUNTIME_PASSWORD} via ssh or console.'