3 # Copyright (C) 2007-2010 OpenWrt.org
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
12 export TOPDIR LC_ALL LANG
13 export KBUILD_VERBOSE
=99
16 include $(TOPDIR
)/include/host.mk
18 ifneq ($(OPENWRT_BUILD
),1)
19 override OPENWRT_BUILD
=1
24 include $(INCLUDE_DIR
)/debug.mk
25 include $(INCLUDE_DIR
)/depends.mk
27 include $(INCLUDE_DIR
)/version.mk
33 info: Show a list of available target profiles
34 clean: Remove images and temporary build files
35 image
: Build an image
(see below for more information
).
38 By default
'make image' will create an image with the default
39 target profile and package set. You can use the following parameters
42 make image PROFILE
="<profilename>" # override the default target profile
43 make image PACKAGES
="<pkg1> [<pkg2> [<pkg3> ...]]" # include extra packages
44 make image FILES
="<path>" # include extra files from <path>
47 $(eval
$(call shexport
,Helptext
))
50 echo
"$$$(call shvar,Helptext)"
53 # override variables from rules.mk
54 PACKAGE_DIR
:=$(TOPDIR
)/packages
56 IPKG_TMP
="$(TOPDIR)/tmp/ipkgtmp" \
57 IPKG_INSTROOT
="$(TARGET_DIR)" \
58 IPKG_CONF_DIR
="$(TOPDIR)/tmp" \
59 IPKG_OFFLINE_ROOT
="$(TARGET_DIR)" \
60 $(SCRIPT_DIR
)/ipkg
-force-defaults
63 $(eval
$(call Profile
/Default
))
64 $(eval
$(call Profile
/$(1)))
69 $(1)_PACKAGES
:=$(PACKAGES
)
71 echo
'$(1):'; [ -z
'$(NAME)' ] || echo
' $(NAME)'; echo
' Packages: $(PACKAGES)';
74 include $(INCLUDE_DIR
)/target.mk
77 echo
'Current Target: "$(BOARD)$(if $(SUBTARGET), ($(BOARDNAME)))"'
78 echo
'Default Packages: $(DEFAULT_PACKAGES)'
79 echo
'Available Profiles:'
82 $(TOPDIR
)/tmp
/ipkg.conf
: FORCE
83 @mkdir
-p
$(TOPDIR
)/tmp
84 @echo
'dest root /' > $@
85 @echo
'src packages file:$(PACKAGE_DIR)' >> $@
87 BUILD_PACKAGES
:=$(sort $(DEFAULT_PACKAGES
) $(PACKAGES
) $($(PROFILE
)_PACKAGES
) kernel
)
88 # "-pkgname" in the package list means remove "pkgname" from the package list
89 BUILD_PACKAGES
:=$(filter-out $(filter -%,$(BUILD_PACKAGES
)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES
))),$(BUILD_PACKAGES
))
92 echo
'Building images for $(BOARD)$(if $($(PROFILE)_NAME), - $($(PROFILE)_NAME))'
93 echo
'Packages: $(BUILD_PACKAGES)'
96 mkdir
-p
$(TARGET_DIR
) $(BIN_DIR
) $(TMP_DIR
)
98 $(MAKE
) package_install
102 $(MAKE
) package_postinst
105 package_index
: $(TOPDIR
)/tmp
/ipkg.conf FORCE
107 @echo Building package index...
108 (cd
$(PACKAGE_DIR
); $(SCRIPT_DIR
)/ipkg-make-index.sh .
> Packages
&& \
109 gzip
-9c Packages
> Packages.gz \
110 ) >/dev
/null
2>/dev
/null
113 package_install
: FORCE
115 @echo Installing packages...
116 $(IPKG
) install $(BUILD_PACKAGES
)
120 @echo Copying extra files
121 $(CP
) $(FILES
)/* $(TARGET_DIR
)/
123 package_postinst
: FORCE
125 @echo Activating init scripts
128 for script in .
/etc
/init.d
/*; do \
129 grep
'#!/bin/sh /etc/rc.common' $$script >/dev
/null || continue
; \
130 IPKG_INSTROOT
=$(TARGET_DIR
) $(which bash
) .
/etc
/rc.common
$$script enable
; \
136 @echo Building images...
137 $(NO_TRACE_MAKE
) -C target
/linux
/$(BOARD
)/image
install TARGET_BUILD
=1 IB
=1
140 rm -rf tmp
$(TARGET_DIR
) $(BIN_DIR
)
143 .SILENT
: help
info image