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
2017-11-28 20:29:56 +00:00
# initialize (possibly already user set) directory variables
GLUON_SITEDIR ?= site
GLUON_TMPDIR ?= tmp
GLUON_OUTPUTDIR ?= output
2016-04-02 02:31:50 +00:00
2017-01-18 16:21:43 +00:00
GLUON_IMAGEDIR ?= $( GLUON_OUTPUTDIR) /images
GLUON_PACKAGEDIR ?= $( GLUON_OUTPUTDIR) /packages
2013-02-17 20:29:20 +00:00
2017-11-28 20:29:56 +00:00
# check for spaces & resolve possibly relative paths
d e f i n e m k a b s p a t h
ifneq ( 1,$( words [ $( $( 1) ) ] ) )
$$ ( error $( 1) must not contain spaces)
endif
override $( 1) := $( abspath $( $( 1) ) )
e n d e f
$( eval $ ( call mkabspath ,GLUON_SITEDIR ) )
$( eval $ ( call mkabspath ,GLUON_TMPDIR ) )
$( eval $ ( call mkabspath ,GLUON_OUTPUTDIR ) )
$( eval $ ( call mkabspath ,GLUON_IMAGEDIR ) )
$( eval $ ( call mkabspath ,GLUON_PACKAGEDIR ) )
2017-01-18 16:21:43 +00:00
export GLUON_TMPDIR GLUON_IMAGEDIR GLUON_PACKAGEDIR DEVICES
2013-02-17 15:30:59 +00:00
2017-01-18 16:21:43 +00:00
$(GLUON_SITEDIR)/site.mk :
$( error No site configuration was found. Please check out a site configuration to $( GLUON_SITEDIR) )
2013-02-11 03:52:16 +00:00
2017-02-22 21:40:36 +00:00
i n c l u d e $( GLUON_SITEDIR ) / s i t e . m k
2013-02-11 03:52:16 +00:00
2018-01-10 14:49:33 +00:00
GLUON_WLAN_MESH ?= 11s
2013-02-11 03:52:16 +00:00
2017-02-22 21:40:36 +00:00
GLUON_RELEASE ?= $( error GLUON_RELEASE not set. GLUON_RELEASE can be set in site.mk or on the command line)
2013-02-17 15:30:59 +00:00
2018-01-10 14:49:33 +00:00
export GLUON_RELEASE GLUON_WLAN_MESH GLUON_REGION GLUON_DEBUG
2013-02-17 23:39:44 +00:00
2017-06-26 18:52:22 +00:00
show-release :
@echo '$(GLUON_RELEASE)'
2013-02-11 22:06:19 +00:00
2017-01-18 16:21:43 +00:00
update : FORCE
2017-01-19 16:27:14 +00:00
@GLUON_SITEDIR= '$(GLUON_SITEDIR)' scripts/update.sh
@GLUON_SITEDIR= '$(GLUON_SITEDIR)' scripts/patch.sh
@GLUON_SITEDIR= '$(GLUON_SITEDIR)' scripts/feeds.sh
2013-10-08 01:57:08 +00:00
2017-01-18 16:21:43 +00:00
update-patches : FORCE
2017-01-19 16:27:14 +00:00
@GLUON_SITEDIR= '$(GLUON_SITEDIR)' scripts/update.sh
@GLUON_SITEDIR= '$(GLUON_SITEDIR)' scripts/update-patches.sh
@GLUON_SITEDIR= '$(GLUON_SITEDIR)' scripts/patch.sh
2013-02-17 15:30:59 +00:00
2017-01-18 16:21:43 +00:00
update-feeds : FORCE
2017-01-19 16:27:14 +00:00
@GLUON_SITEDIR= '$(GLUON_SITEDIR)' scripts/feeds.sh
2013-10-08 01:57:08 +00:00
2014-02-05 21:12:50 +00:00
2017-01-18 16:21:43 +00:00
GLUON_TARGETS :=
2015-01-03 03:40:18 +00:00
2017-01-18 16:21:43 +00:00
d e f i n e G l u o n T a r g e t
gluon_target := $( 1) $$ ( if $( 2) ,-$( 2) )
GLUON_TARGETS += $$ ( gluon_target)
GLUON_TARGET_$$(gluon_target)_BOARD := $( 1)
GLUON_TARGET_$$(gluon_target)_SUBTARGET := $( if $( 3) ,$( 3) ,$( 2) )
2015-01-25 02:31:37 +00:00
e n d e f
2017-01-18 16:21:43 +00:00
i n c l u d e t a r g e t s / t a r g e t s . m k
2015-10-16 17:11:36 +00:00
2013-02-12 06:14:18 +00:00
2017-01-18 16:21:43 +00:00
LEDEMAKE = $( MAKE) -C lede
2015-10-14 18:12:52 +00:00
BOARD := $( GLUON_TARGET_$( GLUON_TARGET) _BOARD)
2017-01-18 16:21:43 +00:00
SUBTARGET := $( GLUON_TARGET_$( GLUON_TARGET) _SUBTARGET)
2017-09-07 01:21:42 +00:00
GLUON_CONFIG_VARS := \
GLUON_SITEDIR = '$(GLUON_SITEDIR)' \
GLUON_RELEASE = '$(GLUON_RELEASE)' \
GLUON_BRANCH = '$(GLUON_BRANCH)' \
GLUON_LANGS = '$(GLUON_LANGS)' \
BOARD = '$(BOARD)' \
SUBTARGET = '$(SUBTARGET)'
2017-01-18 16:21:43 +00:00
LEDE_TARGET := $( BOARD) $( if $( SUBTARGET) ,-$( SUBTARGET) )
2015-10-14 18:12:52 +00:00
2017-01-18 16:21:43 +00:00
export LEDE_TARGET
2014-05-11 08:43:10 +00:00
2015-03-07 17:12:52 +00:00
2017-01-18 16:21:43 +00:00
CheckTarget := [ '$(LEDE_TARGET)' ] \
|| ( echo 'Please set GLUON_TARGET to a valid target. Gluon supports the following targets:' ; $( foreach target,$( GLUON_TARGETS) ,echo ' * $(target)' ; ) false )
2015-03-07 17:12:52 +00:00
2017-01-18 16:21:43 +00:00
CheckExternal := test -d lede || ( echo 'You don' "'" 't seem to have obtained the external repositories needed by Gluon; please call `make update` first!' ; false )
2014-05-11 08:43:10 +00:00
2018-01-19 03:57:48 +00:00
d e f i n e C h e c k S i t e
@GLUON_SITEDIR= '$(GLUON_SITEDIR)' GLUON_SITE_CONFIG = '$(1).conf' $( LUA) scripts/site_config.lua \
|| ( echo 'Your site configuration ($(1).conf) did not pass validation.' ; false )
e n d e f
2014-05-11 08:43:10 +00:00
2017-02-16 17:36:20 +00:00
list-targets : FORCE
@$( foreach target,$( GLUON_TARGETS) ,echo '$(target)' ; )
2017-07-11 02:43:52 +00:00
GLUON_FEATURE_PACKAGES := $( shell scripts/features.sh '$(GLUON_FEATURES)' || echo '__ERROR__' )
i f n e q ( $( filter __ERROR__ ,$ ( GLUON_FEATURE_PACKAGES ) ) , )
2017-07-08 23:09:15 +00:00
$( error Error while evaluating GLUON_FEATURES )
e n d i f
2017-01-18 16:21:43 +00:00
GLUON_PACKAGES :=
d e f i n e m e r g e _ p a c k a g e s
$( foreach pkg,$( 1) ,
GLUON_PACKAGES := $$ ( strip $$ ( filter-out -$$ ( patsubst -%,%,$( pkg) ) $$ ( patsubst -%,%,$( pkg) ) ,$$ ( GLUON_PACKAGES) ) $( pkg) )
)
e n d e f
2017-09-07 01:21:42 +00:00
$( eval $ ( call merge_packages ,$ ( GLUON_FEATURE_PACKAGES ) $ ( GLUON_SITE_PACKAGES ) ) )
2013-02-11 22:06:19 +00:00
2017-01-18 16:21:43 +00:00
config : FORCE
@$( CheckExternal)
@$( CheckTarget)
2013-02-12 01:03:37 +00:00
2017-09-07 01:21:42 +00:00
@$( GLUON_CONFIG_VARS) \
scripts/target_config.sh '$(GLUON_TARGET)' '$(GLUON_PACKAGES)' \
> lede/.config
2017-01-18 16:21:43 +00:00
+@$( LEDEMAKE) defconfig
2013-02-12 01:03:37 +00:00
2017-09-07 01:21:42 +00:00
@$( GLUON_CONFIG_VARS) \
scripts/target_config_check.sh '$(GLUON_TARGET)' '$(GLUON_PACKAGES)'
2013-02-11 22:06:19 +00:00
2015-10-13 19:36:19 +00:00
2017-01-18 16:21:43 +00:00
LUA := lede/staging_dir/hostpkg/bin/lua
2015-10-13 19:36:19 +00:00
2017-01-18 16:21:43 +00:00
$(LUA) :
@$( CheckExternal)
2013-04-05 20:53:09 +00:00
2017-01-18 16:21:43 +00:00
+@[ -e lede/.config ] || $( LEDEMAKE) defconfig
+@$( LEDEMAKE) tools/install
+@$( LEDEMAKE) package/lua/host/install
2013-04-05 20:53:09 +00:00
2017-01-18 16:21:43 +00:00
prepare-target : config $( LUA ) ;
2013-04-05 20:53:09 +00:00
2017-01-18 16:21:43 +00:00
all : prepare -target
2018-01-19 03:57:48 +00:00
$( foreach conf,site $( patsubst $( GLUON_SITEDIR) /%.conf,%,$( wildcard $( GLUON_SITEDIR) /domains/*.conf) ) ,$( call CheckSite,$( conf) ) )
2013-04-05 20:53:09 +00:00
2017-01-18 16:21:43 +00:00
@scripts/clean_output.sh
+@$( LEDEMAKE)
@GLUON_SITEDIR= '$(GLUON_SITEDIR)' scripts/copy_output.sh '$(GLUON_TARGET)'
2013-04-05 20:53:09 +00:00
2017-01-18 16:21:43 +00:00
clean download : config
+@$( LEDEMAKE) $@
2013-04-05 20:53:09 +00:00
2017-01-18 16:21:43 +00:00
dirclean : FORCE
+@[ -e lede/.config ] || $( LEDEMAKE) defconfig
+@$( LEDEMAKE) dirclean
@rm -rf $( GLUON_TMPDIR) $( GLUON_OUTPUTDIR)
2013-04-05 20:53:09 +00:00
2017-01-18 16:21:43 +00:00
manifest : $( LUA ) FORCE
@[ '$(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 )
@$( CheckExternal)
2013-09-11 20:41:49 +00:00
2017-01-18 16:21:43 +00:00
@( \
echo 'BRANCH=$(GLUON_BRANCH)' && \
echo " DATE= $$ ( $( LUA) scripts/rfc3339date.lua) " && \
echo 'PRIORITY=$(GLUON_PRIORITY)' && \
echo && \
$( foreach GLUON_TARGET,$( GLUON_TARGETS) , \
GLUON_SITEDIR = '$(GLUON_SITEDIR)' scripts/generate_manifest.sh '$(GLUON_TARGET)' && \
2015-03-14 18:10:23 +00:00
) : \
2017-01-18 16:21:43 +00:00
) > 'tmp/$(GLUON_BRANCH).manifest.tmp'
2014-02-06 12:20:34 +00:00
2017-01-18 16:21:43 +00:00
@mkdir -p '$(GLUON_IMAGEDIR)/sysupgrade'
@mv 'tmp/$(GLUON_BRANCH).manifest.tmp' '$(GLUON_IMAGEDIR)/sysupgrade/$(GLUON_BRANCH).manifest'
2013-02-17 15:30:59 +00:00
2017-01-18 16:21:43 +00:00
FORCE : ;
.PHONY : FORCE
.NOTPARALLEL :