2013-02-17 15:30:59 +00:00
all :
LC_ALL := C
LANG := C
export LC_ALL LANG
2016-03-22 12:01:18 +00:00
export SHELL := /usr/bin/env bash
2016-04-02 02:31:50 +00:00
GLUONPATH ?= $( PATH)
export GLUONPATH := $( GLUONPATH)
2013-02-17 20:29:20 +00:00
empty :=
space := $( empty) $( empty)
2016-04-02 02:31:50 +00:00
GLUONMAKE_EARLY = PATH = $( GLUONPATH) $( SUBMAKE) -C $( GLUON_ORIGOPENWRTDIR) -f $( GLUONDIR) /Makefile GLUON_TOOLS = 0 QUILT =
GLUONMAKE = PATH = $( GLUONPATH) $( SUBMAKE) -C $( GLUON_OPENWRTDIR) -f $( GLUONDIR) /Makefile
2013-02-17 15:30:59 +00:00
i f n e q ( $( OPENWRT_BUILD ) , 1 )
2013-02-11 22:06:19 +00:00
GLUONDIR := ${ CURDIR }
2013-02-11 03:52:16 +00:00
2013-04-04 19:00:15 +00:00
i n c l u d e $( GLUONDIR ) / i n c l u d e / g l u o n . m k
2013-02-11 03:52:16 +00:00
2014-05-11 08:43:10 +00:00
TOPDIR := $( GLUON_ORIGOPENWRTDIR)
2013-02-17 15:30:59 +00:00
export TOPDIR
2013-12-28 13:54:49 +00:00
update : FORCE
2015-01-11 08:48:31 +00:00
$( GLUONDIR) /scripts/update.sh
$( GLUONDIR) /scripts/patch.sh
2013-12-28 13:54:49 +00:00
2013-12-28 14:31:11 +00:00
update-patches : FORCE
2015-01-11 08:48:31 +00:00
$( GLUONDIR) /scripts/update.sh
$( GLUONDIR) /scripts/update-patches.sh
$( GLUONDIR) /scripts/patch.sh
2013-12-28 14:31:11 +00:00
2013-12-28 13:54:49 +00:00
- i n c l u d e $( TOPDIR ) / i n c l u d e / h o s t . m k
2013-02-17 15:30:59 +00:00
_SINGLE = export MAKEFLAGS = $( space) ;
o v e r r i d e OPENWRT_BUILD = 1
2014-05-07 22:49:46 +00:00
o v e r r i d e GLUON_TOOLS = 1
2013-02-17 15:30:59 +00:00
GREP_OPTIONS =
2014-05-07 22:49:46 +00:00
export OPENWRT_BUILD GLUON_TOOLS GREP_OPTIONS
2013-02-17 23:39:44 +00:00
2013-12-28 13:54:49 +00:00
- i n c l u d e $( TOPDIR ) / i n c l u d e / d e b u g . m k
- i n c l u d e $( TOPDIR ) / i n c l u d e / d e p e n d s . m k
2013-04-04 19:00:15 +00:00
i n c l u d e $( GLUONDIR ) / i n c l u d e / t o p l e v e l . m k
2013-02-17 15:30:59 +00:00
2015-01-03 03:40:18 +00:00
2015-03-14 18:10:23 +00:00
i n c l u d e $( GLUONDIR ) / t a r g e t s / t a r g e t s . m k
2015-01-25 02:31:37 +00:00
2014-02-05 21:12:50 +00:00
2015-07-12 20:37:09 +00:00
CheckTarget := [ -n '$(GLUON_TARGET)' -a -n '$(GLUON_TARGET_$(GLUON_TARGET)_BOARD)' ] \
2015-03-14 18:10:23 +00:00
|| ( echo -e 'Please set GLUON_TARGET to a valid target. Gluon supports the following targets:$(subst $(space),\n * ,$(GLUON_TARGETS))' ; false )
2013-03-07 20:50:15 +00:00
2013-12-28 21:13:18 +00:00
2014-05-11 08:43:10 +00:00
CheckExternal := test -d $( GLUON_ORIGOPENWRTDIR) || ( echo 'You don' "'" 't seem to have obtained the external repositories needed by Gluon; please call `make update` first!' ; false )
2014-05-09 06:52:25 +00:00
2014-05-11 08:43:10 +00:00
2015-10-14 18:12:52 +00:00
create-key : FORCE
@$( CheckExternal)
+@$( GLUONMAKE_EARLY) create-key
2014-05-11 08:43:10 +00:00
prepare-target : FORCE
@$( CheckExternal)
2015-03-14 18:10:23 +00:00
@$( CheckTarget)
2014-05-11 08:43:10 +00:00
+@$( GLUONMAKE_EARLY) prepare-target
all : prepare -target
2015-10-14 18:12:52 +00:00
+@$( GLUONMAKE) build-key
2013-02-17 15:30:59 +00:00
+@$( GLUONMAKE) prepare
+@$( GLUONMAKE) images
2015-10-13 19:36:19 +00:00
+@$( GLUONMAKE) modules
2013-02-17 15:30:59 +00:00
2014-05-11 08:43:10 +00:00
prepare : prepare -target
2015-10-14 18:12:52 +00:00
+@$( GLUONMAKE) build-key
2013-04-04 23:21:27 +00:00
+@$( GLUONMAKE) $@
2013-02-17 15:30:59 +00:00
2015-10-13 19:36:19 +00:00
clean download images modules : FORCE
2014-05-11 08:43:10 +00:00
@$( CheckExternal)
2015-03-14 18:10:23 +00:00
@$( CheckTarget)
2014-05-11 08:43:10 +00:00
+@$( GLUONMAKE_EARLY) maybe-prepare-target
2015-10-14 18:12:52 +00:00
+@$( GLUONMAKE) build-key
2014-05-09 07:06:41 +00:00
+@$( GLUONMAKE) $@
2015-03-14 18:10:23 +00:00
toolchain/% package/% target/% image/% : FORCE
2014-05-11 08:43:10 +00:00
@$( CheckExternal)
2015-03-14 18:10:23 +00:00
@$( CheckTarget)
2014-05-11 08:43:10 +00:00
+@$( GLUONMAKE_EARLY) maybe-prepare-target
2015-10-14 18:12:52 +00:00
+@$( GLUONMAKE) build-key
2014-02-06 12:20:34 +00:00
+@$( GLUONMAKE) $@
2014-05-11 08:43:10 +00:00
manifest : FORCE
2015-03-16 14:14:07 +00:00
@[ -n '$(GLUON_BRANCH)' ] || ( echo 'Please set GLUON_BRANCH to create a manifest.' ; false )
@echo '$(GLUON_PRIORITY)' | grep -qE '^([0-9]*\.)?[0-9]+$$' || ( echo 'Please specify a numeric value for GLUON_PRIORITY to create a manifest.' ; false )
2014-01-11 11:01:19 +00:00
@$( CheckExternal)
2015-03-14 18:10:23 +00:00
2015-03-16 14:14:07 +00:00
( \
2015-03-14 18:10:23 +00:00
echo 'BRANCH=$(GLUON_BRANCH)' && \
2015-03-14 20:55:24 +00:00
echo 'DATE=$(shell $(GLUON_ORIGOPENWRTDIR)/staging_dir/host/bin/lua $(GLUONDIR)/scripts/rfc3339date.lua)' && \
2015-03-14 18:10:23 +00:00
echo 'PRIORITY=$(GLUON_PRIORITY)' && \
echo \
2015-03-19 23:55:22 +00:00
) > $( GLUON_BUILDDIR) /$( GLUON_BRANCH) .manifest.tmp
2015-03-14 18:10:23 +00:00
+( $( foreach GLUON_TARGET,$( GLUON_TARGETS) , \
2015-03-16 14:14:07 +00:00
( [ ! -e $( BOARD_BUILDDIR) /prepared ] || ( $( GLUONMAKE) manifest GLUON_TARGET = '$(GLUON_TARGET)' V = s$( OPENWRT_VERBOSE) ) ) && \
2015-03-14 18:10:23 +00:00
) :)
2013-02-17 15:30:59 +00:00
2015-03-19 23:55:22 +00:00
mkdir -p $( GLUON_IMAGEDIR) /sysupgrade
mv $( GLUON_BUILDDIR) /$( GLUON_BRANCH) .manifest.tmp $( GLUON_IMAGEDIR) /sysupgrade/$( GLUON_BRANCH) .manifest
2015-03-14 21:23:42 +00:00
dirclean : FORCE
2015-03-16 14:14:07 +00:00
for dir in build_dir dl staging_dir tmp; do \
2015-03-14 21:23:42 +00:00
rm -rf $( GLUON_ORIGOPENWRTDIR) /$$ dir; \
done
2015-11-01 23:53:00 +00:00
rm -rf $( GLUON_BUILDDIR) $( GLUON_OUTPUTDIR)
2015-03-14 21:23:42 +00:00
2013-02-17 15:30:59 +00:00
e l s e
2013-02-11 22:06:19 +00:00
2014-05-11 08:43:10 +00:00
TOPDIR = ${ CURDIR }
export TOPDIR
2014-05-10 14:54:52 +00:00
i n c l u d e r u l e s . m k
2013-02-11 03:52:16 +00:00
2014-05-10 14:54:52 +00:00
i n c l u d e $( GLUONDIR ) / i n c l u d e / g l u o n . m k
2013-02-17 15:30:59 +00:00
2014-05-10 14:54:52 +00:00
i n c l u d e $( INCLUDE_DIR ) / h o s t . m k
2013-02-17 15:30:59 +00:00
i n c l u d e $( INCLUDE_DIR ) / d e p e n d s . m k
i n c l u d e $( INCLUDE_DIR ) / s u b d i r . m k
2013-02-17 23:39:44 +00:00
2013-02-17 15:30:59 +00:00
i n c l u d e p a c k a g e / M a k e f i l e
i n c l u d e t o o l s / M a k e f i l e
i n c l u d e t o o l c h a i n / M a k e f i l e
2014-05-20 03:48:01 +00:00
i n c l u d e t a r g e t / M a k e f i l e
2013-02-11 22:06:19 +00:00
2013-10-08 01:57:08 +00:00
2013-02-17 15:30:59 +00:00
PROFILES :=
PROFILE_PACKAGES :=
2013-10-08 01:57:08 +00:00
d e f i n e P r o f i l e
$( eval $( call Profile/Default) )
$( eval $( call Profile/$( 1) ) )
e n d e f
2013-02-12 06:14:18 +00:00
d e f i n e G l u o n P r o f i l e
PROFILES += $( 1)
2014-08-08 15:34:50 +00:00
PROFILE_PACKAGES += $( filter-out -%,$( 2) $( GLUON_$( 1) _SITE_PACKAGES) )
2015-10-11 19:07:33 +00:00
GLUON_$(1)_PROFILE := $( if $( 3) ,$( 3) ,$( 1) )
2013-04-05 20:53:09 +00:00
GLUON_$(1)_DEFAULT_PACKAGES := $( 2)
2015-03-13 20:26:44 +00:00
GLUON_$(1)_FACTORY_SUFFIX := -squashfs-factory
GLUON_$(1)_SYSUPGRADE_SUFFIX := -squashfs-sysupgrade
GLUON_$(1)_FACTORY_EXT := .bin
GLUON_$(1)_SYSUPGRADE_EXT := .bin
2014-02-05 21:12:50 +00:00
GLUON_$(1)_MODELS :=
e n d e f
2015-01-03 03:40:18 +00:00
d e f i n e G l u o n P r o f i l e F a c t o r y S u f f i x
GLUON_$(1)_FACTORY_SUFFIX := $( 2)
2015-03-13 20:26:44 +00:00
GLUON_$(1)_FACTORY_EXT := $( 3)
2015-01-03 03:40:18 +00:00
e n d e f
2015-01-25 02:31:37 +00:00
d e f i n e G l u o n P r o f i l e S y s u p g r a d e S u f f i x
GLUON_$(1)_SYSUPGRADE_SUFFIX := $( 2)
2015-03-13 20:26:44 +00:00
GLUON_$(1)_SYSUPGRADE_EXT := $( 3)
2015-01-25 02:31:37 +00:00
e n d e f
2014-02-05 21:12:50 +00:00
d e f i n e G l u o n M o d e l
2014-11-21 03:46:23 +00:00
GLUON_$(1)_MODELS += $( 3)
GLUON_$(1)_MODEL_$(3) := $( 2)
2015-10-16 17:11:36 +00:00
GLUON_$(1)_MODEL_$(3)_ALIASES :=
e n d e f
d e f i n e G l u o n M o d e l A l i a s
GLUON_$(1)_MODEL_$(2)_ALIASES += $( 3)
2013-02-12 06:14:18 +00:00
e n d e f
2014-05-10 09:52:06 +00:00
2015-11-25 01:28:37 +00:00
export SHA512SUM := $( GLUONDIR) /scripts/sha512sum.sh
2014-06-12 12:47:18 +00:00
prereq : FORCE
+$( NO_TRACE_MAKE) prereq
2014-05-12 05:59:06 +00:00
prepare-tmpinfo : FORCE
2015-05-28 00:45:19 +00:00
@+$( MAKE) -r -s staging_dir/host/.prereq-build OPENWRT_BUILD = QUIET = 0
2014-05-12 05:59:06 +00:00
mkdir -p tmp/info
$( _SINGLE) $( NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET = "packageinfo" SCAN_DIR = "package" SCAN_NAME = "package" SCAN_DEPS = " $( TOPDIR) /include/package*.mk $( TOPDIR) /overlay/*/*.mk " SCAN_EXTRA = ""
$( _SINGLE) $( NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET = "targetinfo" SCAN_DIR = "target/linux" SCAN_NAME = "target" SCAN_DEPS = " profiles/*.mk $( TOPDIR) /include/kernel*.mk $( TOPDIR) /include/target.mk " SCAN_DEPTH = 2 SCAN_EXTRA = "" SCAN_MAKEOPTS = "TARGET_BUILD=1"
for type in package target; do \
f = tmp/.$$ { type} info; t = tmp/.config-$$ { type} .in; \
[ " $$ t " -nt " $$ f " ] || ./scripts/metadata.pl $$ { type} _config " $$ f " > " $$ t " || { rm -f " $$ t " ; echo " Failed to build $$ t " ; false; break; } ; \
done
2015-03-20 00:34:02 +00:00
[ tmp/.config-feeds.in -nt tmp/.packagefeeds ] || ./scripts/feeds feed_config > tmp/.config-feeds.in
2014-05-12 05:59:06 +00:00
./scripts/metadata.pl package_mk tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; }
2015-03-20 00:34:02 +00:00
./scripts/metadata.pl package_feeds tmp/.packageinfo > tmp/.packagefeeds || { rm -f tmp/.packagefeeds; false; }
2014-05-12 05:59:06 +00:00
touch $( TOPDIR) /tmp/.build
2014-05-11 08:43:10 +00:00
feeds : FORCE
rm -rf $( TOPDIR) /package/feeds
mkdir $( TOPDIR) /package/feeds
[ ! -f $( GLUON_SITEDIR) /modules ] || . $( GLUON_SITEDIR) /modules && for feed in $$ GLUON_SITE_FEEDS; do ln -s ../../../packages/$$ feed $( TOPDIR) /package/feeds/$$ feed; done
2015-04-22 18:51:29 +00:00
ln -s ../../../package $( TOPDIR) /package/feeds/gluon
. $( GLUONDIR) /modules && for feed in $$ GLUON_FEEDS; do ln -s ../../../packages/$$ feed $( TOPDIR) /package/feeds/module_$$ feed; done
2014-05-12 05:59:06 +00:00
+$( GLUONMAKE_EARLY) prepare-tmpinfo
2014-05-11 08:43:10 +00:00
2015-05-28 00:45:19 +00:00
gluon-tools : FORCE
2015-11-02 14:09:01 +00:00
+$( GLUONMAKE_EARLY) tools/patch/install
2015-05-28 00:45:19 +00:00
+$( GLUONMAKE_EARLY) tools/sed/install
2015-11-02 14:09:01 +00:00
+$( GLUONMAKE_EARLY) tools/cmake/install
2015-10-14 18:12:52 +00:00
+$( GLUONMAKE_EARLY) package/lua/host/install package/usign/host/install
2015-11-25 01:28:37 +00:00
early_prepared_stamp := $( GLUON_BUILDDIR) /prepared_$( shell \
( \
$( SHA512SUM) $( GLUONDIR) /modules; \
[ ! -r $( GLUON_SITEDIR) /modules ] || $( SHA512SUM) $( GLUON_SITEDIR) /modules \
) | $( SHA512SUM) )
2015-11-01 23:58:34 +00:00
2015-10-14 18:12:52 +00:00
prepare-early : FORCE
for dir in build_dir dl staging_dir; do \
mkdir -p $( GLUON_ORIGOPENWRTDIR) /$$ dir; \
done
+$( GLUONMAKE_EARLY) feeds
+$( GLUONMAKE_EARLY) gluon-tools
2015-11-01 23:58:34 +00:00
mkdir -p $$ ( dirname $( early_prepared_stamp) )
touch $( early_prepared_stamp)
2015-11-25 10:35:34 +00:00
$(early_prepared_stamp) :
rm -f $( GLUON_BUILDDIR) /prepared_*
2015-11-01 23:58:34 +00:00
+$( GLUONMAKE_EARLY) prepare-early
$(GLUON_OPKG_KEY) : $( early_prepared_stamp ) FORCE
2015-10-14 18:12:52 +00:00
[ -s $( GLUON_OPKG_KEY) -a -s $( GLUON_OPKG_KEY) .pub ] || \
2016-02-13 16:02:11 +00:00
( mkdir -p $$ ( dirname $( GLUON_OPKG_KEY) ) && $( STAGING_DIR_HOST) /bin/usign -G -s $( GLUON_OPKG_KEY) -p $( GLUON_OPKG_KEY) .pub -c "Gluon opkg key" )
2015-10-14 18:12:52 +00:00
2015-11-01 23:58:34 +00:00
$(GLUON_OPKG_KEY).pub : $( GLUON_OPKG_KEY )
create-key : $( GLUON_OPKG_KEY ) .pub
2015-10-14 18:12:52 +00:00
i n c l u d e $( GLUONDIR ) / t a r g e t s / t a r g e t s . m k
i f n e q ( $( GLUON_TARGET ) , )
i n c l u d e $( GLUONDIR ) / t a r g e t s / $( GLUON_TARGET ) / p r o f i l e s . m k
BOARD := $( GLUON_TARGET_$( GLUON_TARGET) _BOARD)
override SUBTARGET : = $( GLUON_TARGET_ $ ( GLUON_TARGET ) _SUBTARGET )
target_prepared_stamp := $( BOARD_BUILDDIR) /target-prepared
gluon_prepared_stamp := $( BOARD_BUILDDIR) /prepared
PREPARED_RELEASE = $$ ( cat $( gluon_prepared_stamp) )
IMAGE_PREFIX = gluon-$( GLUON_SITE_CODE) -$( PREPARED_RELEASE)
MODULE_PREFIX = gluon-$( GLUON_SITE_CODE) -$( PREPARED_RELEASE)
i n c l u d e $( INCLUDE_DIR ) / t a r g e t . m k
build-key : FORCE
2015-12-02 14:06:25 +00:00
rm -f $( BUILD_KEY) $( BUILD_KEY) .pub
cp $( GLUON_OPKG_KEY) $( BUILD_KEY)
cp $( GLUON_OPKG_KEY) .pub $( BUILD_KEY) .pub
2015-05-28 00:45:19 +00:00
2015-03-21 13:49:55 +00:00
config : FORCE
2015-05-28 00:45:19 +00:00
+$( NO_TRACE_MAKE) scripts/config/conf OPENWRT_BUILD = QUIET = 0
2015-03-07 20:07:36 +00:00
+$( GLUONMAKE) prepare-tmpinfo
2014-05-11 08:43:10 +00:00
( \
2015-07-12 20:37:09 +00:00
cat $( GLUONDIR) /include/config; \
echo 'CONFIG_TARGET_$(GLUON_TARGET_$(GLUON_TARGET)_BOARD)=y' ; \
$( if $( GLUON_TARGET_$( GLUON_TARGET) _SUBTARGET) , \
echo 'CONFIG_TARGET_$(GLUON_TARGET_$(GLUON_TARGET)_BOARD)_$(GLUON_TARGET_$(GLUON_TARGET)_SUBTARGET)=y' ; \
) \
cat $( GLUONDIR) /targets/$( GLUON_TARGET) /config 2>/dev/null; \
2015-03-21 20:33:42 +00:00
echo 'CONFIG_BUILD_SUFFIX="gluon-$(GLUON_TARGET)"' ; \
2014-05-11 08:43:10 +00:00
echo '$(patsubst %,CONFIG_PACKAGE_%=m,$(sort $(filter-out -%,$(GLUON_DEFAULT_PACKAGES) $(GLUON_SITE_PACKAGES) $(PROFILE_PACKAGES))))' \
| sed -e 's/ /\n/g' ; \
2015-05-21 23:09:19 +00:00
echo '$(patsubst %,CONFIG_LUCI_LANG_%=y,$(GLUON_LANGS))' \
2015-03-18 17:14:21 +00:00
| sed -e 's/ /\n/g' ; \
2015-03-20 00:34:02 +00:00
) > $( BOARD_BUILDDIR) /config.tmp
scripts/config/conf --defconfig= $( BOARD_BUILDDIR) /config.tmp Config.in
2015-11-02 16:40:29 +00:00
+$( SUBMAKE) tools/install
2014-05-11 08:43:10 +00:00
2015-11-01 23:58:34 +00:00
prepare-target : $( GLUON_OPKG_KEY ) .pub
2015-03-07 17:12:52 +00:00
rm $( GLUON_OPENWRTDIR) /tmp || true
mkdir -p $( GLUON_OPENWRTDIR) /tmp
for link in build_dir config Config.in dl include Makefile package rules.mk scripts staging_dir target toolchain tools; do \
2014-05-11 08:43:10 +00:00
ln -sf $( GLUON_ORIGOPENWRTDIR) /$$ link $( GLUON_OPENWRTDIR) ; \
done
2015-03-07 17:12:52 +00:00
2014-05-11 08:43:10 +00:00
+$( GLUONMAKE) config
touch $( target_prepared_stamp)
2015-11-01 23:58:34 +00:00
$(target_prepared_stamp) :
2014-05-11 08:43:10 +00:00
+$( GLUONMAKE_EARLY) prepare-target
2015-11-01 23:58:34 +00:00
maybe-prepare-target : $( GLUON_OPKG_KEY ) .pub $( target_prepared_stamp )
2014-05-07 22:49:46 +00:00
2013-02-17 15:30:59 +00:00
$(BUILD_DIR)/.prepared : Makefile
@mkdir -p $$ ( dirname $@ )
@touch $@
$(toolchain/stamp-install) : $( tools /stamp -install )
2013-02-17 23:39:44 +00:00
$(package/stamp-compile) : $( package /stamp -cleanup )
2013-02-17 15:30:59 +00:00
2013-04-04 23:21:27 +00:00
2014-05-11 08:43:10 +00:00
clean : FORCE
+$( SUBMAKE) clean
2014-05-12 05:21:35 +00:00
rm -f $( gluon_prepared_stamp)
2013-04-05 20:53:09 +00:00
2013-09-28 16:39:32 +00:00
2014-05-11 08:43:10 +00:00
download : FORCE
2013-09-24 17:23:09 +00:00
+$( SUBMAKE) tools/download
+$( SUBMAKE) toolchain/download
+$( SUBMAKE) package/download
+$( SUBMAKE) target/download
2013-04-04 23:21:27 +00:00
2013-02-17 15:30:59 +00:00
toolchain : $( toolchain /stamp -install ) $( tools /stamp -install )
2013-02-17 23:39:44 +00:00
2013-04-06 20:23:33 +00:00
i n c l u d e $( INCLUDE_DIR ) / k e r n e l . m k
2013-02-17 23:39:44 +00:00
kernel : FORCE
2015-10-13 19:36:19 +00:00
+$( NO_TRACE_MAKE) -C $( TOPDIR) /target/linux/$( BOARD) $( LINUX_DIR) /.image TARGET_BUILD = 1
+$( NO_TRACE_MAKE) -C $( TOPDIR) /target/linux/$( BOARD) $( LINUX_DIR) /.modules TARGET_BUILD = 1
2013-02-17 23:39:44 +00:00
2013-02-17 15:30:59 +00:00
packages : $( package /stamp -compile )
2013-02-17 23:39:44 +00:00
$( _SINGLE) $( SUBMAKE) -r package/index
prepare-image : FORCE
rm -rf $( BOARD_KDIR)
mkdir -p $( BOARD_KDIR)
2015-07-10 15:41:07 +00:00
-cp $( KERNEL_BUILD_DIR) /* $( BOARD_KDIR) /
2015-05-21 23:09:19 +00:00
+$( SUBMAKE) -C $( TOPDIR) /target/linux/$( BOARD) /image image_prepare KDIR = " $( BOARD_KDIR) "
2013-02-17 15:30:59 +00:00
prepare : FORCE
2015-12-30 02:35:17 +00:00
@$( STAGING_DIR_HOST) /bin/lua $( GLUONDIR) /scripts/site_config.lua \
2014-05-13 18:19:32 +00:00
|| ( echo 'Your site configuration did not pass validation.' ; false )
2014-01-11 11:01:19 +00:00
2014-05-09 08:41:55 +00:00
mkdir -p $( GLUON_IMAGEDIR) $( BOARD_BUILDDIR)
echo 'src packages file:../openwrt/bin/$(BOARD)/packages' > $( BOARD_BUILDDIR) /opkg.conf
2013-02-11 22:06:19 +00:00
2013-09-24 17:23:09 +00:00
+$( GLUONMAKE) toolchain
+$( GLUONMAKE) kernel
+$( GLUONMAKE) packages
+$( GLUONMAKE) prepare-image
2013-02-12 01:03:37 +00:00
2014-01-20 01:19:59 +00:00
echo " $( GLUON_RELEASE) " > $( gluon_prepared_stamp)
2013-02-12 01:03:37 +00:00
2013-02-17 15:58:07 +00:00
$(gluon_prepared_stamp) :
2013-09-24 17:23:09 +00:00
+$( GLUONMAKE) prepare
2013-02-11 22:06:19 +00:00
2015-10-13 19:36:19 +00:00
modules : FORCE $( gluon_prepared_stamp )
-rm -f $( GLUON_MODULEDIR) /*/$( BOARD) /$( if $( SUBTARGET) ,$( SUBTARGET) ,generic) /*
-rmdir -p $( GLUON_MODULEDIR) /*/$( BOARD) /$( if $( SUBTARGET) ,$( SUBTARGET) ,generic)
mkdir -p $( GLUON_MODULEDIR) /$( MODULE_PREFIX) /$( BOARD) /$( if $( SUBTARGET) ,$( SUBTARGET) ,generic)
cp $( PACKAGE_DIR) /kmod-*.ipk $( GLUON_MODULEDIR) /$( MODULE_PREFIX) /$( BOARD) /$( if $( SUBTARGET) ,$( SUBTARGET) ,generic)
$( _SINGLE) $( SUBMAKE) -r package/index PACKAGE_DIR = $( GLUON_MODULEDIR) /$( MODULE_PREFIX) /$( BOARD) /$( if $( SUBTARGET) ,$( SUBTARGET) ,generic)
2013-04-05 20:53:09 +00:00
i n c l u d e $( INCLUDE_DIR ) / p a c k a g e - i p k g . m k
# override variables from rules.mk
PACKAGE_DIR = $( GLUON_OPENWRTDIR) /bin/$( BOARD) /packages
2015-03-21 18:04:51 +00:00
PROFILE_BUILDDIR = $( BOARD_BUILDDIR) /profiles/$( PROFILE)
2013-04-05 20:53:09 +00:00
PROFILE_KDIR = $( PROFILE_BUILDDIR) /kernel
2014-02-05 21:12:50 +00:00
BIN_DIR = $( PROFILE_BUILDDIR) /images
2013-04-05 20:53:09 +00:00
TARGET_DIR = $( PROFILE_BUILDDIR) /root
OPKG := \
IPKG_TMP = " $( TMP_DIR) /ipkgtmp " \
IPKG_INSTROOT = " $( TARGET_DIR) " \
IPKG_CONF_DIR = " $( TMP_DIR) " \
IPKG_OFFLINE_ROOT = " $( TARGET_DIR) " \
$( STAGING_DIR_HOST) /bin/opkg \
-f $( BOARD_BUILDDIR) /opkg.conf \
--cache $( TMP_DIR) /dl \
--offline-root $( TARGET_DIR) \
2014-07-04 21:37:17 +00:00
--force-postinstall \
2013-04-05 20:53:09 +00:00
--add-dest root:/ \
--add-arch all:100 \
--add-arch $( ARCH_PACKAGES) :200
EnableInitscript = ! grep -q '\#!/bin/sh /etc/rc.common' $( 1) || bash ./etc/rc.common $( 1) enable
2013-09-11 20:41:49 +00:00
2013-04-05 20:53:09 +00:00
enable_initscripts : FORCE
cd $( TARGET_DIR) && ( export IPKG_INSTROOT = $( TARGET_DIR) ; \
$( foreach script,$( wildcard $( TARGET_DIR) /etc/init.d/*) , \
2014-01-13 17:23:25 +00:00
$( call EnableInitscript,$( script) ) ; \
2013-04-05 20:53:09 +00:00
) : \
)
2013-09-11 20:41:49 +00:00
2014-01-13 17:23:25 +00:00
# Generate package list
2014-08-08 15:34:50 +00:00
$( eval $ ( call merge -lists ,INSTALL_PACKAGES ,DEFAULT_PACKAGES GLUON_DEFAULT_PACKAGES GLUON_SITE_PACKAGES GLUON_ $ ( PROFILE ) _DEFAULT_PACKAGES GLUON_ $ ( PROFILE ) _SITE_PACKAGES ) )
2013-09-11 20:41:49 +00:00
2013-04-05 20:53:09 +00:00
package_install : FORCE
$( OPKG) update
2015-05-21 23:09:19 +00:00
$( OPKG) install $( PACKAGE_DIR) /base-files_*.ipk $( PACKAGE_DIR) /libc_*.ipk
2013-04-05 20:53:09 +00:00
$( OPKG) install $( PACKAGE_DIR) /kernel_*.ipk
2014-01-13 17:23:25 +00:00
$( OPKG) install $( INSTALL_PACKAGES)
+$( GLUONMAKE) enable_initscripts
2013-04-05 20:53:09 +00:00
rm -f $( TARGET_DIR) /usr/lib/opkg/lists/* $( TARGET_DIR) /tmp/opkg.lock
2015-05-21 23:09:19 +00:00
# Remove opkg database when opkg is not intalled
if [ ! -x $( TARGET_DIR) /bin/opkg ] ; then rm -rf $( TARGET_DIR) /usr/lib/opkg; fi
2014-10-16 18:50:00 +00:00
i n c l u d e $( INCLUDE_DIR ) / v e r s i o n . m k
opkg_config : FORCE
2015-06-20 20:20:53 +00:00
for d in base packages luci routing telephony management; do \
2015-10-13 19:58:27 +00:00
echo " src/gz %n_ $$ d %U/ $$ d " ; \
done > $( TARGET_DIR) /etc/opkg/distfeeds.conf
$( VERSION_SED) $( TARGET_DIR) /etc/opkg/distfeeds.conf
2014-10-16 18:50:00 +00:00
2013-04-05 20:53:09 +00:00
image : FORCE
2015-03-21 17:46:46 +00:00
rm -rf $( TARGET_DIR) $( BIN_DIR) $( PROFILE_KDIR)
mkdir -p $( TARGET_DIR) $( BIN_DIR) $( TARGET_DIR) /tmp $( GLUON_IMAGEDIR) /factory $( GLUON_IMAGEDIR) /sysupgrade
2013-04-05 20:53:09 +00:00
cp -r $( BOARD_KDIR) $( PROFILE_KDIR)
2013-09-24 17:23:09 +00:00
+$( GLUONMAKE) package_install
2015-07-18 19:21:06 +00:00
+$( GLUONMAKE) opkg_config
2013-04-05 20:53:09 +00:00
$( call Image/mkfs/prepare)
2015-06-03 22:18:48 +00:00
$( _SINGLE) $( NO_TRACE_MAKE) -C $( TOPDIR) /target/linux/$( BOARD) /image install TARGET_BUILD = 1 IMG_PREFIX = gluon \
2015-10-11 19:07:33 +00:00
PROFILE = " $( GLUON_$( PROFILE) _PROFILE) " KDIR = " $( PROFILE_KDIR) " TARGET_DIR = " $( TARGET_DIR) " BIN_DIR = " $( BIN_DIR) " TMP_DIR = " $( TMP_DIR) "
2013-04-05 20:53:09 +00:00
2014-02-05 21:12:50 +00:00
$( foreach model,$( GLUON_$( PROFILE) _MODELS) , \
2015-03-13 20:26:44 +00:00
$( if $( GLUON_$( PROFILE) _SYSUPGRADE_EXT) , \
rm -f $( GLUON_IMAGEDIR) /sysupgrade/gluon-*-$( model) -sysupgrade$( GLUON_$( PROFILE) _SYSUPGRADE_EXT) && \
cp $( BIN_DIR) /gluon-$( GLUON_$( PROFILE) _MODEL_$( model) ) $( GLUON_$( PROFILE) _SYSUPGRADE_SUFFIX) $( GLUON_$( PROFILE) _SYSUPGRADE_EXT) $( GLUON_IMAGEDIR) /sysupgrade/$( IMAGE_PREFIX) -$( model) -sysupgrade$( GLUON_$( PROFILE) _SYSUPGRADE_EXT) && \
2015-01-03 03:40:18 +00:00
) \
2015-03-13 20:26:44 +00:00
$( if $( GLUON_$( PROFILE) _FACTORY_EXT) , \
rm -f $( GLUON_IMAGEDIR) /factory/gluon-*-$( model) $( GLUON_$( PROFILE) _FACTORY_EXT) && \
cp $( BIN_DIR) /gluon-$( GLUON_$( PROFILE) _MODEL_$( model) ) $( GLUON_$( PROFILE) _FACTORY_SUFFIX) $( GLUON_$( PROFILE) _FACTORY_EXT) $( GLUON_IMAGEDIR) /factory/$( IMAGE_PREFIX) -$( model) $( GLUON_$( PROFILE) _FACTORY_EXT) && \
2015-01-25 02:31:37 +00:00
) \
2015-10-16 17:11:36 +00:00
\
$( foreach alias,$( GLUON_$( PROFILE) _MODEL_$( model) _ALIASES) , \
$( if $( GLUON_$( PROFILE) _SYSUPGRADE_EXT) , \
rm -f $( GLUON_IMAGEDIR) /sysupgrade/gluon-*-$( alias ) -sysupgrade$( GLUON_$( PROFILE) _SYSUPGRADE_EXT) && \
ln -s $( IMAGE_PREFIX) -$( model) -sysupgrade$( GLUON_$( PROFILE) _SYSUPGRADE_EXT) $( GLUON_IMAGEDIR) /sysupgrade/$( IMAGE_PREFIX) -$( alias ) -sysupgrade$( GLUON_$( PROFILE) _SYSUPGRADE_EXT) && \
) \
$( if $( GLUON_$( PROFILE) _FACTORY_EXT) , \
rm -f $( GLUON_IMAGEDIR) /factory/gluon-*-$( alias ) $( GLUON_$( PROFILE) _FACTORY_EXT) && \
ln -s $( IMAGE_PREFIX) -$( model) $( GLUON_$( PROFILE) _FACTORY_EXT) $( GLUON_IMAGEDIR) /factory/$( IMAGE_PREFIX) -$( alias ) $( GLUON_$( PROFILE) _FACTORY_EXT) && \
) \
) \
2014-02-05 21:12:50 +00:00
) :
2013-04-05 20:53:09 +00:00
2015-10-16 17:11:36 +00:00
2014-05-10 09:52:06 +00:00
image/% : $( gluon_prepared_stamp )
+$( GLUONMAKE) image PROFILE = " $( patsubst image/%,%,$@ ) " V = s$( OPENWRT_VERBOSE)
2013-02-19 15:58:48 +00:00
call_image/% : FORCE
2013-09-24 17:23:09 +00:00
+$( GLUONMAKE) $( patsubst call_image/%,image/%,$@ )
2013-02-19 15:58:48 +00:00
images : $( patsubst %,call_image /%,$ ( PROFILES ) ) ;
2013-02-11 03:52:16 +00:00
2014-02-06 12:20:34 +00:00
manifest : FORCE
2015-03-14 18:10:23 +00:00
( \
cd $( GLUON_IMAGEDIR) /sysupgrade; \
$( foreach profile,$( PROFILES) , \
2015-10-27 21:44:03 +00:00
$( if $( GLUON_$( profile) _SYSUPGRADE_EXT) , \
$( foreach model,$( GLUON_$( profile) _MODELS) , \
file = " $( IMAGE_PREFIX) - $( model) -sysupgrade $( GLUON_$( profile) _SYSUPGRADE_EXT) " ; \
[ -e " $$ file " ] && echo '$(model)' " $( PREPARED_RELEASE) " " $$ ( $( SHA512SUM) " $$ file")" " $$ file " ; \
\
$( foreach alias,$( GLUON_$( profile) _MODEL_$( model) _ALIASES) , \
file = " $( IMAGE_PREFIX) - $( alias ) -sysupgrade $( GLUON_$( profile) _SYSUPGRADE_EXT) " ; \
[ -e " $$ file " ] && echo '$(alias)' " $( PREPARED_RELEASE) " " $$ ( $( SHA512SUM) " $$ file")" " $$ file " ; \
) \
) \
2014-07-20 14:33:46 +00:00
) \
2015-03-14 18:10:23 +00:00
) : \
2015-03-19 23:55:22 +00:00
) >> $( GLUON_BUILDDIR) /$( GLUON_BRANCH) .manifest.tmp
2014-02-06 12:20:34 +00:00
2015-10-14 18:12:52 +00:00
.PHONY : all create -key prepare images modules clean gluon -tools manifest
2013-02-17 15:30:59 +00:00
e n d i f
2015-10-14 18:12:52 +00:00
e n d i f