-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
252 lines (207 loc) · 8.39 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#$L$
# Copyright (C) 2011-2013 Ridgerun (http://www.ridgerun.com).
#$L$
export DEVDIR=${shell pwd}
COMPONENTS = toolchain kernel fs bootloader installer
include bsp/mach/Make.conf
include bsp/classes/flags.defs
# Used to the graphical output indexation
TABINDEX ?= \040
.PHONY: build config bspconfig bspconfig_batch preconfig chkconfig buildfs \
clean prebuild header kernel bootloader fs update coreconfig \
help help_targets help_parameters help_examples install
build:: .oscheck header prebuild $(foreach COMP, $(COMPONENTS), $(COMP)_build)
force_build_execute:
$(V)$(MAKE) build
# Toolchain variable environment is required by bsp/oscheck/pkg
export TOOLCHAIN
# Goals that we need to know about
build-goals-list := build fs kernel cmdline bootloader
config-goals-list := config bspconfig coreconfig
config-goals := $(filter $(config-goals-list), $(MAKECMDGOALS))
build-goals := $(filter $(build-goals-list), $(MAKECMDGOALS))
.oscheck:
$(V)cd bsp/oscheck && ./shellcheck && ./oscheck $(SCRIPT_DEBUG) && ./pkg -r $(SCRIPT_DEBUG) && ./osfix
$(V)touch .oscheck
ifndef config-goals
ifndef build-goals
$(V)echo -e "\nRunning initial configuration to load default values...\n"
$(V)$(MAKE) bspconfig
endif
endif
header::
@$(ECHO) "\033[34mRidgerun Linux SDK\033[0m"
@$(ECHO) "Board configuration: \033[32m$(MACH_DESCRIPTION)\033[0m"
ifneq ($(BSP_NCPU_TOTAL),1)
@$(ECHO) "Multi-core machine, using \033[34m$(BSP_NCPU)\033[0m out of $(BSP_NCPU_TOTAL) cores for building"
endif
@$(ECHO)
@mkdir -p images
prebuild::
patch:: $(foreach COMP, $(COMPONENTS), $(COMP)_patch)
buildfs:: $(foreach COMP, $(COMPONENTS), $(COMP)_buildfs)
unpatch:: $(foreach COMP, $(COMPONENTS), $(COMP)_unpatch)
clean:: .oscheck header $(foreach COMP, $(COMPONENTS), $(COMP)_clean)
@$(MAKE) -C bsp clean $(MAKE_CALL_PARAMS)
$(V)rm -rf images/*
$(V)rm .oscheck .system.id
preconfig:: .oscheck header $(foreach COMP, $(COMPONENTS), $(COMP)_preconfig)
config:: .oscheck header bspconfig
bspconfig:: preconfig
@$(MAKE) -C bsp menuconfig $(MAKE_CALL_PARAMS)
@$(MAKE) -C fs defs $(MAKE_CALL_PARAMS)
bspconfig_default:: .oscheck header preconfig
$(V) \
echo -e "\nThis will revert all previous configuration to the default vales" ; \
echo -n "Are you sure (yes/no) " ; \
read ANS ; \
if test "$$ANS" = "yes" ; then \
rm -Rf bsp/mach/bspconfig ; \
$(MAKE) -C bsp menuconfig $(MAKE_CALL_PARAMS) ; \
fi
bspconfig_batch:: .oscheck header preconfig
@$(MAKE) -C bsp config $(MAKE_CALL_PARAMS)
cmdline:: .oscheck header
$(V)$(MAKE) -C fs cmdline $(MAKE_CALL_PARAMS)
update:
$(V)$(DEVDIR)/bsp/scripts/update $(if $(VERBOSE:0=),-d)
showdirs=0
revision=0
getupdates=0
show_updates: header
$(V)bsp/scripts/show_updates.pl --revision=$(revision) --showdirs=$(showdirs) --getUpdates=$(getupdates)
env:
@echo "export DEVDIR=$(DEVDIR)"
@echo "export PATH=$(BSP_PATH)"
ifndef board
board=""
endif
ifndef toolchain
toolchain=""
endif
ifndef bootloader
bootloader=""
endif
ifndef kernel
kernel=""
endif
coreconfig: .oscheck header
$(V)bsp/scripts/coreconfig $(board) $(toolchain) $(bootloader) $(kernel)
doc: .oscheck header
$(V) DOXVER=`doxygen --version` ;\
DOXMAJOR=`echo $$DOXVER | cut -d. -f1`; \
DOXMINOR=`echo $$DOXVER | cut -d. -f2`; \
if ! [ $$DOXMAJOR -gt 1 -o \
\( $$DOXMAJOR -eq 1 -a $$DOXMINOR -ge 7 \) \
] ; then \
$(ECHO) "$(ERROR_COLOR)ERROR:$(NORMAL_COLOR) You need doxygen 1.7 or up to build the documentation. Either Doxygen isn't installed in this system, or it is outdated.\n" ; \
exit 255; \
fi;
$(V) echo -n -e " Generating SDK Documentation..."
$(V) cd documentation ; doxygen doxygen.conf $(QOUT) $(ERRQOUT)
$(V) $(ECHO) "done\n\n"
prelink: .oscheck header $(DEVDIR)/bsp/local/sbin/prelink
$(V) $(ECHO) "\n Prelinking the root filesystem...\n"
$(V) $(DEVDIR)/bsp/local/sbin/prelink --root fs/fs -v -all -m $(PRELINK_PARAMS)
$(DEVDIR)/bsp/local/sbin/prelink:
$(V) if [ ! -d fs/host-apps/prelink-cross ] ; then \
$(ECHO) "$(ERROR_COLOR)ERROR:$(NORMAL_COLOR) You don't have prelink-cross in your SDK." ; \
$(ECHO) " prelink-cross is only available with RidgeRun SDK Professional Version. Please contact RidgeRun for support\n" ; \
exit -1 ; \
else \
$(ECHO) "Building prelink-cross..." ; \
$(MAKE) -C fs/host-apps/prelink-cross build install ; \
fi
help:: help_targets help_parameters help_examples
help_targets::
@echo ""
@echo "RidgeRun Integrated Linux Software Developer's Kit"
@echo ""
@echo "Make targets:"
@echo ""
@echo " build - build kernel, target filesystem, bootloader"
@echo " force_build - same as build, but forces the recompilation of the target filesystem"
@echo " kernel - build kernel"
@echo " fs - build target filesystem"
@echo " cmdline - build cmdline for target kernel (fs target does the same as well)"
@echo " bootloader - build bootloader"
@echo " patch - fetch the source and apply any patches"
@echo " unpatch - remove all applied patches"
@echo " config - allow SDK to be configured"
@echo " config_batch - attempt to configure without user interaction"
@echo " clean - delete all derived files"
@echo " remove_fs - delete the filesystem"
@echo " remove_fsdev - delete the filesystem staging directory"
@echo " update - checks for repository updates for the SDK"
@echo " show_updates - checks for available updates for the SDK's release;"
@echo " use revision=<number> to specify a particular revision or"
@echo " range (same syntax as svn log) or showdirs=1 to enable showing"
@echo " change details in the log displayed."
@echo " env - displays commands to run to setup shell environment"
@echo " coreconfig - select toolchain, bootloader, and kernel (updates bsp/mach/Make.conf)"
@echo " doc - generate the SDK API documentation into the documentation folder"
@echo " prelink - prelink the root filesystem"
@echo " rrsdk_patches_refresh - Update merged series file contains arch, mach, and top level"
@echo " patches. Only for bootloader, kernel and dvsdk/ezsdk directories."
help_parameters::
@echo ""
@echo "Make parameters:"
@echo ""
@echo " VERBOSE - set to 1 to output executing commands"
@echo " LOGFILE - set to built output filename"
@echo ""
@echo "Make update parameters:"
@echo ""
@echo " FORCE_UP - set to force the application/removal of patches"
@echo ""
help_examples::
@echo ""
@echo "Examples:"
@echo ""
@echo " make # same as 'make build'"
@echo " make VERBOSE=1"
# Alias for old BSP targets like
kernel: kernel_build bootloader_build
bootloader: bootloader_build
fs: fs_build bootloader_build
ifneq ($(strip $(INSTALLER)),)
include installer/$(INSTALLER)/Makefile
else
installbootloader: install
installkernel: install
installfs: install
install:
$(V)$(ECHO) "Installer not found. Aborting\n " \
"Please verify INSTALLER variable is defined on bsp/mach/Mach.conf."
endif
-include bsp/Makefile.extra
# We are disabling the Makefile.extra temporarely because we want to
# disable all previous installer functionality that is now deprecated
# and the .extra files are used so far only for installer functions.
# We can re-enable on the futue if required
-include bsp/arch/Makefile.extra
-include bsp/mach/Makefile.extra
# Component Function template call
define COMP_template
.PHONY: $(1)$(2)
$(1)$(2): header
$(V)if [ -d $(1) ] ; then \
$(ECHO) "Processing $(1)..."; \
$(EXECUTE) $(MAKE) -C $(1) $(3) $(MAKE_CALL_PARAMS); \
fi
endef
# Create a rules for components
$(foreach COMP, $(COMPONENTS), $(eval $(call COMP_template,$(COMP),_patch,patch)))
$(foreach COMP, $(COMPONENTS), $(eval $(call COMP_template,$(COMP),_build)))
$(foreach COMP, $(COMPONENTS), $(eval $(call COMP_template,$(COMP),_buildfs,buildfs)))
$(foreach COMP, $(COMPONENTS), $(eval $(call COMP_template,$(COMP),_preconfig,preconfig)))
$(foreach COMP, $(COMPONENTS), $(eval $(call COMP_template,$(COMP),_chkconfig,chkconfig)))
$(foreach COMP, $(COMPONENTS), $(eval $(call COMP_template,$(COMP),_unpatch,unpatch)))
$(foreach COMP, $(COMPONENTS), $(eval $(call COMP_template,$(COMP),_clean,clean)))
# Rule to remove fs/fs
remove_fs:
$(V)rm -rf $(DEVDIR)/fs/fs
# Rule to remove fs/fsdev
remove_fsdev: remove_built_flag
$(V)rm -rf $(DEVDIR)/fs/fsdev
include $(CLASSES)/force_build.defs