source: trunk/Makefile @ 8192

Letzte Änderung dieser Datei seit 8192 war 8192, erstellt von kriegaex vor 4 Jahren

As discussed on the dev mailing list, we have now macros for
config-clean-deps and a whole family of related targets.

  • Eigenschaft svn:keywords auf Id gesetzt
Dateigröße: 17.4 KB
Zeile 
1# Makefile for Freetz, Kernel 2.6 series
2#
3# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
4# Copyright (C) 2005-2006 by Daniel Eiband <eiband@online.de>
5# Copyright (C) 2006-2011 by the Freetz developers (http://freetz.org)
6#
7# Licensed under the GPL v2, see the file COPYING in this tarball.
8
9#--------------------------------------------------------------
10# Just run 'make menuconfig', configure stuff, then run 'make'.
11# You shouldn't need to mess with anything beyond this point...
12#--------------------------------------------------------------
13TOPDIR=.
14CONFIG_IN=Config.in
15CONFIG_IN_CACHE=$(CONFIG_IN).cache
16CONFIG=tools/config
17
18SHELL:=/bin/bash
19IMAGE:=
20LOCALIP:=
21RECOVER:=
22FREETZ_BASE_DIR:=$(shell pwd)
23ADDON_DIR:=addon
24BUILD_DIR:=build
25DL_DIR:=dl
26INCLUDE_DIR:=include
27MAKE_DIR:=make
28PACKAGES_DIR_ROOT:=packages
29SOURCE_DIR_ROOT:=source
30TOOLCHAIN_DIR:=toolchain
31TOOLS_DIR:=tools
32DL_FW_DIR:=$(DL_DIR)/fw
33FW_IMAGES_DIR:=images
34MIRROR_DIR:=$(DL_DIR)/mirror
35
36TOOLCHAIN_BUILD_DIR:=$(TOOLCHAIN_DIR)/$(BUILD_DIR)
37TOOLS_BUILD_DIR:=$(TOOLS_DIR)/$(BUILD_DIR)
38
39SED:=sed
40
41# Don't go parallel
42.NOTPARALLEL:
43
44MAKE1=make
45MAKE=make -j$(FREETZ_JLEVEL)
46
47DL_TOOL:=$(TOOLS_DIR)/freetz_download
48FAKEROOT_TOOL:=$(TOOLS_DIR)/$(BUILD_DIR)/bin/fakeroot
49PATCH_TOOL:=$(TOOLS_DIR)/freetz_patch
50PARSE_CONFIG_TOOL:=$(TOOLS_DIR)/parse-config
51CHECK_PREREQ_TOOL:=$(TOOLS_DIR)/check_prerequisites
52CHECK_BUILD_DIR_VERSION:=
53CHECK_UCLIBC_VERSION:=$(TOOLS_DIR)/check_uclibc
54
55_comma:= ,
56_empty:=
57_space:=$(_empty) $(_empty)
58
59export FW_IMAGES_DIR
60export FREETZ_BASE_DIR
61
62
63# Use echo -e "$(_Y)message$(_N)" if you want to print a yellow message
64IS_TTY=$(shell tty -s && echo 1 || echo 0)
65
66ifeq ($(IS_TTY),1)
67_Y:=\\033[33m
68__Y:=\033[33m
69_N:=\\033[m
70__N:=\033[m
71endif
72
73export __Y
74export __N
75
76define MESSAGE
77printf "%s\n" "$(1)" $(SILENT)
78endef
79
80# Print yellow error message and exit
81define ERROR
82printf "\n$(_Y)%s$(_N)\n" "ERROR: $(2)"exit $(1);
83endef
84
85# strip quotes and then whitespaces
86define qstrip
87$(strip $(subst ",,$(1)))
88endef
89
90# check for proper make version
91ifneq ($(filter 3.7% 3.80,$(MAKE_VERSION)),)
92$(error Your make ($(MAKE_VERSION)) is too old. Go get at least 3.81)
93endif
94
95# Current user == root? -> Error
96ifeq ($(shell echo $$UID),0)
97$(error Running makefile as root is prohibited! Please build Freetz as normal user)
98endif
99
100# Mod archive unpacked incorrectly (heuristics)? -> Error
101ifeq ($(shell MWW=make/mod/files/root/usr/mww; \
102    [ ! -L $$MWW/cgi-bin/index.cgi -o ! -x $$MWW/cgi-bin/status.cgi -o -x $$MWW/index.html ] \
103    && echo y\
104),y)
105$(error File permissions or links are wrong! Please unpack Freetz on a filesystem with Unix-like permissions)
106endif
107
108# Folder root/ needs 755 permissions
109ifneq ($(shell stat -c %a make/mod/files/root),755)
110$(error Please unpack/checkout again with umask set to 0022)
111endif
112
113# We need umask 0022
114ifneq ($(shell umask),0022)
115$(error Please run "umask 0022", it is now $(shell umask))
116endif
117
118# We don't like cygwin
119ifeq ($(shell uname -o),Cygwin)
120$(error Cygwin is not supported! Please use a real Linux environment)
121endif
122
123# git-svn removes empty directories, check for one of them
124ifneq (OK,$(shell [ -d make/mod/files/root/sys ] && echo OK ))
125$(error The empty directory root/sys is missing! Please do a clean checkout)
126endif
127
128# Run svn version update if building in working copy
129# TODO: Please check this, BUILD_DIR_VERSION is always empty
130#ifneq ($(BUILD_DIR_VERSION),)
131CHECK_BUILD_DIR_VERSION:=check-builddir-version
132#endif
133
134# Simple checking of build prerequisites
135ifneq ($(NO_PREREQ_CHECK),y)
136ifneq ($(shell $(CHECK_PREREQ_TOOL) \
137    $$(cat .build-prerequisites) \
138    >&2 \
139    && echo OK\
140),OK)
141$(error Some build prerequisites are missing! Please install the missing packages before trying again)
142endif
143endif
144
145# There are known problems with mksquashfs3 and SUSE's gcc-4.5.0
146ifeq ($(shell gcc --version | grep -q "gcc (SUSE Linux) 4.5.0 20100604" && echo y),y)
147$(error gcc (SUSE Linux) 4.5.0 has known bugs. Please install and use a different version)
148endif
149
150all: step
151world: $(CHECK_BUILD_DIR_VERSION) $(DL_DIR) $(BUILD_DIR) \
152    $(PACKAGES_DIR_ROOT) $(SOURCE_DIR_ROOT) $(TOOLCHAIN_BUILD_DIR)
153
154include $(TOOLS_DIR)/make/Makefile.in
155
156KCONFIG_TARGETS:=menuconfig menuconfig-single config oldconfig oldnoconfig defconfig allnoconfig allyesconfig randconfig listnewconfig
157
158noconfig_targets:=$(KCONFIG_TARGETS) tools \
159        $(TOOLS) $(CHECK_BUILD_DIR_VERSION)
160
161-include $(TOPDIR)/.config
162
163VERBOSE:=
164QUIET:=--quiet
165QUIETSHORT:=-q
166
167ifeq ($(strip $(FREETZ_VERBOSITY_LEVEL)),0)
168.SILENT:
169# Don't be silent when a menuconfig target is called
170ifneq ($(findstring menuconfig,$(MAKECMDGOALS)),menuconfig)
171#SILENT:= >>build.log 2>&1
172SILENT:= > /dev/null 2>&1
173endif
174endif
175
176ifeq ($(strip $(FREETZ_VERBOSITY_LEVEL)),2)
177#VERBOSE:=-v # Show files on untar
178QUIET:=
179QUIETSHORT:=
180endif
181
182export FREETZ_VERBOSITY_LEVEL
183export VERBOSE
184
185TOOLS_CLEAN:=$(patsubst %,%-clean,$(TOOLS))
186TOOLS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TOOLS))
187TOOLS_DISTCLEAN:=$(patsubst %,%-distclean,$(TOOLS))
188TOOLS_SOURCE:=$(patsubst %,%-source,$(TOOLS))
189
190include $(sort $(wildcard $(TOOLS_DIR)/make/*.mk))
191
192$(DL_DIR) \
193$(DL_FW_DIR) \
194$(MIRROR_DIR) \
195$(BUILD_DIR) \
196$(PACKAGES_DIR_ROOT) \
197$(SOURCE_DIR_ROOT) \
198$(TOOLCHAIN_BUILD_DIR) \
199$(TOOLS_BUILD_DIR) \
200$(FW_IMAGES_DIR):
201    @mkdir -p $@
202
203ifeq ($(strip $(FREETZ_HAVE_DOT_CONFIG)),y)
204
205step: image world tools firmware
206
207-include .config.cmd
208
209include $(TOOLCHAIN_DIR)/make/Makefile.in
210include $(MAKE_DIR)/Makefile.in
211include $(sort $(wildcard $(MAKE_DIR)/libs/*/Makefile.in))
212include $(sort $(wildcard $(MAKE_DIR)/*/Makefile.in))
213
214ALL_PACKAGES:=
215LOCALSOURCE_PACKAGES:=
216include $(sort $(wildcard $(MAKE_DIR)/libs/*/*.mk))
217include $(sort $(wildcard $(MAKE_DIR)/*/*.mk))
218NON_LOCALSOURCE_PACKAGES:=$(filter-out $(LOCALSOURCE_PACKAGES),$(ALL_PACKAGES))
219PACKAGES_CHECK_DOWNLOADS:=$(patsubst %,%-check-download,$(NON_LOCALSOURCE_PACKAGES))
220PACKAGES_MIRROR:=$(patsubst %,%-download-mirror,$(NON_LOCALSOURCE_PACKAGES))
221
222TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
223TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
224TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
225TARGETS_PRECOMPILED:=$(patsubst %,%-precompiled,$(TARGETS))
226
227PACKAGES_BUILD:=$(patsubst %,%-package,$(PACKAGES))
228PACKAGES_CLEAN:=$(patsubst %,%-clean,$(PACKAGES))
229PACKAGES_DIRCLEAN:=$(patsubst %,%-dirclean,$(PACKAGES))
230PACKAGES_LIST:=$(patsubst %,%-list,$(PACKAGES))
231PACKAGES_SOURCE:=$(patsubst %,%-source,$(PACKAGES))
232PACKAGES_PRECOMPILED:=$(patsubst %,%-precompiled,$(PACKAGES))
233
234LIBS_CLEAN:=$(patsubst %,%-clean,$(LIBS))
235LIBS_DIRCLEAN:=$(patsubst %,%-dirclean,$(LIBS))
236LIBS_SOURCE:=$(patsubst %,%-source,$(LIBS))
237LIBS_PRECOMPILED:=$(patsubst %,%-precompiled,$(LIBS))
238
239TOOLCHAIN_CLEAN:=$(patsubst %,%-clean,$(TOOLCHAIN))
240TOOLCHAIN_DIRCLEAN:=$(patsubst %,%-dirclean,$(TOOLCHAIN))
241TOOLCHAIN_DISTCLEAN:=$(patsubst %,%-distclean,$(TOOLCHAIN))
242TOOLCHAIN_SOURCE:=$(patsubst %,%-source,$(TOOLCHAIN))
243
244ifeq ($(strip $(FREETZ_BUILD_TOOLCHAIN)),y)
245include $(TOOLCHAIN_DIR)/make/kernel-toolchain.mk
246include $(TOOLCHAIN_DIR)/make/target-toolchain.mk
247else
248include $(TOOLCHAIN_DIR)/make/download-toolchain.mk
249endif
250
251DL_IMAGE:=
252image:
253
254# Download Firmware Image
255#  $(1) Suffix
256define DOWNLOAD_FIRMWARE
257ifneq ($(strip $(DL_SOURCE$(1))),)
258IMAGE$(1):=$(DL_FW_DIR)/$(DL_SOURCE$(1))
259DL_IMAGE+=$$(IMAGE$(1))
260image: $$(IMAGE$(1))
261$$(DL_FW_DIR)/$$(DL_SOURCE$(1)): | $(DL_FW_DIR)
262ifeq ($$(strip $$(DL_SITE$(1))),)
263    @echo
264    @echo "Please copy the following file into the '$$(DL_FW_DIR)' sub-directory manually:"
265    @echo "$$(DL_SOURCE$(1))"
266    @echo
267    @exit 3
268else
269    @if [ -n "$$(DL_SOURCE$(1)_CONTAINER)" ]; then \
270        if [ ! -r $$(DL_FW_DIR)/$$(DL_SOURCE$(1)_CONTAINER) ]; then \
271            if ! $$(DL_TOOL) $$(DL_FW_DIR) "$$(DL_SOURCE$(1)_CONTAINER)" "$$(DL_SITE$(1))" $$(DL_SOURCE$(1)_CONTAINER_MD5) $$(SILENT); then \
272                $$(call ERROR,3,Could not download firmware image. See http://trac.freetz.org/wiki/FAQ#Couldnotdownloadfirmwareimage for details.) \
273            fi; \
274        fi; \
275        case "$$(DL_SOURCE$(1)_CONTAINER_SUFFIX)" in \
276            .zip) \
277                if ! unzip $$(QUIETSHORT) $$(DL_FW_DIR)/$$(DL_SOURCE$(1)_CONTAINER) $$(DL_SOURCE$(1)) -d $$(DL_FW_DIR); then \
278                    $$(call ERROR,3,Could not unzip firmware image.) \
279                fi \
280                ;; \
281            *) \
282                $$(call ERROR,3,Could not extract firmware image.) \
283                ;; \
284        esac \
285    elif ! $$(DL_TOOL) $$(DL_FW_DIR) "$$(DL_SOURCE$(1))" "$$(DL_SITE$(1))" $$(DL_SOURCE$(1)_MD5) $$(SILENT); then \
286        $$(call ERROR,3,Could not download firmware image. See http://trac.freetz.org/wiki/FAQ#Couldnotdownloadfirmwareimage for details.) \
287    fi
288endif
289endif
290endef
291
292$(eval $(call DOWNLOAD_FIRMWARE))
293$(eval $(call DOWNLOAD_FIRMWARE,2))
294
295package-list: package-list-clean $(PACKAGES_LIST)
296    @touch .static
297    @( echo "# Automatically generated - DO NOT EDIT!"; cat .static ) > .static.tmp
298    @mv .static.tmp .static
299    @touch .dynamic
300    @( echo "# Automatically generated - DO NOT EDIT!"; cat .dynamic ) > .dynamic.tmp
301    @mv .dynamic.tmp .dynamic
302
303package-list-clean:
304    @$(RM) .static .dynamic
305
306ifeq ($(FWMOD_NOPACK),y)
307FWMOD_OPTS:=-u -m
308endif
309
310ifeq ($(strip $(PACKAGES)),)
311firmware-nocompile: tools $(DL_IMAGE) package-list
312    @echo
313    @echo "WARNING: There are no packages selected. To install packages type"
314    @echo "         'make menuconfig' and change to the 'Package selection' submenu."
315    @echo
316else
317firmware-nocompile: tools $(DL_IMAGE) $(PACKAGES) package-list
318endif
319    @$(FAKEROOT_TOOL) -- ./fwmod $(FWMOD_OPTS) -d $(BUILD_DIR) $(DL_IMAGE)
320ifneq ($(FWMOD_PATCH_TEST),y)
321ifneq ($(FWMOD_NOPACK),y)
322ifeq ($(strip $(FREETZ_CUSTOM_IMAGE_NAME_PREFIX)),y)
323    @mv $(BUILD_DIR)/*_$(FREETZ_TYPE_PREFIX_ALIEN_HARDWARE)$(FREETZ_TYPE_PREFIX)* ./$(FW_IMAGES_DIR)
324else
325    @mv $(BUILD_DIR)/$(FREETZ_TYPE_PREFIX_ALIEN_HARDWARE)$(FREETZ_TYPE_PREFIX)* ./$(FW_IMAGES_DIR)
326endif
327endif
328endif
329
330firmware: precompiled firmware-nocompile
331
332test: $(BUILD_DIR)/modified
333    @echo "no tests defined"
334
335toolchain-depend: | $(TOOLCHAIN)
336# Use KTV and TTV variables to provide new toolchain versions, i.e.
337#   make KTV=freetz-0.4 TTV=freetz-0.5 toolchain
338toolchain: $(DL_DIR) $(SOURCE_DIR_ROOT) $(TOOLCHAIN) tools
339    @echo
340    @echo "Creating toolchain tarballs ... "
341    @$(call TOOLCHAIN_CREATE_TARBALL,$(KERNEL_TOOLCHAIN_STAGING_DIR),$(KTV))
342    @$(call TOOLCHAIN_CREATE_TARBALL,$(TARGET_TOOLCHAIN_STAGING_DIR),$(TTV))
343    @echo
344    @echo "FINISHED: new download toolchains can be found in $(DL_DIR)/"
345
346libs: $(DL_DIR) $(SOURCE_DIR_ROOT) $(LIBS_PRECOMPILED)
347
348sources: $(DL_DIR) $(FW_IMAGES_DIR) $(SOURCE_DIR_ROOT) $(PACKAGES_DIR_ROOT) $(DL_IMAGE) \
349    $(TARGETS_SOURCE) $(PACKAGES_SOURCE) $(LIBS_SOURCE) $(TOOLCHAIN_SOURCE) $(TOOLS_SOURCE)
350
351precompiled: $(DL_DIR) $(FW_IMAGES_DIR) $(SOURCE_DIR_ROOT) $(PACKAGES_DIR_ROOT) toolchain-depend \
352    $(LIBS_PRECOMPILED) $(TARGETS_PRECOMPILED) $(PACKAGES_PRECOMPILED)
353
354check-downloads: $(PACKAGES_CHECK_DOWNLOADS)
355
356mirror: $(MIRROR_DIR) $(PACKAGES_MIRROR)
357
358clean: $(TARGETS_CLEAN) $(PACKAGES_CLEAN) $(LIBS_CLEAN) $(TOOLCHAIN_CLEAN) $(TOOLS_CLEAN) common-clean
359dirclean: $(TOOLCHAIN_DIRCLEAN) $(TOOLS_DISTCLEAN) common-dirclean
360distclean: $(TOOLCHAIN_DISTCLEAN) $(TOOLS_DISTCLEAN) common-distclean
361
362.PHONY: firmware package-list package-list-clean sources precompiled toolchain toolchain-depend libs mirror check-downloads \
363    $(TARGETS) $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_PRECOMPILED) \
364    $(PACKAGES) $(PACKAGES_BUILD) $(PACKAGES_CLEAN) $(PACKAGES_DIRCLEAN) $(PACKAGES_LIST) $(PACKAGES_SOURCE) $(PACKAGES_PRECOMPILED) \
365    $(LIBS) $(LIBS_CLEAN) $(LIBS_DIRCLEAN) $(LIBS_SOURCE) $(LIBS_PRECOMPILED) \
366    $(TOOLCHAIN) $(TOOLCHAIN_CLEAN) $(TOOLCHAIN_DIRCLEAN) $(TOOLCHAIN_DISTCLEAN) $(TOOLCHAIN_SOURCE)
367
368else
369
370step: menuconfig
371clean: $(TOOLS_CLEAN) common-clean
372dirclean: $(TOOLS_DIRCLEAN) common-dirclean
373distclean: $(TOOLS_DISTCLEAN) common-distclean
374
375endif
376
377tools: $(DL_DIR) $(SOURCE_DIR_ROOT) $(TOOLS)
378tools-dirclean: $(TOOLS_DIRCLEAN)
379tools-distclean: $(TOOLS_DISTCLEAN)
380
381push-firmware:
382    @if [ ! -f "build/modified/firmware/var/tmp/kernel.image" ]; then \
383        echo "Please run 'make' first."; \
384    else \
385        $(TOOLS_DIR)/push_firmware build/modified/firmware/var/tmp/kernel.image ; \
386    fi
387
388recover:
389    @if [ -z "$(IMAGE)" ]; then \
390        echo "Specify an image to recover." 1>&2; \
391        echo "e.g. make recover IMAGE=some.image" 1>&2; \
392    elif [ -z "$(RECOVER)" ]; then \
393        echo "Specify recover script." 1>&2; \
394        echo "make recover RECOVER=[adam|eva|ds]" 1>&2; \
395        echo "  adam - old boxes like ATA (kernel 2.4)" 1>&2; \
396        echo "  eva  - all boxes with kernel 2.6" 1>&2; \
397        echo "  ds   - modified adam script from freetz" 1>&2; \
398    elif [ ! -r "$(IMAGE)" ]; then \
399        echo "Cannot read $(IMAGE)." 1>&2; \
400    else \
401        echo "This can help if your box is not booting any more"; \
402        echo "(Power LED on and flashing of all LEDs every 5 secs)."; \
403        echo; \
404        echo "Make sure that there is only one box in your subnet."; \
405        echo; \
406        while true; do \
407            echo "Are you sure you want to recover filesystem and kernel"; \
408            echo -n "from $(IMAGE)? (y/n) "; \
409            read yn; \
410            case "$$yn" in \
411                [yY]*) \
412                    echo; \
413                    if [ -z "$(LOCALIP)" ]; then \
414                        echo "If this fails try to specify a local IP adress. Your"; \
415                        echo "local IP has to be in the 192.168.178.0/24 subnet."; \
416                        echo "e.g. make recover LOCALIP=192.168.178.20"; \
417                        echo; \
418                        $(TOOLS_DIR)/recover-$(RECOVER) -f "$(IMAGE)"; \
419                    else \
420                        $(TOOLS_DIR)/recover-$(RECOVER) -l $(LOCALIP) -f "$(IMAGE)"; \
421                    fi; break ;; \
422                [nN]*) \
423                    break ;; \
424            esac; \
425        done; \
426    fi
427
428menuconfig: config-cache $(CONFIG)/mconf
429    @$(CONFIG)/mconf $(CONFIG_IN_CACHE)
430
431menuconfig-single: config-cache $(CONFIG)/mconf
432    @MENUCONFIG_MODE="single_menu" $(CONFIG)/mconf $(CONFIG_IN_CACHE)
433
434config: config-cache $(CONFIG)/conf
435    @$(CONFIG)/conf $(CONFIG_IN_CACHE)
436
437oldconfig oldnoconfig defconfig allnoconfig allyesconfig randconfig listnewconfig: config-cache $(CONFIG)/conf
438    @$(CONFIG)/conf --$@ $(CONFIG_IN_CACHE)
439
440config-cache: $(CONFIG_IN_CACHE)
441
442-include include/config/cache.conf.cmd
443
444$(CONFIG_IN_CACHE) include/config/cache.conf.cmd: $(PARSE_CONFIG_TOOL) $(deps_config_cache)
445    @mkdir -p include/config include/generated
446    @$(PARSE_CONFIG_TOOL) $(CONFIG_IN) > $(CONFIG_IN_CACHE)
447
448# Macro to clean up config dependencies
449#   $(1) = target name to be defined
450#   $(2) = info text to be printed
451#   $(3) = sub-regex for removing symbols from .config
452define CONFIG_CLEAN_DEPS
453$(1):
454    @{ \
455    cp .config .config_tmp; \
456    echo -n "Step 1: temporarily deactivate all $(2) ... "; \
457    $$(SED) -i -r 's/^(FREETZ_($(3))_)/# \1/' .config; \
458    echo "DONE"; \
459    echo -n "Step 2: reactivate only elements required by selected packages ... "; \
460    make oldnoconfig > /dev/null; \
461    echo "DONE"; \
462    echo "The following elements have been deactivated:"; \
463    diff -U 0 .config_tmp .config | $$(SED) -rn 's/^\+# ([^ ]+) is not set$$$$/  \1/p'; \
464    $$(RM) .config_tmp; \
465    }
466endef
467
468# Decactivate optional stuff by category
469$(eval $(call CONFIG_CLEAN_DEPS,config-clean-deps-modules,kernel modules,MODULE))
470$(eval $(call CONFIG_CLEAN_DEPS,config-clean-deps-libs,shared libraries,LIB))
471$(eval $(call CONFIG_CLEAN_DEPS,config-clean-deps-busybox,BusyBox applets,BUSYBOX))
472$(eval $(call CONFIG_CLEAN_DEPS,config-clean-deps-terminfo,terminfos,SHARE_terminfo))
473# Deactivate all optional stuff
474$(eval $(call CONFIG_CLEAN_DEPS,config-clean-deps,kernel modules$(_comma) shared libraries$(_comma) BusyBox applets and terminfos,MODULE|LIB|BUSYBOX|SHARE_terminfo))
475# Deactivate all optional stuff except for Busybox applets
476$(eval $(call CONFIG_CLEAN_DEPS,config-clean-deps-keep-busybox,kernel modules$(_comma) shared libraries and terminfos,MODULE|LIB|SHARE_terminfo))
477
478common-clean:
479    ./fwmod_custom clean
480    $(RM) .static .dynamic .exclude-dist-tmp $(CONFIG_IN_CACHE)
481    $(RM) -r $(BUILD_DIR)
482
483common-dirclean: common-clean $(if $(FREETZ_HAVE_DOT_CONFIG),kernel-dirclean)
484    $(RM) -r $(BUILD_DIR) $(PACKAGES_DIR_ROOT) $(SOURCE_DIR_ROOT)
485    -cp .defstatic $(ADDON_DIR)/static.pkg
486    -cp .defdynamic $(ADDON_DIR)/dynamic.pkg
487
488common-distclean: common-dirclean $(if $(FREETZ_HAVE_DOT_CONFIG),kernel-distclean)
489    $(RM) -r .config .config.old .config.cmd .tmpconfig.h include/config include/generated
490    $(RM) -r $(DL_DIR)
491    $(RM) -r $(FW_IMAGES_DIR)
492    $(RM) -r $(SOURCE_DIR_ROOT)
493    $(RM) -r $(TOOLCHAIN_BUILD_DIR)
494    $(RM) -r $(TOOLS_BUILD_DIR)
495
496dist: distclean
497    version="$$(cat .version)"; \
498    curdir="$$(basename $$(pwd))"; \
499    dir="$$(cat .version | $(SED) -e 's#^\(ds-[0-9\.]*\).*$$#\1#')"; \
500    ( \
501        cd ../; \
502        [ "$$curdir" == "$$dir" ] || mv "$$curdir" "$$dir"; \
503        ( \
504            find "$$dir" -type d -name .svn -prune; \
505            $(SED) -e "s/\(.*\)/$$dir\/\1/" "$$dir/.exclude-dist"; \
506            echo "$${dir}/.exclude-dist"; \
507            echo "$${dir}/.exclude-dist-tmp"; \
508        ) > "$$dir/.exclude-dist-tmp"; \
509        tar --exclude-from="$${dir}/.exclude-dist-tmp" -cvjf "$${version}.tar.bz2" "$$dir"; \
510        [ "$$curdir" == "$$dir" ] || mv "$$dir" "$$curdir"; \
511        cd "$$curdir"; \
512    )
513    $(RM) .exclude-dist-tmp
514
515# Check if last build was with older svn version
516check-builddir-version: $(CONFIG_IN_CACHE)
517    @\
518    if [ -e .config -a \
519        $(CONFIG_IN_CACHE) -nt .config ]; then \
520        echo -n -e $(_Y); \
521        echo "ERROR: You have updated to a newer svn version since last modifying your"; \
522        echo "       config. You should either run 'make oldconfig' once before building"; \
523        echo "       again or 'make menuconfig' and change the config (otherwise it will not"; \
524        echo "       be saved and you will see this message again)."; \
525        echo -n -e $(_N); \
526        exit 3; \
527    fi; \
528
529.PHONY: all world step $(KCONFIG_TARGETS) config-cache tools recover \
530    config-clean-deps-modules config-clean-deps-libs config-clean-deps-busybox config-clean-deps-terminfo config-clean-deps config-clean-deps-keep-busybox \
531    clean dirclean distclean common-clean common-dirclean common-distclean dist \
532    $(TOOLS) $(TOOLS_CLEAN) $(TOOLS_DIRCLEAN) $(TOOLS_DISTCLEAN) $(TOOLS_SOURCE) \
533    $(CHECK_BUILD_DIR_VERSION)
Hinweis: Hilfe zum Repository-Browser finden Sie in TracBrowser.