forked from Freetz/freetz
/
Makefile
540 lines (458 loc) · 16.5 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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
# Makefile for Freetz, Kernel 2.6 series
#
# $Id$
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
# Copyright (C) 2005-2006 by Daniel Eiband <eiband@online.de>
# Copyright (C) 2006-2007 by Oliver Metz, Alexander Kriegisch, Mickey & Co.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#--------------------------------------------------------------
# Just run 'make menuconfig', configure stuff, then run 'make'.
# You shouldn't need to mess with anything beyond this point...
#--------------------------------------------------------------
TOPDIR=.
CONFIG_CONFIG_IN=Config.in
CONFIG_DEFCONFIG=.defconfig
CONFIG=tools/config
SHELL:=/bin/bash
IMAGE:=
LOCALIP:=
RECOVER:=
FREETZ_BASE_DIR:=$(shell pwd)
ADDON_DIR:=addon
BUILD_DIR:=build
DL_DIR:=dl
INCLUDE_DIR:=include
MAKE_DIR:=make
PACKAGES_DIR_ROOT:=packages
SOURCE_DIR_ROOT:=source
TOOLCHAIN_DIR:=toolchain
TOOLS_DIR:=tools
DL_FW_DIR:=$(DL_DIR)/fw
FW_IMAGES_DIR:=images
MIRROR_DIR:=$(DL_DIR)/mirror
BUILD_DIR_VERSION:=$(shell svnversion | grep -v exported 2> /dev/null)
BUILD_LAST_VERSION:=$(shell cat .lastbuild-version 2> /dev/null)
TOOLCHAIN_BUILD_DIR:=$(TOOLCHAIN_DIR)/$(BUILD_DIR)
TOOLS_BUILD_DIR:=$(TOOLS_DIR)/$(BUILD_DIR)
SED:=sed
MAKE1=make
MAKE=make -j$(FREETZ_JLEVEL)
DL_TOOL:=$(TOOLS_DIR)/freetz_download
FAKEROOT_TOOL:=$(TOOLS_DIR)/fakeroot/bin/fakeroot
PATCH_TOOL:=$(TOOLS_DIR)/freetz_patch
CHECK_PREREQ_TOOL:=$(TOOLS_DIR)/check_prerequisites
CHECK_BUILD_DIR_VERSION:=
CHECK_UCLIBC_VERSION:=$(TOOLS_DIR)/check_uclibc
export FW_IMAGES_DIR
export FREETZ_BASE_DIR
# Use echo -e "$(_Y)message$(_N)" if you want to print a yellow message
IS_TTY=$(shell tty -s && echo 1 || echo 0)
ifeq ($(IS_TTY),1)
_Y:=\\033[33m
__Y:=\033[33m
_N:=\\033[m
__N:=\033[m
endif
export __Y
export __N
define MESSAGE
printf "%s\n" "$(1)" $(SILENT)
endef
# Print yellow error message and exit
define ERROR
printf "\n$(_Y)%s$(_N)\n" "ERROR: $(2)"; exit $(1);
endef
# Current user == root? -> Error
ifeq ($(shell echo $$UID),0)
$(error Running makefile as root is prohibited! Please build Freetz as normal user)
endif
# Mod archive unpacked incorrectly (heuristics)? -> Error
ifeq ($(shell MWW=make/mod/files/root/usr/mww; \
[ ! -L $$MWW/cgi-bin/index.cgi -o ! -x $$MWW/cgi-bin/status.cgi -o -x $$MWW/index.html ] \
&& echo y\
),y)
$(error File permissions or links are wrong! Please unpack Freetz on a filesystem with Unix-like permissions)
endif
# Folder root/ needs 755 permissions
ifneq ($(shell stat -c %a make/mod/files/root),755)
$(error Please unpack/checkout again with umask set to 0022)
endif
# We need umask 0022
ifneq ($(shell umask),0022)
$(error Please run "umask 0022", it is now $(shell umask))
endif
# We don't like cygwin
ifeq ($(shell uname -o),Cygwin)
$(error Cygwin is not supported! Please use a real Linux environment.)
endif
# git-svn removes empty directories, check for one of them
ifneq (OK,$(shell [ -d make/mod/files/root/sys ] && echo OK ))
$(error The empty directory root/sys is missing! Please do a clean checkout.)
endif
# Run svn version update if building in working copy
ifneq ($(BUILD_DIR_VERSION),)
CHECK_BUILD_DIR_VERSION:=check-builddir-version
endif
# Simple checking of build prerequisites
ifneq ($(NO_PREREQ_CHECK),y)
ifneq ($(shell $(CHECK_PREREQ_TOOL) \
$$(cat .build-prerequisites) \
>&2 \
&& echo OK\
),OK)
$(error Some build prerequisites are missing! Please install the missing packages before trying again)
endif
endif
all: step
world: $(CHECK_BUILD_DIR_VERSION) $(DL_DIR) $(BUILD_DIR) \
$(PACKAGES_DIR_ROOT) $(SOURCE_DIR_ROOT) $(TOOLCHAIN_BUILD_DIR)
include $(TOOLS_DIR)/make/Makefile.in
noconfig_targets:=menuconfig config oldconfig defconfig tools \
$(TOOLS) $(CHECK_BUILD_DIR_VERSION)
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
-include $(TOPDIR)/.config
#ifeq ($(filter dirclean,$(MAKECMDGOALS)),)
#Simple test if wrong uclibc is used
#ifneq ($(NO_UCLIBC_CHECK),y)
#ifneq ($(shell $(CHECK_UCLIBC_VERSION) && echo OK), OK)
#$(error Error: uClibc-version changed. Please type "make dirclean")
#endif
#endif
#endif
endif
VERBOSE:=
QUIET:=--quiet
QUIETSHORT:=-q
ifeq ($(strip $(FREETZ_VERBOSITY_LEVEL)),0)
.SILENT:
# Don't be silent when a menuconfig target is called
ifneq ($(findstring menuconfig,$(MAKECMDGOALS)),menuconfig)
#SILENT:= >>build.log 2>&1
SILENT:= > /dev/null 2>&1
endif
endif
ifeq ($(strip $(FREETZ_VERBOSITY_LEVEL)),2)
#VERBOSE:=-v # Show files on untar
QUIET:=
QUIETSHORT:=
endif
export FREETZ_VERBOSITY_LEVEL
export VERBOSE
TOOLS_CLEAN:=$(patsubst %,%-clean,$(TOOLS))
TOOLS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TOOLS))
TOOLS_DISTCLEAN:=$(patsubst %,%-distclean,$(TOOLS))
TOOLS_SOURCE:=$(patsubst %,%-source,$(TOOLS))
include $(TOOLS_DIR)/make/*.mk
$(DL_DIR): $(DL_FW_DIR)
$(MIRROR_DIR): $(DL_DIR)
$(DL_DIR) \
$(DL_FW_DIR) \
$(MIRROR_DIR) \
$(BUILD_DIR) \
$(PACKAGES_DIR_ROOT) \
$(SOURCE_DIR_ROOT) \
$(TOOLCHAIN_BUILD_DIR) \
$(TOOLS_BUILD_DIR) \
$(FW_IMAGES_DIR):
@mkdir -p $@
ifeq ($(strip $(FREETZ_HAVE_DOT_CONFIG)),y)
step: world tools firmware
-include .config.cmd
include $(MAKE_DIR)/Makefile.in
include $(MAKE_DIR)/*/Makefile.in
include $(TOOLCHAIN_DIR)/make/Makefile.in
TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
TARGETS_PRECOMPILED:=$(patsubst %,%-precompiled,$(TARGETS))
PACKAGES_BUILD:=$(patsubst %,%-package,$(PACKAGES))
PACKAGES_CLEAN:=$(patsubst %,%-clean,$(PACKAGES))
PACKAGES_DIRCLEAN:=$(patsubst %,%-dirclean,$(PACKAGES))
PACKAGES_LIST:=$(patsubst %,%-list,$(PACKAGES))
PACKAGES_SOURCE:=$(patsubst %,%-source,$(PACKAGES))
PACKAGES_PRECOMPILED:=$(patsubst %,%-precompiled,$(PACKAGES))
LIBS_CLEAN:=$(patsubst %,%-clean,$(LIBS))
LIBS_DIRCLEAN:=$(patsubst %,%-dirclean,$(LIBS))
LIBS_SOURCE:=$(patsubst %,%-source,$(LIBS))
LIBS_PRECOMPILED:=$(patsubst %,%-precompiled,$(LIBS))
TOOLCHAIN_CLEAN:=$(patsubst %,%-clean,$(TOOLCHAIN))
TOOLCHAIN_DIRCLEAN:=$(patsubst %,%-dirclean,$(TOOLCHAIN))
TOOLCHAIN_DISTCLEAN:=$(patsubst %,%-distclean,$(TOOLCHAIN))
TOOLCHAIN_SOURCE:=$(patsubst %,%-source,$(TOOLCHAIN))
ALL_PACKAGES:=
LOCALSOURCE_PACKAGES:=
include $(MAKE_DIR)/*/*.mk
NON_LOCALSOURCE_PACKAGES:=$(filter-out $(LOCALSOURCE_PACKAGES),$(ALL_PACKAGES))
PACKAGES_CHECK_DOWNLOADS:=$(patsubst %,%-check-download,$(NON_LOCALSOURCE_PACKAGES))
PACKAGES_MIRROR:=$(patsubst %,%-download-mirror,$(NON_LOCALSOURCE_PACKAGES))
ifeq ($(strip $(FREETZ_BUILD_TOOLCHAIN)),y)
include $(TOOLCHAIN_DIR)/make/kernel-toolchain.mk
include $(TOOLCHAIN_DIR)/make/target-toolchain.mk
else
include $(TOOLCHAIN_DIR)/make/download-toolchain.mk
endif
IMAGE:=$(DL_FW_DIR)/$(DL_SOURCE)
DL_IMAGE:=$(IMAGE)
$(DL_FW_DIR)/$(DL_SOURCE):
ifeq ($(strip $(FREETZ_TYPE_LABOR)),y)
@echo
@echo "Please copy the following file into the '$(DL_FW_DIR)' sub-directory manually:"
@echo "$(DL_SOURCE)"
@echo
@exit 3
else
@echo -e "\033[1mSTEP 0: DOWNLOAD\033[0m"
@echo "downloading firmware image"
@if [ -n "$(DL_SOURCE_CONTAINER)" ]; then \
if [ ! -r $(DL_FW_DIR)/$(DL_SOURCE_CONTAINER) ]; then \
if ! $(DL_TOOL) $(DL_FW_DIR) .config $(DL_SOURCE_CONTAINER) $(DL_SITE) $(DL_SOURCE_CONTAINER_MD5) $(SILENT); then \
$(call ERROR,3,Could not download Firmwareimage.) \
fi; \
fi; \
case "$(DL_SOURCE_CONTAINER_SUFFIX)" in \
.zip) \
if ! unzip $(DL_FW_DIR)/$(DL_SOURCE_CONTAINER) $(DL_SOURCE) -d $(DL_FW_DIR); then \
$(call ERROR,3,Could not unzip Firmwareimage.) \
fi \
;; \
esac \
elif ! $(DL_TOOL) $(DL_FW_DIR) .config $(DL_SOURCE) $(DL_SITE) $(DL_SOURCE_MD5) $(SILENT); then \
$(call ERROR,3,Could not download Firmwareimage.) \
fi
endif
ifneq ($(strip $(DL_SOURCE2)),)
IMAGE2:=$(DL_FW_DIR)/$(DL_SOURCE2)
DL_IMAGE+=$(IMAGE2)
$(DL_FW_DIR)/$(DL_SOURCE2):
ifeq ($(strip $(DL_SITE2)),)
@echo
@echo "Please copy the following file into the '$(DL_FW_DIR)' sub-directory manually:"
@echo "$(DL_SOURCE2)"
@echo
@exit 3
else
@if [ -n "$(DL_SOURCE2_CONTAINER)" ]; then \
if [ ! -r $(DL_FW_DIR)/$(DL_SOURCE2_CONTAINER) ]; then \
if ! $(DL_TOOL) $(DL_FW_DIR) .config $(DL_SOURCE2_CONTAINER) $(DL_SITE2) $(DL_SOURCE2_CONTAINER_MD5) $(SILENT); then \
$(call ERROR,3,Could not download Firmwareimage.) \
fi; \
fi; \
case "$(DL_SOURCE2_CONTAINER_SUFFIX)" in \
.zip) \
if ! unzip $(DL_FW_DIR)/$(DL_SOURCE2_CONTAINER) $(DL_SOURCE2) -d $(DL_FW_DIR); then \
$(call ERROR,3,Could not unzip Firmwareimage.) \
fi \
;; \
esac \
elif ! $(DL_TOOL) $(DL_FW_DIR) .config $(DL_SOURCE2) $(DL_SITE2) $(DL_SOURCE2_MD5) $(SILENT); then \
$(call ERROR,3,Could not download Firmwareimage.) \
fi
@echo "done."
@echo
endif
endif
package-list: package-list-clean $(PACKAGES_LIST)
@touch .static
@( echo "# Automatically generated - DO NOT EDIT!"; cat .static ) > .static.tmp
@mv .static.tmp .static
@touch .dynamic
@( echo "# Automatically generated - DO NOT EDIT!"; cat .dynamic ) > .dynamic.tmp
@mv .dynamic.tmp .dynamic
package-list-clean:
@$(RM) .static .dynamic
ifeq ($(FWMOD_NOPACK),y)
FWMOD_OPTS:=-u -m
endif
ifeq ($(strip $(PACKAGES)),)
firmware-nocompile: tools $(DL_IMAGE) package-list
@echo
@echo "WARNING: There are no packages selected. To install packages type"
@echo " 'make menuconfig' and change to the 'Package selection' submenu."
@echo
else
firmware-nocompile: tools $(DL_IMAGE) $(PACKAGES) package-list
endif
@$(FAKEROOT_TOOL) -- ./fwmod $(FWMOD_OPTS) -d $(BUILD_DIR) $(DL_IMAGE)
ifneq ($(FWMOD_PATCH_TEST),y)
ifneq ($(FWMOD_NOPACK),y)
ifeq ($(strip $(FREETZ_CUSTOM_IMAGE_NAME_PREFIX)),y)
@mv $(BUILD_DIR)/*_$(FREETZ_TYPE_STRING2)$(FREETZ_TYPE_STRING)* ./$(FW_IMAGES_DIR)
else
@mv $(BUILD_DIR)/$(FREETZ_TYPE_STRING2)$(FREETZ_TYPE_STRING)* ./$(FW_IMAGES_DIR)
endif
endif
endif
firmware: precompiled firmware-nocompile
test: $(BUILD_DIR)/modified
@echo "no tests defined"
toolchain-depend: | $(TOOLCHAIN)
toolchain: $(DL_DIR) $(SOURCE_DIR_ROOT) $(TOOLCHAIN)
@echo
@echo "FINISHED: $(TOOLCHAIN_DIR)/kernel/ - glibc compiler for the kernel"
@echo " $(TOOLCHAIN_DIR)/target/ - uClibc compiler for the userspace"
@echo
libs: $(DL_DIR) $(SOURCE_DIR_ROOT) $(LIBS_PRECOMPILED)
sources: $(DL_DIR) $(FW_IMAGES_DIR) $(SOURCE_DIR_ROOT) $(PACKAGES_DIR_ROOT) $(DL_IMAGE) \
$(TARGETS_SOURCE) $(PACKAGES_SOURCE) $(LIBS_SOURCE) $(TOOLCHAIN_SOURCE) $(TOOLS_SOURCE)
precompiled: $(DL_DIR) $(FW_IMAGES_DIR) $(SOURCE_DIR_ROOT) $(PACKAGES_DIR_ROOT) toolchain-depend \
$(LIBS_PRECOMPILED) $(TARGETS_PRECOMPILED) $(PACKAGES_PRECOMPILED)
check-downloads: $(PACKAGES_CHECK_DOWNLOADS)
mirror: $(MIRROR_DIR) $(PACKAGES_MIRROR)
clean: $(TARGETS_CLEAN) $(PACKAGES_CLEAN) $(LIBS_CLEAN) $(TOOLCHAIN_CLEAN) $(TOOLS_CLEAN) common-clean
dirclean: $(TOOLCHAIN_DIRCLEAN) $(TOOLS_DISTCLEAN) common-dirclean
distclean: $(TOOLCHAIN_DISTCLEAN) $(TOOLS_DISTCLEAN) common-distclean
.PHONY: firmware package-list package-list-clean sources precompiled toolchain toolchain-depend libs mirror check-downloads \
$(TARGETS) $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_PRECOMPILED) \
$(PACKAGES) $(PACKAGES_BUILD) $(PACKAGES_CLEAN) $(PACKAGES_DIRCLEAN) $(PACKAGES_LIST) $(PACKAGES_SOURCE) $(PACKAGES_PRECOMPILED) \
$(LIBS) $(LIBS_CLEAN) $(LIBS_DIRCLEAN) $(LIBS_SOURCE) $(LIBS_PRECOMPILED) \
$(TOOLCHAIN) $(TOOLCHAIN_CLEAN) $(TOOLCHAIN_DIRCLEAN) $(TOOLCHAIN_DISTCLEAN) $(TOOLCHAIN_SOURCE)
else
step: menuconfig
clean: $(TOOLS_CLEAN) common-clean
dirclean: $(TOOLS_DIRCLEAN) common-dirclean
distclean: $(TOOLS_DISTCLEAN) common-distclean
endif
tools: $(DL_DIR) $(SOURCE_DIR_ROOT) $(TOOLS)
tools-distclean: $(TOOLS_DISTCLEAN)
push-firmware:
@if [ ! -f "build/modified/firmware/var/tmp/kernel.image" ]; then \
echo "Please run 'make' first."; \
else \
$(TOOLS_DIR)/push_firmware build/modified/firmware/var/tmp/kernel.image ; \
fi
recover:
@if [ -z "$(IMAGE)" ]; then \
echo "Specify an image to recover." 1>&2; \
echo "e.g. make recover IMAGE=some.image" 1>&2; \
elif [ -z "$(RECOVER)" ]; then \
echo "Specify recover script." 1>&2; \
echo "make recover RECOVER=[adam|eva|ds]" 1>&2; \
echo " adam - old boxes like ATA (kernel 2.4)" 1>&2; \
echo " eva - all boxes with kernel 2.6" 1>&2; \
echo " ds - modified adam script from freetz" 1>&2; \
elif [ ! -r "$(IMAGE)" ]; then \
echo "Cannot read $(IMAGE)." 1>&2; \
else \
echo "This can help if your box is not booting any more"; \
echo "(Power LED on and flashing of all LEDs every 5 secs)."; \
echo; \
echo "Make sure that there is only one box in your subnet."; \
echo; \
while true; do \
echo "Are you sure you want to recover filesystem and kernel"; \
echo -n "from $(IMAGE)? (y/n) "; \
read yn; \
case "$$yn" in \
[yY]*) \
echo; \
if [ -z "$(LOCALIP)" ]; then \
echo "If this fails try to specify a local IP adress. Your"; \
echo "local IP has to be in the 192.168.178.0/24 subnet."; \
echo "e.g. make recover LOCALIP=192.168.178.20"; \
echo; \
$(TOOLS_DIR)/recover-$(RECOVER) -f "$(IMAGE)"; \
else \
$(TOOLS_DIR)/recover-$(RECOVER) -l $(LOCALIP) -f "$(IMAGE)"; \
fi; break ;; \
[nN]*) \
break ;; \
esac; \
done; \
fi
$(CONFIG)/conf:
$(MAKE) $(QUIET) -C $(CONFIG) conf
-@if [ ! -f .config ] ; then \
cp $(CONFIG_DEFCONFIG) .config; \
fi
$(CONFIG)/mconf:
$(MAKE) $(QUIET) -C $(CONFIG) ncurses conf mconf
-@if [ ! -f .config ] ; then \
cp $(CONFIG_DEFCONFIG) .config; \
fi
menuconfig: $(CONFIG_CONFIG_IN) $(CONFIG)/mconf
@$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
config: $(CONFIG_CONFIG_IN) $(CONFIG)/conf
@$(CONFIG)/conf $(CONFIG_CONFIG_IN)
oldconfig: $(CONFIG_CONFIG_IN) $(CONFIG)/conf
@$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
defconfig: $(CONFIG_CONFIG_IN) $(CONFIG)/conf
@$(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
config-clean-deps:
@{ \
cp .config .config_tmp; \
echo -n "Step 1: temporarily deactivate all kernel modules, shared libraries and optional BusyBox applets ... "; \
sed -i -r 's/^(FREETZ_(LIB|MODULE|BUSYBOX|SHARE)_)/# \1/' .config; \
echo "DONE"; \
echo -n "Step 2: reactivate only elements required by selected packages ... "; \
make oldconfig < /dev/null > /dev/null; \
echo "DONE"; \
echo "The following elements have been deactivated:"; \
diff -U 0 .config_tmp .config | sed -rn 's/^\+# ([^ ]+).*/ \1/p'; \
$(RM) .config_tmp; \
}
common-clean:
./fwmod_custom clean
$(RM) .static .dynamic .exclude-dist-tmp
$(RM) -r $(BUILD_DIR)
-$(MAKE) -C $(CONFIG) clean
common-dirclean: common-clean
$(RM) -r $(BUILD_DIR) $(PACKAGES_DIR_ROOT) $(SOURCE_DIR_ROOT)
-cp .defstatic $(ADDON_DIR)/static.pkg
-cp .defdynamic $(ADDON_DIR)/dynamic.pkg
common-distclean: common-dirclean
$(RM) .config .config.old .config.cmd .tmpconfig.h
$(RM) -r $(DL_DIR)
$(RM) -r $(FW_IMAGES_DIR)
$(RM) -r $(SOURCE_DIR_ROOT)
$(RM) -r $(TOOLCHAIN_BUILD_DIR)
$(RM) -r $(TOOLS_BUILD_DIR)
dist: distclean
version="$$(cat .version)"; \
curdir="$$(basename $$(pwd))"; \
dir="$$(cat .version | sed -e 's#^\(ds-[0-9\.]*\).*$$#\1#')"; \
( \
cd ../; \
[ "$$curdir" == "$$dir" ] || mv "$$curdir" "$$dir"; \
( \
find "$$dir" -type d -name .svn -prune; \
sed -e "s/\(.*\)/$$dir\/\1/" "$$dir/.exclude-dist"; \
echo "$${dir}/.exclude-dist"; \
echo "$${dir}/.exclude-dist-tmp"; \
) > "$$dir/.exclude-dist-tmp"; \
tar --exclude-from="$${dir}/.exclude-dist-tmp" -cvjf "$${version}.tar.bz2" "$$dir"; \
[ "$$curdir" == "$$dir" ] || mv "$$dir" "$$curdir"; \
cd "$$curdir"; \
)
$(RM) .exclude-dist-tmp
# Check if last build was with older svn version
check-builddir-version:
@if [ -e .config -a \
"$(BUILD_DIR_VERSION)" != "$(BUILD_LAST_VERSION)" -a \
.svn -nt .config ]; then \
echo -n -e $(_Y); \
echo "ERROR: You have updated to newer svn version since last modifying your config."; \
echo " You have to run 'make oldconfig' or 'make menuconfig' once before"; \
echo " building again."; \
echo -n -e $(_N); \
exit 3; \
fi;
@echo "$(BUILD_DIR_VERSION)" > .lastbuild-version
.PHONY: all world step menuconfig config oldconfig defconfig tools recover \
clean dirclean distclean common-clean common-dirclean common-distclean dist \
$(TOOLS) $(TOOLS_CLEAN) $(TOOLS_DIRCLEAN) $(TOOLS_DISTCLEAN) $(TOOLS_SOURCE) \
$(CHECK_BUILD_DIR_VERSION)