[Skiboot] [PATCH 4/4] pflash: Create make dist target for pflash release tarballs
Cyril Bur
cyril.bur at au1.ibm.com
Fri May 22 13:52:59 AEST 2015
In order to be able to compile and ship pflash independently to the rest of
skiboot as it is a separate userland tool we're going to need a tarball of all
the required files to build it.
This commit adds a make dist target which copies libflash and ccan alongside
pflash sources and inserts a stripped down Makefile into a tarball.
Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
external/pflash/Makefile | 46 +++++++++++--------------------------------
external/pflash/Makefile.dist | 8 ++++++++
external/pflash/rules.mk | 38 +++++++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 35 deletions(-)
create mode 100644 external/pflash/Makefile.dist
create mode 100644 external/pflash/rules.mk
diff --git a/external/pflash/Makefile b/external/pflash/Makefile
index 73f5ed6..179b6d4 100644
--- a/external/pflash/Makefile
+++ b/external/pflash/Makefile
@@ -1,26 +1,4 @@
-ARCH=$(shell ./get_arch.sh $(CROSS_COMPILE))
-
-ifeq ($(ARCH),ARCH_POWERPC)
-ARCH_OBJS = powerpc_io.o sfc-ctrl.o
-else
-ifeq ($(ARCH),ARCH_ARM)
-ARCH_OBJS = arm_io.o
-else
-$(error Unsupported architecture $(ARCH))
-endif
-endif
-
-CFLAGS = -O2 -Wall -I.
-LDFLAGS = -lrt
-OBJS = pflash.o progress.o ast-sf-ctrl.o version.o
-OBJS += libflash/libflash.o libflash/libffs.o libflash/ecc.o
-OBJS += $(ARCH_OBJS)
-EXE = pflash
-
-CC = $(CROSS_COMPILE)gcc
-
-%.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
+include rules.mk
all: $(EXE)
@@ -32,7 +10,7 @@ links:
ln -sf ../../hw/ast-bmc/ast-sf-ctrl.c
ln -sf ../../make_version.sh
-PFLASH_VERSION ?= $(shell ./make_version.sh $(EXE))
+$(OBJS) : links
.PHONY: VERSION-always
.version: VERSION-always
@@ -40,17 +18,15 @@ PFLASH_VERSION ?= $(shell ./make_version.sh $(EXE))
@cmp -s $@ $@.tmp || cp $@.tmp $@
@rm -f $@.tmp
-version.c: make_version.sh .version
- @(if [ "a$(PFLASH_VERSION)" = "a" ]; then \
- echo "#error You need to set SKIBOOT_VERSION environment variable" > $@ ;\
- else \
- echo "const char version[] = \"$(PFLASH_VERSION)\";" ;\
- fi) > $@
-
-$(OBJS) : links
-
-$(EXE): $(OBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
+.PHONY: dist
+#File is named $(PFLASH_VERSION).tar because the expectation is that pflash-
+#is always at the start of the verion. This remains consistent with skiboot
+#version strings
+dist: links .version
+ find -L ../pflash/ -iname '*.[ch]' -print0 | xargs -0 tar -rhf $(PFLASH_VERSION).tar
+ tar --transform 's/Makefile.dist/Makefile/' -rhf $(PFLASH_VERSION).tar \
+ ../pflash/get_arch.sh ../pflash/Makefile.dist ../pflash/rules.mk \
+ ../pflash/.version ../pflash/make_version.sh
clean:
rm -f $(OBJS) $(EXE) *.o *.d libflash/test/test_flash libflash/test/*.o
diff --git a/external/pflash/Makefile.dist b/external/pflash/Makefile.dist
new file mode 100644
index 0000000..017fd90
--- /dev/null
+++ b/external/pflash/Makefile.dist
@@ -0,0 +1,8 @@
+include rules.mk
+
+all: $(EXE)
+
+clean:
+ rm -f $(OBJS) *.o
+distclean: clean
+ rm -f $(EXE)
diff --git a/external/pflash/rules.mk b/external/pflash/rules.mk
new file mode 100644
index 0000000..0c396a2
--- /dev/null
+++ b/external/pflash/rules.mk
@@ -0,0 +1,38 @@
+ARCH=$(shell ./get_arch.sh $(CROSS_COMPILE))
+
+ifeq ($(ARCH),ARCH_POWERPC)
+ARCH_OBJS = powerpc_io.o sfc-ctrl.o
+else
+ifeq ($(ARCH),ARCH_ARM)
+ARCH_OBJS = arm_io.o
+else
+$(error Unsupported architecture $(ARCH))
+endif
+endif
+
+.DEFAULT_GOAL := all
+
+CFLAGS = -O2 -Wall -I.
+LDFLAGS = -lrt
+OBJS = pflash.o progress.o ast-sf-ctrl.o version.o
+OBJS += libflash/libflash.o libflash/libffs.o libflash/ecc.o
+OBJS += $(ARCH_OBJS)
+EXE = pflash
+
+CC = $(CROSS_COMPILE)gcc
+
+PFLASH_VERSION ?= $(shell ./make_version.sh $(EXE))
+
+version.c: make_version.sh .version
+ @(if [ "a$(PFLASH_VERSION)" = "a" ]; then \
+ echo "#error You need to set SKIBOOT_VERSION environment variable" > $@ ;\
+ else \
+ echo "const char version[] = \"$(PFLASH_VERSION)\";" ;\
+ fi) > $@
+
+%.o : %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+$(EXE): $(OBJS)
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
+
--
1.9.1
More information about the Skiboot
mailing list