summaryrefslogtreecommitdiffstats
path: root/external
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2015-05-22 13:52:59 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-06-01 17:15:56 +1000
commitce48d7efe84848e5ac49600477d029f5202ce5f2 (patch)
treea78f1057a314fbdaf7c848da99078afeeea07c97 /external
parentd531b2660a7f66131eec337b6b72c554007f178c (diff)
downloadtalos-skiboot-ce48d7efe84848e5ac49600477d029f5202ce5f2.tar.gz
talos-skiboot-ce48d7efe84848e5ac49600477d029f5202ce5f2.zip
pflash: Create make dist target for pflash release tarballs
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@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external')
-rw-r--r--external/pflash/Makefile46
-rw-r--r--external/pflash/Makefile.dist8
-rw-r--r--external/pflash/rules.mk38
3 files changed, 57 insertions, 35 deletions
diff --git a/external/pflash/Makefile b/external/pflash/Makefile
index 73f5ed64..179b6d48 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 00000000..017fd906
--- /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 00000000..0c396a25
--- /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 $@
+
OpenPOWER on IntegriCloud