From 9aeef7fda2cd1285a2b52c81d5eac87b5aa9b0e3 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sun, 6 Dec 2020 01:32:57 +0100 Subject: [PATCH] - autoset TARGET_ and REMOVE_ directory variables --- Makefile | 1 - make/environment-build.mk | 3 +- make/environment-target.mk | 84 +++++++++++++++++++------------------- make/target-rootfs.mk | 2 +- 4 files changed, 46 insertions(+), 44 deletions(-) diff --git a/Makefile b/Makefile index e0031ba6..734ef760 100755 --- a/Makefile +++ b/Makefile @@ -85,7 +85,6 @@ include make/environment-box.mk include make/environment-linux.mk include make/environment-build.mk include make/environment-image.mk -include make/environment-target.mk include make/environment-update.mk printenv: diff --git a/make/environment-build.mk b/make/environment-build.mk index 0bd254a6..f7e8a413 100644 --- a/make/environment-build.mk +++ b/make/environment-build.mk @@ -38,7 +38,6 @@ ifeq ($(BOXSERIES), $(filter $(BOXSERIES), hd5x)) endif DEPS_DIR = $(BASE_DIR)/deps D = $(DEPS_DIR) -TARGET_DIR ?= $(BASE_DIR)/root SOURCE_DIR ?= $(BASE_DIR)/source MAKE_DIR = $(BASE_DIR)/make LOCAL_DIR = $(BASE_DIR)/local @@ -146,6 +145,8 @@ else ifeq ($(BOXSERIES), $(filter $(BOXSERIES), vuduo)) endif +include make/environment-target.mk + STATIC_libdir = $(STATIC_DIR)/$(prefix)/lib TARGET_CFLAGS = -pipe $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_ABI) $(TARGET_EXTRA_CFLAGS) $(CXX11_ABI) -I$(TARGET_includedir) diff --git a/make/environment-target.mk b/make/environment-target.mk index 38c1ddb0..13b7e7fa 100644 --- a/make/environment-target.mk +++ b/make/environment-target.mk @@ -16,7 +16,7 @@ base_datadir = $(base_datarootdir) base_includedir = $(base_prefix)/include base_libdir = $(base_prefix)/lib -modulesdir = $(base_libdir)/modules +modulesdir = $(base_libdir)/modules/$(KERNEL_VER) # ----------------------------------------------------------------------------- @@ -43,55 +43,57 @@ libdir = $(exec_prefix)/lib lispdir = $(datarootdir)/emacs/site-lisp localedir = $(datarootdir)/locale mandir = $(datadir)/man -mandir1 = $(mandir)/man1 -mandir2 = $(mandir)/man2 +man1dir = $(mandir)/man1 +man2dir = $(mandir)/man2 # ----------------------------------------------------------------------------- -REMOVE_dir = /.remove -REMOVE_bindir = $(REMOVE_dir)/bin -REMOVE_sbindir = $(REMOVE_dir)/sbin -REMOVE_libexecdir = $(REMOVE_dir)/libexec -REMOVE_datarootdir = $(REMOVE_dir)/share -REMOVE_datadir = $(REMOVE_datarootdir) -REMOVE_sysconfdir = $(REMOVE_dir)/etc -REMOVE_sharedstatedir = $(REMOVE_dir)/com -REMOVE_localstatedir = $(REMOVE_dir)/var -REMOVE_runstatedir = $(REMOVE_localstatedir)/run -REMOVE_includedir = $(REMOVE_dir)/include -REMOVE_oldincludedir = $(REMOVE_includedir) -REMOVE_docdir = $(REMOVE_datarootdir)/doc -REMOVE_infodir = $(REMOVE_datarootdir)/info -REMOVE_htmldir = $(REMOVE_docdir) -REMOVE_dvidir = $(REMOVE_docdir) -REMOVE_pdfdir = $(REMOVE_docdir) -REMOVE_psdir = $(REMOVE_docdir) -REMOVE_libdir = $(REMOVE_dir)/lib -REMOVE_lispdir = $(REMOVE_datarootdir)/emacs/site-lisp -REMOVE_localedir = $(REMOVE_datarootdir)/locale -REMOVE_mandir = $(REMOVE_datarootdir)/man -REMOVE_man1dir = $(REMOVE_mandir)/man1 -REMOVE_man2dir = $(REMOVE_mandir)/man2 +dir_VARIABLES = prefix \ + exec_prefix \ + base_bindir \ + base_sbindir \ + base_datarootdir \ + base_datadir \ + base_includedir \ + base_libdir \ + modulesdir \ + bindir \ + sbindir \ + libexecdir \ + datarootdir \ + datadir \ + sysconfdir \ + sharedstatedir \ + localstatedir \ + runstatedir \ + includedir \ + oldincludedir \ + docdir \ + infodir \ + htmldir \ + dvidir \ + pdfdir \ + psdir \ + libdir \ + lispdir \ + localedir \ + mandir \ + man1dir \ + man2dir # ----------------------------------------------------------------------------- -TARGET_prefix = $(TARGET_DIR)$(prefix) -TARGET_exec_prefix = $(TARGET_DIR)$(exec_prefix) +TARGET_DIR ?= $(BASE_DIR)/root -TARGET_base_bindir = $(TARGET_DIR)$(base_bindir) -TARGET_base_sbindir = $(TARGET_DIR)$(base_sbindir) -TARGET_base_includedir = $(TARGET_DIR)$(base_includedir) -TARGET_base_libdir = $(TARGET_DIR)$(base_libdir) +# auto-set TARGET_ directories +$(foreach dir,$(dir_VARIABLES),$(eval TARGET_$(dir) = $(TARGET_DIR)$($(dir)))) -TARGET_modulesdir = $(TARGET_base_libdir)/modules/$(KERNEL_VER) +# ----------------------------------------------------------------------------- + +REMOVE_DIR = /.remove -TARGET_bindir = $(TARGET_DIR)$(bindir) -TARGET_sbindir = $(TARGET_DIR)$(sbindir) -TARGET_libdir = $(TARGET_DIR)$(libdir) -TARGET_datadir = $(TARGET_DIR)$(datadir) -TARGET_sysconfdir = $(TARGET_DIR)$(sysconfdir) -TARGET_includedir = $(TARGET_DIR)$(includedir) -TARGET_localstatedir = $(TARGET_DIR)$(localstatedir) +# auto-set REMOVE_ directories +$(foreach dir,$(dir_VARIABLES),$(eval REMOVE_$(dir) = $(REMOVE_DIR)$($(dir)))) # ----------------------------------------------------------------------------- diff --git a/make/target-rootfs.mk b/make/target-rootfs.mk index 656f1121..13fbdf61 100644 --- a/make/target-rootfs.mk +++ b/make/target-rootfs.mk @@ -105,7 +105,7 @@ $(ROOTFS): | $(TARGET_DIR) # cleanup root filesystem from useless stuff rootfs-cleanup: $(ROOTFS) - rm -rf $(ROOTFS)$(REMOVE_dir) + rm -rf $(ROOTFS)$(REMOVE_DIR) rm -rf $(ROOTFS)$(base_includedir) rm -rf $(ROOTFS)$(includedir) rm -rf $(ROOTFS)$(libdir)/pkgconfig