From bd8d51d6d727a4e0fb22dc2fb28c7042d4fdff63 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 5 Apr 2013 22:53:09 +0200 Subject: [PATCH] Merge builder Makefile into main Makefile --- Makefile | 91 ++++++++++++++++++++-- builder/Makefile | 109 --------------------------- builder/feeds.conf | 3 - {builder => include}/Makefile.image | 0 {builder => include}/Makefile.target | 0 include/gluon.mk | 3 +- 6 files changed, 86 insertions(+), 120 deletions(-) delete mode 100644 builder/Makefile delete mode 100644 builder/feeds.conf rename {builder => include}/Makefile.image (100%) rename {builder => include}/Makefile.target (100%) diff --git a/Makefile b/Makefile index af906b64..ee77ab8b 100644 --- a/Makefile +++ b/Makefile @@ -75,16 +75,23 @@ PROFILE_PACKAGES := gluon_prepared_stamp := $(GLUON_BUILDDIR)/$(BOARD)/prepared + define GluonProfile image/$(1): $(gluon_prepared_stamp) - $(NO_TRACE_MAKE) -C $(GLUON_BUILDERDIR) image PROFILE="$(1)" + $(GLUONMAKE) image PROFILE="$(1)" V=s$(OPENWRT_VERBOSE) PROFILES += $(1) PROFILE_PACKAGES += $(filter-out -%,$(2) $(GLUON_$(1)_SITE_PACKAGES)) +GLUON_$(1)_DEFAULT_PACKAGES := $(2) endef include $(GLUONDIR)/include/profiles.mk +# 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)) + + $(BUILD_DIR)/.prepared: Makefile @mkdir -p $$(dirname $@) @touch $@ @@ -103,13 +110,21 @@ refresh_feeds: FORCE scripts/feeds install -a; \ ) + +export define FEEDS +src-link gluon ../../packages_gluon +src-link packages ../../packages_openwrt +src-svn luci http://svn.luci.subsignal.org/luci/tags/0.11.1/contrib/package +endef + feeds: FORCE - ln -sf $(GLUON_BUILDERDIR)/feeds.conf feeds.conf + rm feeds.conf + echo "$$FEEDS" > feeds.conf $(GLUONMAKE) refresh_feeds V=s$(OPENWRT_VERBOSE) config: FORCE echo -e 'CONFIG_TARGET_$(BOARD)=y\nCONFIG_TARGET_ROOTFS_JFFS2=n\n$(subst ${space},\n,$(patsubst %,CONFIG_PACKAGE_%=m,$(sort $(GLUON_DEFAULT_PACKAGES) $(GLUON_SITE_PACKAGES) $(PROFILE_PACKAGES))))' > .config - $(SUBMAKE) defconfig OPENWRT_BUILD=0 + $(SUBMAKE) defconfig OPENWRT_BUILD= .config: $(GLUONMAKE) config @@ -123,8 +138,8 @@ download: .config FORCE toolchain: $(toolchain/stamp-install) $(tools/stamp-install) kernel: FORCE - $(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD) -f $(GLUON_BUILDERDIR)/Makefile.target $(LINUX_DIR)/.image TARGET_BUILD=1 - $(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD) -f $(GLUON_BUILDERDIR)/Makefile.target $(LINUX_DIR)/.modules TARGET_BUILD=1 + $(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 packages: $(package/stamp-compile) $(_SINGLE)$(SUBMAKE) -r package/index @@ -133,7 +148,7 @@ prepare-image: FORCE rm -rf $(BOARD_KDIR) mkdir -p $(BOARD_KDIR) cp $(KERNEL_BUILD_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf $(BOARD_KDIR)/ - $(SUBMAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image -f $(GLUON_BUILDERDIR)/Makefile.image prepare KDIR="$(BOARD_KDIR)" + $(SUBMAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image -f $(GLUONDIR)/include/Makefile.image prepare KDIR="$(BOARD_KDIR)" prepare: FORCE mkdir -p $(GLUON_IMAGEDIR) $(GLUON_BUILDDIR)/$(BOARD) @@ -151,6 +166,70 @@ prepare: FORCE $(gluon_prepared_stamp): $(GLUONMAKE) prepare + +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))) + +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));) \ + ) : \ + ) + +package_install: FORCE + $(OPKG) update + $(OPKG) install $(PACKAGE_DIR)/libc_*.ipk + $(OPKG) install $(PACKAGE_DIR)/kernel_*.ipk + + $(OPKG) install $(BASE_PACKAGES) + $(GLUONMAKE) enable_initscripts ENABLE_INITSCRIPTS_FROM=% + + $(OPKG) install $(GLUON_PACKAGES) + $(GLUONMAKE) enable_initscripts ENABLE_INITSCRIPTS_FROM="$(GLUON_PACKAGES)" + + 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) + + $(GLUONMAKE) package_install + + $(call Image/mkfs/prepare) + $(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 IMG_PREFIX="gluon-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))" \ + PROFILE="$(PROFILE)" KDIR="$(PROFILE_KDIR)" TARGET_DIR="$(TARGET_DIR)" BIN_DIR="$(BIN_DIR)" TMP_DIR="$(TMP_DIR)" + + call_image/%: FORCE $(GLUONMAKE) $(patsubst call_image/%,image/%,$@) diff --git a/builder/Makefile b/builder/Makefile deleted file mode 100644 index f05f27af..00000000 --- a/builder/Makefile +++ /dev/null @@ -1,109 +0,0 @@ -# Greatly modified OpenWRT Image Builder Makefile -# -# Copyright (C) 2007-2010 OpenWrt.org -# Copyright (C) 2013 Project Gluon -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -all: image - -include ${CURDIR}/../include/gluon.mk - -include $(TOPDIR)/include/host.mk -include $(TOPDIR)/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 - -include $(INCLUDE_DIR)/debug.mk -include $(INCLUDE_DIR)/depends.mk - -include $(INCLUDE_DIR)/version.mk - -REVISION:=$(shell $(GLUONDIR)/scripts/openwrt_rev.sh $(GLUONDIR)) -export REVISION - -include $(INCLUDE_DIR)/package-ipkg.mk - -# override variables from rules.mk -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 - -define Profile - $(eval $(call Profile/Default)) - $(eval $(call Profile/$(1))) - ifeq ($(PROFILE),) - PROFILE:=$(1) - endif - $(1)_NAME:=$(NAME) - $(1)_PACKAGES:=$(PACKAGES) -endef - -include $(INCLUDE_DIR)/target.mk - -define GluonProfile - GLUON_$(1)_DEFAULT_PACKAGES := $(2) -endef - -include $(GLUONDIR)/include/profiles.mk - -# Generate package list s -$(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)) - -include $(INCLUDE_DIR)/image.mk - -EnableInitscript = ! grep -q '\#!/bin/sh /etc/rc.common' $(1) || bash ./etc/rc.common $(1) enable -FileOrigin = $(firstword $(shell $(OPKG) search $(1))) - -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));) \ - ) : \ - ) - -package_install: FORCE - $(OPKG) update - $(OPKG) install $(PACKAGE_DIR)/libc_*.ipk - $(OPKG) install $(PACKAGE_DIR)/kernel_*.ipk - - $(OPKG) install $(BASE_PACKAGES) - $(NO_TRACE_MAKE) enable_initscripts ENABLE_INITSCRIPTS_FROM=% - - $(OPKG) install $(GLUON_PACKAGES) - $(NO_TRACE_MAKE) enable_initscripts ENABLE_INITSCRIPTS_FROM="$(GLUON_PACKAGES)" - - 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) - - $(NO_TRACE_MAKE) package_install - - $(call Image/mkfs/prepare) - $(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 IMG_PREFIX="gluon-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))" \ - PROFILE="$(PROFILE)" KDIR="$(PROFILE_KDIR)" TARGET_DIR="$(TARGET_DIR)" BIN_DIR="$(BIN_DIR)" TMP_DIR="$(TMP_DIR)" diff --git a/builder/feeds.conf b/builder/feeds.conf deleted file mode 100644 index 558752fc..00000000 --- a/builder/feeds.conf +++ /dev/null @@ -1,3 +0,0 @@ -src-link gluon ../../packages_gluon -src-link packages ../../packages_openwrt -src-svn luci http://svn.luci.subsignal.org/luci/tags/0.11.1/contrib/package diff --git a/builder/Makefile.image b/include/Makefile.image similarity index 100% rename from builder/Makefile.image rename to include/Makefile.image diff --git a/builder/Makefile.target b/include/Makefile.target similarity index 100% rename from builder/Makefile.target rename to include/Makefile.target diff --git a/include/gluon.mk b/include/gluon.mk index 0838fad3..b60df808 100644 --- a/include/gluon.mk +++ b/include/gluon.mk @@ -4,13 +4,12 @@ __gluon_inc=1 GLUON_SITEDIR := $(GLUONDIR)/site GLUON_IMAGEDIR := $(GLUONDIR)/images GLUON_OPENWRTDIR := $(GLUONDIR)/openwrt -GLUON_BUILDERDIR := $(GLUONDIR)/builder GLUON_BUILDDIR := $(GLUONDIR)/build BOARD_BUILDDIR = $(GLUON_BUILDDIR)/$(BOARD) BOARD_KDIR = $(BOARD_BUILDDIR)/kernel -export GLUONDIR GLUON_SITEDIR GLUON_IMAGEDIR GLUON_OPENWRTDIR GLUON_BUILDERDIR GLUON_BUILDDIR +export GLUONDIR GLUON_SITEDIR GLUON_IMAGEDIR GLUON_OPENWRTDIR GLUON_BUILDDIR $(GLUON_SITEDIR)/site.mk: $(error There was no site configuration found. Please check out a site configuration to $(GLUON_SITEDIR))