2013-02-17 15:30:59 +00:00
|
|
|
all:
|
|
|
|
|
|
|
|
LC_ALL:=C
|
|
|
|
LANG:=C
|
|
|
|
export LC_ALL LANG
|
|
|
|
|
2013-02-17 20:29:20 +00:00
|
|
|
empty:=
|
|
|
|
space:= $(empty) $(empty)
|
|
|
|
|
2013-02-17 15:30:59 +00:00
|
|
|
GLUONMAKE = $(SUBMAKE) -C $(GLUON_OPENWRTDIR) -f $(GLUONDIR)/Makefile
|
|
|
|
|
|
|
|
ifneq ($(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
|
|
|
include $(GLUONDIR)/include/gluon.mk
|
2013-02-11 03:52:16 +00:00
|
|
|
|
2013-02-17 15:30:59 +00:00
|
|
|
TOPDIR:=$(GLUON_OPENWRTDIR)
|
|
|
|
export TOPDIR
|
|
|
|
|
|
|
|
include $(TOPDIR)/include/host.mk
|
|
|
|
|
|
|
|
_SINGLE=export MAKEFLAGS=$(space);
|
|
|
|
|
|
|
|
override OPENWRT_BUILD=1
|
2013-04-04 19:00:15 +00:00
|
|
|
override REVISION:=$(shell $(GLUONDIR)/scripts/openwrt_rev.sh $(GLUONDIR))
|
2013-02-17 15:30:59 +00:00
|
|
|
GREP_OPTIONS=
|
2013-02-17 23:39:44 +00:00
|
|
|
export OPENWRT_BUILD GREP_OPTIONS REVISION
|
|
|
|
|
2013-02-17 15:30:59 +00:00
|
|
|
include $(TOPDIR)/include/debug.mk
|
|
|
|
include $(TOPDIR)/include/depends.mk
|
2013-04-04 19:00:15 +00:00
|
|
|
include $(GLUONDIR)/include/toplevel.mk
|
2013-02-17 15:30:59 +00:00
|
|
|
|
2013-03-07 20:50:15 +00:00
|
|
|
define GluonProfile
|
|
|
|
image/$(1): FORCE
|
|
|
|
+@$$(GLUONMAKE) $$@
|
|
|
|
endef
|
|
|
|
|
2013-04-04 19:00:15 +00:00
|
|
|
include $(GLUONDIR)/include/profiles.mk
|
2013-03-07 20:50:15 +00:00
|
|
|
|
2013-02-17 15:30:59 +00:00
|
|
|
all: FORCE
|
|
|
|
+@$(GLUONMAKE) prepare
|
|
|
|
+@$(GLUONMAKE) images
|
|
|
|
|
2013-04-04 23:21:27 +00:00
|
|
|
download prepare images: FORCE
|
|
|
|
+@$(GLUONMAKE) $@
|
2013-02-17 15:30:59 +00:00
|
|
|
|
2013-04-04 23:21:27 +00:00
|
|
|
dirclean: clean
|
|
|
|
+@$(SUBMAKE) -C $(TOPDIR) -r dirclean
|
2013-02-17 15:30:59 +00:00
|
|
|
|
2013-04-04 23:21:27 +00:00
|
|
|
cleanall: clean
|
|
|
|
+@$(SUBMAKE) -C $(TOPDIR) -r clean
|
2013-02-17 15:30:59 +00:00
|
|
|
|
2013-04-04 23:21:27 +00:00
|
|
|
clean:
|
|
|
|
+@$(GLUONMAKE) clean
|
2013-02-17 15:30:59 +00:00
|
|
|
|
|
|
|
else
|
2013-02-11 22:06:19 +00:00
|
|
|
|
2013-04-04 19:00:15 +00:00
|
|
|
include $(GLUONDIR)/include/gluon.mk
|
2013-02-11 03:52:16 +00:00
|
|
|
|
2013-02-17 15:30:59 +00:00
|
|
|
include $(TOPDIR)/include/host.mk
|
|
|
|
|
|
|
|
include rules.mk
|
|
|
|
include $(INCLUDE_DIR)/depends.mk
|
|
|
|
include $(INCLUDE_DIR)/subdir.mk
|
2013-02-17 23:39:44 +00:00
|
|
|
|
2013-02-17 15:30:59 +00:00
|
|
|
include package/Makefile
|
|
|
|
include tools/Makefile
|
|
|
|
include toolchain/Makefile
|
2013-02-11 22:06:19 +00:00
|
|
|
|
2013-02-17 15:30:59 +00:00
|
|
|
BOARD := ar71xx
|
2013-10-08 01:57:08 +00:00
|
|
|
override SUBTARGET := generic
|
|
|
|
|
2013-02-17 15:30:59 +00:00
|
|
|
PROFILES :=
|
|
|
|
PROFILE_PACKAGES :=
|
|
|
|
|
|
|
|
gluon_prepared_stamp := $(GLUON_BUILDDIR)/$(BOARD)/prepared
|
2013-02-12 06:14:18 +00:00
|
|
|
|
2013-04-05 20:53:09 +00:00
|
|
|
|
2013-10-08 01:57:08 +00:00
|
|
|
define Profile
|
|
|
|
$(eval $(call Profile/Default))
|
|
|
|
$(eval $(call Profile/$(1)))
|
|
|
|
$(1)_PACKAGES := $(PACKAGES)
|
|
|
|
endef
|
|
|
|
|
2013-02-12 06:14:18 +00:00
|
|
|
define GluonProfile
|
2013-02-17 15:30:59 +00:00
|
|
|
image/$(1): $(gluon_prepared_stamp)
|
2013-09-24 17:23:09 +00:00
|
|
|
+$(GLUONMAKE) image PROFILE="$(1)" V=s$(OPENWRT_VERBOSE)
|
2013-02-12 06:14:18 +00:00
|
|
|
|
|
|
|
PROFILES += $(1)
|
2013-10-08 01:57:08 +00:00
|
|
|
PROFILE_PACKAGES += $(filter-out -%,$($(1)_PACKAGES) $(2) $(GLUON_$(1)_SITE_PACKAGES))
|
2013-04-05 20:53:09 +00:00
|
|
|
GLUON_$(1)_DEFAULT_PACKAGES := $(2)
|
2013-02-12 06:14:18 +00:00
|
|
|
endef
|
|
|
|
|
2013-10-08 01:57:08 +00:00
|
|
|
include $(INCLUDE_DIR)/target.mk
|
2013-04-04 19:00:15 +00:00
|
|
|
include $(GLUONDIR)/include/profiles.mk
|
2013-02-17 15:30:59 +00:00
|
|
|
|
2013-04-05 20:53:09 +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
|
|
|
clean: FORCE
|
|
|
|
rm -rf $(GLUON_BUILDDIR)
|
|
|
|
|
2013-04-05 01:24:55 +00:00
|
|
|
refresh_feeds: FORCE
|
|
|
|
( \
|
2013-09-24 18:26:30 +00:00
|
|
|
export MAKEFLAGS=V=s$(OPENWRT_VERBOSE) \
|
2013-04-05 01:24:55 +00:00
|
|
|
export SCAN_COOKIE=; \
|
|
|
|
scripts/feeds uninstall -a; \
|
|
|
|
scripts/feeds update -a; \
|
|
|
|
scripts/feeds install -a; \
|
|
|
|
)
|
|
|
|
|
2013-04-05 20:53:09 +00:00
|
|
|
|
2013-09-12 22:30:52 +00:00
|
|
|
define FEEDS
|
2013-10-09 17:58:28 +00:00
|
|
|
src-link gluon ../../packages/gluon
|
|
|
|
src-link packages ../../packages/openwrt
|
|
|
|
src-link routing ../../packages/routing
|
|
|
|
src-link luci ../../packages/luci
|
2013-04-05 20:53:09 +00:00
|
|
|
endef
|
2013-09-12 22:32:06 +00:00
|
|
|
export FEEDS
|
2013-04-05 20:53:09 +00:00
|
|
|
|
2013-09-28 16:39:32 +00:00
|
|
|
|
|
|
|
export GLUON_GENERATE := $(GLUONDIR)/scripts/generate.sh
|
2013-09-30 17:04:35 +00:00
|
|
|
export GLUON_CONFIGURE := $(GLUONDIR)/scripts/configure.pl
|
2013-09-28 16:39:32 +00:00
|
|
|
|
|
|
|
|
2013-02-17 15:30:59 +00:00
|
|
|
feeds: FORCE
|
2013-04-06 20:17:35 +00:00
|
|
|
rm -f feeds.conf
|
2013-04-05 20:53:09 +00:00
|
|
|
echo "$$FEEDS" > feeds.conf
|
2013-09-24 17:23:09 +00:00
|
|
|
+$(GLUONMAKE) refresh_feeds V=s$(OPENWRT_VERBOSE)
|
2013-02-17 15:30:59 +00:00
|
|
|
|
|
|
|
config: FORCE
|
2013-10-08 18:01:25 +00:00
|
|
|
echo \
|
|
|
|
'CONFIG_TARGET_$(BOARD)=y' \
|
|
|
|
'CONFIG_TARGET_ROOTFS_JFFS2=n' \
|
|
|
|
'$(patsubst %,CONFIG_PACKAGE_%=m,$(sort $(GLUON_DEFAULT_PACKAGES) $(GLUON_SITE_PACKAGES) $(PROFILE_PACKAGES)))' \
|
|
|
|
| sed -e 's/ /\n/g' > .config
|
2013-09-24 17:23:09 +00:00
|
|
|
$(_SINGLE)$(SUBMAKE) defconfig OPENWRT_BUILD=
|
2013-02-17 15:30:59 +00:00
|
|
|
|
2013-04-04 23:21:27 +00:00
|
|
|
.config:
|
2013-09-24 17:23:09 +00:00
|
|
|
+$(GLUONMAKE) config
|
2013-04-04 23:21:27 +00:00
|
|
|
|
|
|
|
download: .config 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
|
|
|
include $(INCLUDE_DIR)/kernel.mk
|
|
|
|
|
2013-02-17 23:39:44 +00:00
|
|
|
kernel: FORCE
|
2013-09-24 17:23:09 +00:00
|
|
|
+$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD) -f $(GLUONDIR)/include/Makefile.target $(LINUX_DIR)/.image TARGET_BUILD=1
|
|
|
|
+$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD) -f $(GLUONDIR)/include/Makefile.target $(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)
|
|
|
|
cp $(KERNEL_BUILD_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf $(BOARD_KDIR)/
|
2013-09-24 17:23:09 +00:00
|
|
|
+$(SUBMAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image -f $(GLUONDIR)/include/Makefile.image prepare KDIR="$(BOARD_KDIR)"
|
2013-02-17 15:30:59 +00:00
|
|
|
|
|
|
|
prepare: FORCE
|
2013-02-13 08:58:25 +00:00
|
|
|
mkdir -p $(GLUON_IMAGEDIR) $(GLUON_BUILDDIR)/$(BOARD)
|
|
|
|
echo 'src packages file:../openwrt/bin/$(BOARD)/packages' > $(GLUON_BUILDDIR)/$(BOARD)/opkg.conf
|
2013-02-11 22:06:19 +00:00
|
|
|
|
2013-09-24 17:23:09 +00:00
|
|
|
+$(GLUONMAKE) feeds
|
|
|
|
+$(GLUONMAKE) config
|
|
|
|
+$(GLUONMAKE) toolchain
|
|
|
|
+$(GLUONMAKE) kernel
|
|
|
|
+$(GLUONMAKE) packages
|
|
|
|
+$(GLUONMAKE) prepare-image
|
2013-02-12 01:03:37 +00:00
|
|
|
|
2013-02-17 15:30:59 +00:00
|
|
|
touch $(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
|
|
|
|
2013-04-05 20:53:09 +00:00
|
|
|
|
|
|
|
include $(INCLUDE_DIR)/package-ipkg.mk
|
|
|
|
|
|
|
|
# override variables from rules.mk
|
|
|
|
PACKAGE_DIR = $(GLUON_OPENWRTDIR)/bin/$(BOARD)/packages
|
|
|
|
BIN_DIR = $(GLUON_IMAGEDIR)/$(BOARD)/$(PROFILE)
|
|
|
|
|
|
|
|
PROFILE_BUILDDIR = $(BOARD_BUILDDIR)/$(PROFILE)
|
|
|
|
PROFILE_KDIR = $(PROFILE_BUILDDIR)/kernel
|
|
|
|
|
|
|
|
TMP_DIR = $(PROFILE_BUILDDIR)/tmp
|
|
|
|
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 \
|
|
|
|
--force-depends \
|
|
|
|
--force-overwrite \
|
|
|
|
--force-postinstall \
|
|
|
|
--cache $(TMP_DIR)/dl \
|
|
|
|
--offline-root $(TARGET_DIR) \
|
|
|
|
--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
|
|
|
|
FileOrigin = $(firstword $(shell $(OPKG) search $(1)))
|
|
|
|
|
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/*), \
|
|
|
|
$(if $(filter $(ENABLE_INITSCRIPTS_FROM),$(call FileOrigin,$(script))),$(call EnableInitscript,$(script));) \
|
|
|
|
) : \
|
|
|
|
)
|
|
|
|
|
2013-09-11 20:41:49 +00:00
|
|
|
|
|
|
|
# Generate package lists
|
|
|
|
$(eval $(call merge-lists,BASE_PACKAGES,DEFAULT_PACKAGES $(PROFILE)_PACKAGES))
|
|
|
|
$(eval $(call merge-lists,GLUON_PACKAGES,GLUON_DEFAULT_PACKAGES GLUON_SITE_PACKAGES GLUON_$(PROFILE)_DEFAULT_PACKAGES GLUON_$(PROFILE)_SITE_PACKAGES))
|
|
|
|
|
2013-04-05 20:53:09 +00:00
|
|
|
package_install: FORCE
|
|
|
|
$(OPKG) update
|
|
|
|
$(OPKG) install $(PACKAGE_DIR)/libc_*.ipk
|
|
|
|
$(OPKG) install $(PACKAGE_DIR)/kernel_*.ipk
|
|
|
|
|
|
|
|
$(OPKG) install $(BASE_PACKAGES)
|
2013-09-24 17:23:09 +00:00
|
|
|
+$(GLUONMAKE) enable_initscripts ENABLE_INITSCRIPTS_FROM=%
|
2013-04-05 20:53:09 +00:00
|
|
|
|
|
|
|
$(OPKG) install $(GLUON_PACKAGES)
|
2013-09-24 17:23:09 +00:00
|
|
|
+$(GLUONMAKE) enable_initscripts ENABLE_INITSCRIPTS_FROM="$(GLUON_PACKAGES)"
|
2013-04-05 20:53:09 +00:00
|
|
|
|
|
|
|
rm -f $(TARGET_DIR)/usr/lib/opkg/lists/* $(TARGET_DIR)/tmp/opkg.lock
|
|
|
|
|
|
|
|
image: FORCE
|
|
|
|
rm -rf $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR) $(PROFILE_KDIR)
|
|
|
|
mkdir -p $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR) $(TARGET_DIR)/tmp
|
|
|
|
cp -r $(BOARD_KDIR) $(PROFILE_KDIR)
|
|
|
|
|
2013-09-24 17:23:09 +00:00
|
|
|
+$(GLUONMAKE) package_install
|
2013-04-05 20:53:09 +00:00
|
|
|
|
|
|
|
$(call Image/mkfs/prepare)
|
2013-09-24 17:23:09 +00:00
|
|
|
$(_SINGLE)$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 IMG_PREFIX="gluon-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))" \
|
2013-04-05 20:53:09 +00:00
|
|
|
PROFILE="$(PROFILE)" KDIR="$(PROFILE_KDIR)" TARGET_DIR="$(TARGET_DIR)" BIN_DIR="$(BIN_DIR)" TMP_DIR="$(TMP_DIR)"
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2013-02-12 01:03:37 +00:00
|
|
|
.PHONY: all images prepare clean cleanall
|
2013-02-17 15:30:59 +00:00
|
|
|
|
|
|
|
endif
|