From dff0ded43d30010b2536987c817a28557df96410 Mon Sep 17 00:00:00 2001 From: TolaMironcenko Date: Fri, 14 Feb 2025 10:52:35 +0700 Subject: [PATCH] added dirclean source download delete --- .gitignore | 4 +++- Makefile | 46 ++++++++++++++++++++------------------ package/busybox/busybox.mk | 5 ++++- scripts/funcs.mk | 25 ++++++++++++++++++++- 4 files changed, 55 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 0b96d3d..de96978 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ curses .config -.config.old \ No newline at end of file +.config.old +dl +output diff --git a/Makefile b/Makefile index f3cf190..06cac53 100644 --- a/Makefile +++ b/Makefile @@ -31,31 +31,11 @@ UC = $(shell echo $(Command) | tr '[:lower:]' '[:upper:]') # $(call CMD_INSTALL_$(call UC)) all: - $(call CMD_CONFIGURE_UCLIBC) - $(call CMD_BUILD_UCLIBC) - $(call CMD_INSTALL_UCLIBC) - + $(call download,busybox) $(call CMD_CONFIGURE_BUSYBOX) $(call CMD_BUILD_BUSYBOX) $(call CMD_INSTALL_BUSYBOX) - $(call CMD_CONFIGURE_ZLIB) - $(call CMD_BUILD_ZLIB) - $(call CMD_INSTALL_ZLIB) - - $(call CMD_CONFIGURE_DROPBEAR) - $(call CMD_BUILD_DROPBEAR) - $(call CMD_INSTALL_DROPBEAR) -ifeq (CONFIG_SIMPLE_SFTP_SERVER_DROPBEAR,y) - $(call CMD_CONFIGURE_SFTP_SERVER_DROPBEAR) - $(call CMD_BUILD_SFTP_SERVER_DROPBEAR) - $(call CMD_INSTALL_SFTP_SERVER_DROPBEAR) -endif - - $(call CMD_CONFIGURE_UBOOT) - $(call CMD_BUILD_UBOOT) - $(call CMD_INSTALL_UBOOT) - list-defconfigs: $(call list-defconfigs,$(TOPDIR)) @@ -68,4 +48,26 @@ list-defconfigs: ) $(call successmsg,Copy defconfig: $@ to .config is OK) -.PHONY: %_defconfig +%-dirclean: + $(call msg,Deleting: $(call split-,$@,1) build directory) + $(if \ + $(wildcard $(TOPDIR)/output/build/$(call split-,$@,1)), \ + $(call delete,$(TOPDIR)/output/build/$(call split-,$@,1)), \ + $(call msg,$(TOPDIR)/output/build/$(call split-,$@,1): not exists) \ + ) + $(call successmsg,Delete: $(call split-,$@,1) build directory) + +source: + $(call msg,Downloading busybox) + $(call download,busybox) + $(call successmsg,Download busybox) + +distclean: + @if [ -d $(TOPDIR)/dl ]; then \ + rm -rv dl; \ + fi + @if [ -d $(TOPDIR)/output ]; then \ + rm -rv output; \ + fi + +.PHONY: %_defconfig source %-dirclean list-defconfigs diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk index 9f66f43..da6ed7c 100644 --- a/package/busybox/busybox.mk +++ b/package/busybox/busybox.mk @@ -1,8 +1,11 @@ +BUSYBOX_VERSION = 1.36.1 +BUSYBOX_SITE = https://www.busybox.net/downloads +BUSYBOX_SOURCE = busybox-$(BUSYBOX_VERSION).tar.bz2 + define CMD_CONFIGURE_BUSYBOX $(call msg,configure_busybox) $(call warningmsg,configure_busybox) $(call successmsg,configure_busybox) - $(call errmsg,configure_busybox) endef define CMD_BUILD_BUSYBOX diff --git a/scripts/funcs.mk b/scripts/funcs.mk index ed905b2..a677528 100644 --- a/scripts/funcs.mk +++ b/scripts/funcs.mk @@ -5,7 +5,6 @@ green_background_color = \033[42m high_intensity_yellow_background_color = \033[103m high_intensity_red_background_color = \033[101m - define msg @echo -e "$(black_color)$(white_background_color) Info: $1 $(reset_color)" endef @@ -26,3 +25,27 @@ endef define copy_file @cp -v $1 $2 endef + +define delete + @rm -rv $1 +endef + +packagename = $(shell echo $(1) | tr '[:lower:]' '[:upper:]') + +define download_package_source_archive + $(if \ + $(wildcard $(TOPDIR)/dl/$(1)), + $(if \ + $(wildcard $(TOPDIR)/dl/$(1)/$($(packagename)_SOURCE)), \ + $(call msg,$(1) already exists), \ + $(shell wget $($(packagename)_SITE)/$($(packagename)_SOURCE) -O $(TOPDIR)/dl/$(1)/$($(packagename)_SOURCE);) \ + ), \ + $(shell mkdir -p $(TOPDIR)/dl/$(1);wget $($(packagename)_SITE)/$($(packagename)_SOURCE) -O $(TOPDIR)/dl/$(1)/$($(packagename)_SOURCE);) \ + ) +endef + +define download + $(call download_package_source_archive,$(1)) +endef + +split- = $(word $2,$(subst -, ,$1))