diff --git a/Makefile b/Makefile index c9187f71..22b0fe98 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,8 @@ null := space := ${null} ${null} ${space} := ${space} +prepared_stamp:=$(GLUON_BUILDDIR)/prepared + prepare: mkdir -p $(GLUON_IMAGEDIR) $(GLUON_BUILDDIR) echo 'src packages file:../openwrt/bin/$(BOARD)/packages' > $(GLUON_BUILDDIR)/opkg-$(BOARD).conf @@ -22,15 +24,27 @@ prepare: $(GLUON_OPENWRTDIR)/scripts/feeds update -a $(GLUON_OPENWRTDIR)/scripts/feeds install -a - echo 'CONFIG_TARGET_$(BOARD)=y' > $(GLUON_OPENWRTDIR)/.config - echo -e "$(subst ${ },\n,$(patsubst %,CONFIG_PACKAGE_%=m,$(GLUON_PACKAGES)))" >> $(GLUON_OPENWRTDIR)/.config - $(MAKE) -C $(GLUON_OPENWRTDIR) defconfig prepare package/compile + echo -e "CONFIG_TARGET_$(BOARD)=y\nCONFIG_TARGET_ROOTFS_JFFS2=n\n$(subst ${ },\n,$(patsubst %,CONFIG_PACKAGE_%=m,$(GLUON_PACKAGES)))" > $(GLUON_OPENWRTDIR)/.config + $(MAKE) -C $(GLUON_OPENWRTDIR) defconfig prepare + $(MAKE) -C $(GLUON_BUILDERDIR) kernel + $(MAKE) -C $(GLUON_OPENWRTDIR) package/compile -image-%: prepare + touch $(prepared_stamp) + +$(prepared_stamp): + $(MAKE) prepare + +image-%: $(prepared_stamp) $(MAKE) -C $(GLUON_BUILDERDIR) image \ PACKAGE_DIR=$(GLUON_OPENWRTDIR)/bin/$(BOARD)/packages \ PROFILE=$(subst image-,,$@) images: $(patsubst %,image-%,$(PROFILES)) -.PHONY: all images prepare +clean: + rm -rf $(GLUON_BUILDDIR) $(prepared_stamp) + +cleanall: clean + $(MAKE) -C $(GLUON_OPENWRTDIR) clean + +.PHONY: all images prepare clean cleanall diff --git a/builder/Makefile b/builder/Makefile index 8cea2ae0..a6cd3bd2 100644 --- a/builder/Makefile +++ b/builder/Makefile @@ -15,7 +15,7 @@ LC_ALL:=C LANG:=C export TOPDIR LC_ALL LANG export OPENWRT_VERBOSE=s -all: help +all: image include $(TOPDIR)/include/host.mk @@ -33,30 +33,6 @@ include $(INCLUDE_DIR)/version.mk REVISION:=$(shell $(GLUON_BUILDERDIR)/openwrt_rev.sh $(GLUONDIR)) export REVISION -define Helptext -Available Commands: - help: This help text - info: Show a list of available target profiles - clean: Remove images and temporary build files - image: Build an image (see below for more information). - -Building images: - By default 'make image' will create an image with the default - target profile and package set. You can use the following parameters - to change that: - - make image PROFILE="" # override the default target profile - make image PACKAGES=" [ [ ...]]" # include extra packages - make image FILES="" # include extra files from - make image BIN_DIR="" # alternative output directory for the images - -endef -$(eval $(call shexport,Helptext)) - -help: FORCE - echo "$$$(call shvar,Helptext)" - - include $(INCLUDE_DIR)/package-ipkg.mk # override variables from rules.mk @@ -90,17 +66,16 @@ endef include $(INCLUDE_DIR)/target.mk -_call_info: FORCE - echo 'Current Target: "$(BOARD)$(if $(SUBTARGET), ($(BOARDNAME)))"' - echo 'Default Packages: $(DEFAULT_PACKAGES)' - echo 'Available Profiles:' - echo; $(PROFILE_LIST) - BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $(USER_PACKAGES) $($(USER_PROFILE)_PACKAGES) kernel) # "-pkgname" in the package list means remove "pkgname" from the package list BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES)) PACKAGES:= +include $(INCLUDE_DIR)/kernel-build.mk + +kernel: FORCE + $(Kernel/CompileImage) + _call_image: echo 'Building images for $(BOARD)$(if $($(USER_PROFILE)_NAME), - $($(USER_PROFILE)_NAME))' echo 'Packages: $(BUILD_PACKAGES)' @@ -169,16 +144,9 @@ package_postinst: FORCE build_image: FORCE @echo @echo Building images... - $(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 \ + $(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image install TARGET_BUILD=1 \ $(if $(USER_PROFILE),PROFILE="$(USER_PROFILE)") -clean: - rm -rf $(TOPDIR)/tmp $(TOPDIR)/dl $(TARGET_DIR) $(BIN_DIR) - - -info: - (unset PROFILE FILES PACKAGES MAKEFLAGS; $(MAKE) -s _call_info) - image: (unset PROFILE FILES PACKAGES MAKEFLAGS; \ $(MAKE) _call_image \ @@ -188,5 +156,5 @@ image: BIN_DIR="$(GLUON_IMAGEDIR)" \ $(if $(PACKAGE_DIR),PACKAGE_DIR="$(PACKAGE_DIR)")) -.SILENT: help info image +.SILENT: image