at-spi2-atk: fix packaging issue
[openadk.git] / target / Makefile
blob5af02d0f1baf788d1a6f7e90e29505a94eec4d49
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 $(ADK_TOPDIR)/rules.mk
5 include $(ADK_TOPDIR)/mk/rootfs.mk
7 ifeq ($(ADK_TARGET_KERNEL_USE_CUSTOMCONFIG),y)
8 KERNEL_MODULES_USED:=$(shell grep -s =m $(ADK_TOPDIR)/$(ADK_TARGET_KERNEL_CUSTOMCONFIG_PATH))
9 else
10 KERNEL_MODULES_USED:=$(shell grep ^ADK_KERNEL $(ADK_TOPDIR)/.config|grep =m)
11 endif
13 all: install
15 ### Kernel .config Creation
16 # The following target combines all kernel-related variables and
17 # config files into a single one to be used as the final kernel
18 # configuration when building. This is how it's done:
19 # 1) fetch all enabled ADK_KERNEL_* vars into
20 # .kernelconfig.kernel
21 # 2) get the global and device-specific static kernel config and place it into
22 # .kernelconfig.board
23 # 3) append $(FS_CMDLINE) to the kernel commandline inside .kernelconfig.board
24 # 4) merge both together into .kernelconfig.tmp
25 # 5) check if .kernelconfig.tmp differs from the current one
26 # (.kernelconfig) at all, overwriting the current one
27 # only if it does (so the timestamp stays intact)
28 # 6) remove the temporary .kernelconfig.tmp
29 ###
30 ADK_PACKAGE_CRYPTINIT_ROOT:=$(strip $(subst ",, $(ADK_PACKAGE_CRYPTINIT_ROOT)))
31 ADK_PACKAGE_CRYPTINIT_SWAP:=$(strip $(subst ",, $(ADK_PACKAGE_CRYPTINIT_SWAP)))
32 ADK_PACKAGE_CMDLINE:=root=$(ADK_PACKAGE_CRYPTINIT_ROOT) swap=$(ADK_PACKAGE_CRYPTINIT_SWAP) resume=/dev/mapper/swapcrypt
34 ifeq ($(ADK_TARGET_KERNEL_CUSTOMISING),y)
35 config-prepare: $(ADK_TOPDIR)/.config
36 @PATH='$(HOST_PATH)' sed -n '/^ADK_KERNEL/s//CONFIG/p' $(ADK_TOPDIR)/.config \
37 >$(BUILD_DIR)/.kernelconfig.kernel
38 @if [ -f $(ADK_TARGET_ARCH)/kernel/$(ADK_TARGET_SYSTEM) ];then \
39 cat $(ADK_TOPDIR)/target/linux/kernel.config \
40 $(ADK_TARGET_ARCH)/kernel/$(ADK_TARGET_SYSTEM) > $(BUILD_DIR)/.kernelconfig.board; \
41 else \
42 echo "no miniconfig found for target system"; \
43 exit 1; \
45 ifneq ($(ADK_TARGET_NO_CMDLINE),y)
46 ifeq ($(ADK_APPLIANCE_KODI),y)
47 $(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 consoleblank=0 vt.global_cursor_default=0"#' \
48 $(BUILD_DIR)/.kernelconfig.board
49 endif
50 ifeq ($(ADK_RUNTIME_VERBOSE_KERNEL_VGA_ONLY),y)
51 $(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 console=$(ADK_RUNTIME_CONSOLE_VGA_DEVICE)"#' \
52 $(BUILD_DIR)/.kernelconfig.board
53 endif
54 ifeq ($(ADK_RUNTIME_VERBOSE_KERNEL_SERIAL_ONLY),y)
55 $(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 console=$(ADK_RUNTIME_CONSOLE_SERIAL_DEVICE),$(ADK_RUNTIME_CONSOLE_SERIAL_SPEED)"#' \
56 $(BUILD_DIR)/.kernelconfig.board
57 endif
58 ifeq ($(ADK_RUNTIME_VERBOSE_KERNEL_VGA_SERIAL),y)
59 $(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 console=$(ADK_RUNTIME_CONSOLE_VGA_DEVICE) console=$(ADK_RUNTIME_CONSOLE_SERIAL_DEVICE),$(ADK_RUNTIME_CONSOLE_SERIAL_SPEED)"#' \
60 $(BUILD_DIR)/.kernelconfig.board
61 endif
62 ifeq ($(ADK_RUNTIME_VERBOSE_KERNEL_SERIAL_VGA),y)
63 $(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 console=$(ADK_RUNTIME_CONSOLE_SERIAL_DEVICE),$(ADK_RUNTIME_CONSOLE_SERIAL_SPEED) console=$(ADK_RUNTIME_CONSOLE_VGA_DEVICE)"#' \
64 $(BUILD_DIR)/.kernelconfig.board
65 endif
66 ifeq ($(ADK_TARGET_SYSTEM_QEMU_M68K_Q800)$(ADK_TARGET_SYSTEM_QEMU_M68K_MCF5208),y)
67 @$(SED) 's#^\(CONFIG_.*BOOTPARAM_STRING="\)\(.*\)"#\1\2 ro $(FS_CMDLINE)"#' \
68 $(BUILD_DIR)/.kernelconfig.board
69 endif
70 ifeq ($(ADK_TARGET_ROOTFS_NFSROOT),)
71 @$(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 ro"#' \
72 $(BUILD_DIR)/.kernelconfig.board
73 else
74 @$(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 rw"#' \
75 $(BUILD_DIR)/.kernelconfig.board
76 endif
77 @$(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 $(FS_CMDLINE)"#' \
78 $(BUILD_DIR)/.kernelconfig.board
79 ifneq ($(ADK_TARGET_CMDLINE),)
80 @$(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 $(ADK_TARGET_CMDLINE)"#' \
81 $(BUILD_DIR)/.kernelconfig.board
82 endif
83 ifeq ($(ADK_TARGET_QEMU_WITH_GRAPHIC),y)
84 @$(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 console=tty0"#' \
85 $(BUILD_DIR)/.kernelconfig.board
86 endif
87 ifneq ($(ADK_PACKAGE_CRYPTINIT_ROOT),)
88 @$(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 $(ADK_PACKAGE_CMDLINE)"#' \
89 $(BUILD_DIR)/.kernelconfig.board
90 endif
91 ifeq ($(ADK_RUNTIME_QUIET_INIT),y)
92 @$(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 rcquiet=1"#' \
93 $(BUILD_DIR)/.kernelconfig.board
94 endif
95 ifeq ($(ADK_RUNTIME_QUIET_KERNEL),y)
96 @$(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 quiet loglevel=2 vt.global_cursor_default=0"#' \
97 $(BUILD_DIR)/.kernelconfig.board
98 endif
99 ifeq ($(ADK_KERNEL_DEBUG_WITH_KGDB),y)
100 @$(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 kgdbwait kgdboc=ttyS0,115200"#' \
101 $(BUILD_DIR)/.kernelconfig.board
102 endif
103 ifeq ($(ADK_KERNEL_NETCONSOLE),y)
104 @$(SED) 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 netconsole=@$(ADK_PARAMETER_NETCONSOLE_SRC_IP)/,@$(ADK_PARAMETER_NETCONSOLE_DST_IP)/"#' \
105 $(BUILD_DIR)/.kernelconfig.board
106 endif
107 endif
108 @cd $(BUILD_DIR) && cat .kernelconfig.board .kernelconfig.kernel \
109 >.kernelconfig.tmp
110 @cd $(BUILD_DIR) && cmp -s .kernelconfig.tmp .kernelconfig || \
111 cp .kernelconfig.tmp .kernelconfig
112 @-rm -f $(BUILD_DIR)/.kernelconfig.tmp
113 else
114 config-prepare: $(ADK_TOPDIR)/.config
115 @if [ -f $(ADK_TARGET_ARCH)/kernel/$(ADK_TARGET_SYSTEM) ];then \
116 cat $(ADK_TOPDIR)/target/linux/kernel.config \
117 $(ADK_TARGET_ARCH)/kernel/$(ADK_TARGET_SYSTEM) > $(BUILD_DIR)/.kernelconfig.board; \
118 else \
119 echo "no miniconfig found for target system"; \
120 exit 1; \
122 @cd $(BUILD_DIR) && cmp -s .kernelconfig.board .kernelconfig || \
123 cp .kernelconfig.board .kernelconfig
124 endif
126 prepare: $(ADK_TARGET_ARCH)-prepare
127 compile: $(ADK_TARGET_ARCH)-compile
128 image: $(ADK_TARGET_ARCH)-imageclean $(ADK_TARGET_ARCH)-imageinstall
129 targethelp: $(ADK_TARGET_ARCH)-targethelp
130 install: $(ADK_TARGET_ARCH)-imageclean $(ADK_TARGET_ARCH)-install $(ADK_TARGET_ARCH)-imageinstall
131 clean: $(ADK_TARGET_ARCH)-clean $(ADK_TARGET_ARCH)-imageclean
133 %-clean:
134 $(START_TRACE) "target/$(patsubst %-clean,%,$@)-clean.. "
135 $(MAKE) -C $(patsubst %-clean,%,$@) clean
136 $(CMD_TRACE) " done"
137 $(END_TRACE)
139 %-imageclean:
140 $(START_TRACE) "target/$(patsubst %-imageclean,%,$@)-imageclean.. "
141 $(MAKE) -C $(patsubst %-imageclean,%,$@) imageclean
142 $(CMD_TRACE) " done"
143 $(END_TRACE)
145 %-prepare:
146 $(START_TRACE) "target/$(patsubst %-prepare,%,$@)-prepare.. "
147 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare
148 $(CMD_TRACE) " done"
149 $(END_TRACE)
151 %-imageprepare:
152 $(START_TRACE) "target/$(patsubst %-imageprepare,%,$@)-imageprepare.. "
153 ifeq ($(ADK_RUNTIME_DEV_UDEV),y)
154 ifneq ($(KERNEL_MODULES_USED),)
155 # This should be made a package instead
156 $(CP) $(BUILD_DIR)/linux-$(ADK_TARGET_ARCH)/modules/lib $(TARGET_DIR)
157 rm -f "$(TARGET_DIR)"/lib/modules/*/build \
158 "$(TARGET_DIR)"/lib/modules/*/source
159 endif
160 endif
161 @for x in $$(ls $(ADK_TOPDIR)/scripts/preimage/*.sh 2>/dev/null); do \
162 [[ -x "$$x" ]] && $$x; \
163 break; \
164 done
165 $(MAKE) -C $(patsubst %-imageprepare,%,$@) imageprepare
166 $(CMD_TRACE) " done"
167 $(END_TRACE)
169 %-compile: %-prepare
170 $(MAKE) -C $(patsubst %-compile,%,$@) compile
172 %-install: %-compile
173 $(MAKE) -C $(patsubst %-install,%,$@) install
175 %-targethelp:
176 $(MAKE) -C $(patsubst %-targethelp,%,$@) targethelp
178 %-imageinstall: %-imageprepare
179 $(MAKE) -C $(patsubst %-imageinstall,%,$@) imageinstall
180 @for x in $$(ls $(ADK_TOPDIR)/scripts/postimage/*.sh 2>/dev/null); do \
181 [[ -x "$$x" ]] && $$x; \
182 break; \
183 done
184 @echo "Login as user root via ssh or console."