summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2014-09-09 12:01:50 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2014-12-04 09:20:14 +0100
commitacc86b01b4d5bc533fe4a77f39ab7d8f9b939280 (patch)
tree40c273b122c6e273e610f484ad94efca78e4c756
parent86b0e02da27331697064ecaa150b1acae90b53fc (diff)
downloadOSELAS.Toolchain-acc86b01b4d5bc533fe4a77f39ab7d8f9b939280.tar.gz
OSELAS.Toolchain-acc86b01b4d5bc533fe4a77f39ab7d8f9b939280.tar.xz
move stripping and image creation into ptxdist rules
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--Kconfig3
-rwxr-xr-xbuild_all_v2.mk75
-rwxr-xr-xbuild_one.sh4
-rw-r--r--rules/image-toolchain-deb.in3
-rw-r--r--rules/image-toolchain-deb.make42
-rw-r--r--rules/image-toolchain-tgz.in3
-rw-r--r--rules/image-toolchain-tgz.make36
-rw-r--r--rules/post/cleanup.make16
8 files changed, 110 insertions, 72 deletions
diff --git a/Kconfig b/Kconfig
index bfed17a..3c6baaf 100644
--- a/Kconfig
+++ b/Kconfig
@@ -143,4 +143,7 @@ config TOOLCHAIN_DEBUG
endmenu
+source "workspace/rules/image-toolchain-tgz.in"
+source "workspace/rules/image-toolchain-deb.in"
+
source "rules/ptxdist-version.in"
diff --git a/build_all_v2.mk b/build_all_v2.mk
index e62d72d..cf0bee9 100755
--- a/build_all_v2.mk
+++ b/build_all_v2.mk
@@ -16,25 +16,8 @@ export PTX_AUTOBUILD_DESTDIR
BENICE := true
-BUILDDATE := $(shell date +%y%m%d-%H%M)
-
-VERSION := $(shell ./scripts/setlocalversion ./.tarball-version)
-
-ARCH := $(shell \
- case "$$(uname -m)" in \
- (x86_64) echo amd64;; \
- (i[1-9]86) echo i386;; \
- (ppc) echo powerpc;; \
- (*) ;; \
- esac \
-)
-
-ifeq ($(ARCH),)
-$(error failed to detect arch, or arch is unsupported)
-endif
-
PTXDIST := ./p --force
-ARG := go
+ARG := images
export PTXDIST_ENV_WHITELIST := CROSS_GDB_WITHOUT_PYTHON
export CROSS_GDB_WITHOUT_PYTHON := y
@@ -48,68 +31,24 @@ CONFIGFILES := $(wildcard $(CONFIGDIR)/*.ptxconfig) $(wildcard $(CONFIGDIR)/*/*.
CONFIGS := $(notdir $(basename $(CONFIGFILES)))
CONFIGS_ := $(subst _,-,$(CONFIGS))
-define gen_2config
-$(eval 2CONFIG_$(subst _,-,$(1)) := $(1))
-endef
-
define gen_2configfile
$(eval 2CONFIGFILE_$(subst _,-,$(notdir $(basename $(1)))) := $(1))
endef
-
-define gen_2instdir
-$(eval 2INSTDIR_$(subst _,-,$(notdir $(basename $(1)))) := \
- $(shell PTX_AUTOBUILD_DESTDIR='' source "$(1)" && echo "$${PTXCONF_SYSROOT_CROSS}"))
-endef
-
-
-$(foreach cfg,$(CONFIGS),$(call gen_2config,$(cfg)))
$(foreach cfgfile,$(CONFIGFILES),$(call gen_2configfile,$(cfgfile)))
-$(foreach cfgfile,$(CONFIGFILES),$(call gen_2instdir,$(cfgfile)))
STATEDIR := gstate
DISTDIR := dist
-PREFIX := $(DISTDIR)/oselas.toolchain-$(VERSION)-
-CONFIGS_PREFIX := $(foreach config,$(CONFIGS_),$(addprefix $(PREFIX),$(config)))
-
-DEB_PREFIX := $(PREFIX)
-DEB_SUFFIX := _$(VERSION)_$(ARCH).deb
-
-TBZ2_PREFIX := $(PREFIX)
-TBZ2_SUFFIX := _$(ARCH).tar.xz
-
-DEBS := $(foreach config,$(CONFIGS_PREFIX),$(addsuffix $(DEB_SUFFIX),$(config)))
-TBZ2S := $(foreach config,$(CONFIGS_PREFIX),$(addsuffix $(TBZ2_SUFFIX),$(config)))
+BUILDS := $(foreach config,$(CONFIGS_),$(addprefix $(STATEDIR)/,$(addsuffix .build,$(config))))
OLDCONFIGS := $(foreach config,$(CONFIGS_),$(addsuffix .oldconfig,$(config)))
-all: $(TBZ2S) $(DEBS)
-
-$(DEB_PREFIX)%$(DEB_SUFFIX): $(STATEDIR)/%.strip | mkdirs
- @scripts/make_deb.sh -d "$(@)" -s "$(PTX_AUTOBUILD_DESTDIR)/$(2INSTDIR_$(*))"
-
-$(TBZ2_PREFIX)%$(TBZ2_SUFFIX): $(STATEDIR)/%.strip | mkdirs
- @echo Creating $(notdir $@) ...
- @echo 'tar -C "$(PTX_AUTOBUILD_DESTDIR)/opt" --exclude=gcc-first -cJf "$(@)" "$(patsubst /opt/%,%,$(2INSTDIR_$(*)))"' | fakeroot
+all: $(BUILDS)
$(foreach config,$(CONFIGS_),$(eval $(STATEDIR)/$(config).build: $(2CONFIGFILE_$(config))))
$(STATEDIR)/%.build: | mkdirs
@echo "building ${*}"
$(NICE) $(PTXDIST) $(ARG) --ptxconfig=$(2CONFIGFILE_$(*))
- @if [ "$(strip $(filter go,$(ARG)))" = "go" ]; then touch "$@"; fi
-
-$(STATEDIR)/%.strip: $(STATEDIR)/%.build
- @find "`source "$(2CONFIGFILE_$(*))" && echo "$${PTXCONF_SYSROOT_CROSS}"`" -depth -type d -print0 | xargs -r -0 -- rmdir --ignore-fail-on-non-empty --
- find \
- "`source "$(2CONFIGFILE_$(*))" && echo "$${PTXCONF_SYSROOT_CROSS}"`/libexec/" \
- "`source "$(2CONFIGFILE_$(*))" && echo "$${PTXCONF_SYSROOT_CROSS}"`/bin/" \
- "`source "$(2CONFIGFILE_$(*))" && echo "$${PTXCONF_SYSROOT_CROSS}"`/"*/bin/ \
- -type f \( -executable -o -name "*.so*" \) \
- | xargs strip || true
- @touch "$@"
-
-
-$(STATEDIR)/%.pkgs: $(DEB_PREFIX)%$(DEB_SUFFIX) $(TBZ2_PREFIX)%$(TBZ2_SUFFIX) | mkdirs
- @:
+ @if [ "$(strip $(filter images,$(ARG)))" = "images" ]; then touch "$@"; fi
oldconfig: $(OLDCONFIGS)
@@ -123,7 +62,5 @@ print-%:
@echo "$* is \"$($(*))\""
help:
- @echo "Available DPKG targets:"
- @for i in $(DEBS); do echo $$i; done;
- @echo "Available tarball targets:"
- @for i in $(TBZ2S); do echo $$i; done;
+ @echo "Available build targets:"
+ @for i in $(sort $(BUILDS)); do echo $$i; done;
diff --git a/build_one.sh b/build_one.sh
index c92e96f..332c964 100755
--- a/build_one.sh
+++ b/build_one.sh
@@ -19,11 +19,9 @@ fi
target="$(basename "${config}")"
target="${target%.ptxconfig}"
+target="gstate/${target//_/-}.build"
if [ $# -gt 0 ]; then
- target="gstate/${target//_/-}.build"
exec "$(dirname $0)/build_all_v2.mk" "${target}" ARG="${*}"
else
- target="gstate/${target//_/-}.pkgs"
exec "$(dirname $0)/build_all_v2.mk" "${target}"
fi
-
diff --git a/rules/image-toolchain-deb.in b/rules/image-toolchain-deb.in
new file mode 100644
index 0000000..27bf883
--- /dev/null
+++ b/rules/image-toolchain-deb.in
@@ -0,0 +1,3 @@
+config IMAGE_TOOLCHAIN_DEB
+ bool
+ default y
diff --git a/rules/image-toolchain-deb.make b/rules/image-toolchain-deb.make
new file mode 100644
index 0000000..aae6146
--- /dev/null
+++ b/rules/image-toolchain-deb.make
@@ -0,0 +1,42 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2014 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+IMAGE_PACKAGES-$(PTXCONF_IMAGE_TOOLCHAIN_DEB) += image-toolchain-deb
+
+#
+# Paths and names
+#
+IMAGE_TOOLCHAIN_DEB_VERSION := $(shell ./scripts/setlocalversion ./.tarball-version)
+IMAGE_TOOLCHAIN_DEB_ARCH := $(shell uname -m)
+ifeq ($(IMAGE_TOOLCHAIN_DEB_ARCH),x86_64)
+IMAGE_TOOLCHAIN_DEB_ARCH := amd64
+endif
+ifeq ($(patsubst i%86,,$(IMAGE_TOOLCHAIN_DEB_ARCH)),)
+IMAGE_TOOLCHAIN_DEB_ARCH := i386
+endif
+ifeq ($(IMAGE_TOOLCHAIN_DEB_ARCH),ppc)
+IMAGE_TOOLCHAIN_DEB_ARCH := powerpc
+endif
+IMAGE_TOOLCHAIN_DEB_IMAGE := $(PTXDIST_WORKSPACE)/dist/oselas.toolchain-$(IMAGE_TOOLCHAIN_DEB_VERSION)-$(subst _,-,$(PTXCONF_PLATFORM))_$(IMAGE_TOOLCHAIN_DEB_VERSION)_$(IMAGE_TOOLCHAIN_DEB_ARCH).deb
+
+# ----------------------------------------------------------------------------
+# Image
+# ----------------------------------------------------------------------------
+
+$(IMAGE_TOOLCHAIN_DEB_IMAGE): $(STATEDIR)/world.cleanup
+ @$(call targetinfo)
+ @mkdir -p $(dir $@)
+ @scripts/make_deb.sh -d "$(@)" -s "$(PTXCONF_SYSROOT_CROSS)"
+ @$(call finish)
+
+# vim: syntax=make
diff --git a/rules/image-toolchain-tgz.in b/rules/image-toolchain-tgz.in
new file mode 100644
index 0000000..3790f86
--- /dev/null
+++ b/rules/image-toolchain-tgz.in
@@ -0,0 +1,3 @@
+config IMAGE_TOOLCHAIN_TGZ
+ bool
+ default y
diff --git a/rules/image-toolchain-tgz.make b/rules/image-toolchain-tgz.make
new file mode 100644
index 0000000..a80c808
--- /dev/null
+++ b/rules/image-toolchain-tgz.make
@@ -0,0 +1,36 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2014 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+IMAGE_PACKAGES-$(PTXCONF_IMAGE_TOOLCHAIN_TGZ) += image-toolchain-tgz
+
+#
+# Paths and names
+#
+IMAGE_TOOLCHAIN_TGZ_VERSION := $(shell ./scripts/setlocalversion ./.tarball-version)
+IMAGE_TOOLCHAIN_TGZ_IMAGE := $(PTXDIST_WORKSPACE)/dist/oselas.toolchain-$(IMAGE_TOOLCHAIN_TGZ_VERSION)-$(subst _,-,$(PTXCONF_PLATFORM)).tar.xz
+
+# ----------------------------------------------------------------------------
+# Image
+# ----------------------------------------------------------------------------
+
+$(IMAGE_TOOLCHAIN_TGZ_IMAGE): $(STATEDIR)/world.cleanup
+ @$(call targetinfo)
+ @mkdir -p $(dir $@)
+ @echo 'tar -C "$(PTX_AUTOBUILD_DESTDIR)$(PTXCONF_PREFIX)" \
+ --exclude=gcc-first \
+ -cJf "$(@)" \
+ "${PTXCONF_PROJECT}/$(PTXCONF_GNU_TARGET)/$(PTXCONF_PREFIX_TCID)"' \
+ | fakeroot
+ @$(call finish)
+
+# vim: syntax=make
diff --git a/rules/post/cleanup.make b/rules/post/cleanup.make
new file mode 100644
index 0000000..55abf33
--- /dev/null
+++ b/rules/post/cleanup.make
@@ -0,0 +1,16 @@
+
+$(STATEDIR)/world.cleanup: $(STATEDIR)/world.targetinstall
+ @$(call targetinfo)
+ @find "$(PTXCONF_SYSROOT_CROSS)" -depth -type d -print0 | \
+ xargs -r -0 -- rmdir -v --ignore-fail-on-non-empty --
+ find \
+ "$(PTXCONF_SYSROOT_CROSS)/libexec/" \
+ "$(PTXCONF_SYSROOT_CROSS)/bin/" \
+ "$(PTXCONF_SYSROOT_CROSS)/"*/bin/ \
+ -type f \( -executable -o -name "*.so*" \) \
+ | xargs -n1 --verbose strip || true
+ @$(call touch)
+
+world: $(STATEDIR)/world.cleanup
+
+# vim: syntax=make