changeset 384:7ef814efbebe

loadtools: make install logic refactored in light of compalstage addition
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Tue, 10 Jun 2014 08:49:55 +0000
parents 326363ba5bf4
children 1cb7b2b6ce18
files loadtools/Makefile loadtools/install-helpers.sh
diffstat 2 files changed, 27 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/loadtools/Makefile	Tue Jun 10 07:37:29 2014 +0000
+++ b/loadtools/Makefile	Tue Jun 10 08:49:55 2014 +0000
@@ -1,11 +1,7 @@
 CC=	gcc
 CFLAGS=	-O2
 PROGS=	fc-iram fc-loadtool fc-xram
-LASRC=	../target-utils/loadagent
-SCRIPTS=scripts/gta02.config scripts/k5a3281.init scripts/pirelli.config \
-	scripts/pirelli.init loadtool.help
 INSTBIN=/usr/local/bin
-INSTSCR=/usr/local/share/freecalypso
 
 EXTRA_OBJ=	compalload.o
 
@@ -33,35 +29,10 @@
 fc-xram:	${XRAM_OBJS}
 	${CC} ${CFLAGS} -o $@ ${XRAM_OBJS}
 
-# The loadagent.srec image needs to be installed in the "system" directory
-# where fc-loadtool and fc-xram will find it.  However, we have a dilemma:
-# loadagent is built in the ../target-utils tree with the target cross-gcc,
-# but the logical place to install it is here.  The following hack is our
-# workaround.
-#
-# It is also conceivable that after the FreeCalypso project matures,
-# some people will want to flash images built by others, without setting up
-# their own cross-gcc environments for the ARM7TDMI target.  However,
-# the loadtools subpackage is something that every user will need to build
-# from source on his/her "loading" machine.  The planned solution is to
-# package a "release" of fc-loadtools which will be the present source
-# directory with a prebuilt loadagent.srec included.
-
-loadagent.srec:
-	@if [ -r ${LASRC}/loadagent.srec ]; then \
-		true; \
-	else \
-		echo "Error: I need to install loadagent.srec in ${INSTSCR},"; \
-		echo "but I cannot find it: neither in . nor in ${LASRC}"; \
-		false; \
-	fi
-	ln -s ${LASRC}/loadagent.srec .
-
-install:	${PROGS} ${SCRIPTS} loadagent.srec
+install:
 	mkdir -p ${INSTBIN}
 	install -c ${PROGS} ${INSTBIN}
-	mkdir -p ${INSTSCR}
-	install -c loadagent.srec ${SCRIPTS} ${INSTSCR}
+	./install-helpers.sh
 
 clean:
 	rm -f *.o *.out *errs ${PROGS}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loadtools/install-helpers.sh	Tue Jun 10 08:49:55 2014 +0000
@@ -0,0 +1,25 @@
+#!/bin/sh
+# A functional installation of FreeCalypso loadtools consists of not only
+# the fc-* host binaries, but also the loadagent and compalstage target
+# binaries and some script and help files.  This shell script is
+# responsible for installing the latter.
+
+instdir=/usr/local/share/freecalypso
+set -ex
+mkdir -p $instdir
+
+# The target-binaries directory may or may not be present.  Loadagent and
+# compalstage are built in the target-utils tree with the ARM7 toolchain,
+# hence having prebuilt binaries would be an important convenience for
+# end user releases.  But if one is working with just a source tree, with
+# nothing prebuilt, there will be no target-binaries directory here;
+# one needs to have the ARM7 toolchain installed, then build target-utils,
+# then do a 'make install' there.
+
+if [ -d target-binaries ]
+then
+	install -c target-binaries/* $instdir
+fi
+
+# scripts and loadtool.help should always be present
+install -c scripts/* loadtool.help $instdir