]> www.infradead.org Git - users/dedekind/aiaiai.git/commitdiff
Compile helper tools if necessary
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Fri, 7 Feb 2014 13:32:32 +0000 (15:32 +0200)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Fri, 7 Feb 2014 15:16:52 +0000 (17:16 +0200)
Some of our tools like 'remap-log' have to be compiled. This is not a problem
when using Aiaiai from a package, because it has the compiled version of the
tool, but this is a problem when using Aiaiai from sources.

Introduce a function which tries to compile the internal tools. This is
supposed to improve user experience with Aiaiai.

Remove the top-level Makefile since it is not really needed after this change.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Makefile [deleted file]
aiaiai-test-patchset
doc/TODO.txt
helpers/Makefile
helpers/aiaiai-checker
helpers/aiaiai-diff-log
helpers/aiaiai-make-kernel
helpers/aiaiai-sh-functions

diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index 00039af..0000000
--- a/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-all:
-       make -C helpers
-
-clean:
-       make -C helpers clean
index 0707019a614be57278305a62c97160293eab9d25..bda85b35bdf9776d682c5856ae63125496998023 100755 (executable)
@@ -341,9 +341,6 @@ kernel_tree="$(readlink -ev -- "$1")"; shift
 defconfigs="$@"
 
 # Make sure external programs we depend on are installed
-msg="You probably did not compile it, run 'make' in the topmost aiaiai source code directory"
-program_required "remap-log" "$msg"
-program_required "aiaiai-locker" "$msg"
 program_required "git" ""
 program_required "make" ""
 program_required "patch" ""
index c5eed3877dd47b1d53fcc5234b7e036bb7215391..e64901c8c7a1673f5fd053a6efc12a590a51ba51 100644 (file)
@@ -35,8 +35,6 @@ implementing them.
     order to make it easier for people to start hacking Aiaiai.
   * Describe how the e-mail front-end distinguish patches and collects
     patch-sets.
-  * Teach the scripts to compile 'remap-log' if it is not compiled,
-    instead of just failing. This is probably more user-friendly.
   * Describe some review policy, e.g., how many days I promise to wait
     for review/reply before applying patches.
 
index 4a06f739c125d779dc7be2148f17af219cba2de8..7fd75673489bcfcc1b2d2b37ca0e43ff8d820a13 100644 (file)
@@ -1,5 +1,9 @@
-all:
+all: remap-log aiaiai-locker
+
+remap-log:
        $(CC) $(CFLAGS) -o remap-log remap-log.c
+
+aiaiai-locker:
        $(CC) $(CFLAGS) -o aiaiai-locker aiaiai-locker.c
 
 clean:
index 048767023ef11e1019aa21416e2387ea7762b3fe..21d52ef536c1459824b2c0d2ec88a2b7a805e71a 100755 (executable)
@@ -143,8 +143,8 @@ while true; do
        shift
 done
 
-program_required "aiaiai-locker" \
-                "You probably did not compile it, run 'make' in the topmost aiaiai source code directory"
+compile_helpers "$srcdir"
+program_required "aiaiai-locker" ""
 
 tmpdir="$(mktemp -dt "$PROG.XXXX")"
 file_to_check="$(get_file_to_check "$@")"
index e053edc357f099788167589af0c9a60910f5d0ba..c7a572aafc5fcf72e4ed88339ac07b8484ec99fd 100755 (executable)
@@ -167,8 +167,9 @@ done
 
 [ "$#" = 3 ] || die "Insufficient or too many arguments"
 
-program_required "remap-log" \
-                "You probably did not compile it, run 'make' in the topmost aiaiai source code directory"
+
+compile_helpers "$srcdir"
+program_required "remap-log" ""
 
 patch="$(readlink -ev -- "$1")"; shift
 input_log1="$(readlink -ev -- "$1")"; shift
index 71536296614a8e42a260be457bc32d608ea7e2ce..4db126bf09ad83e1e5b62e86dd0cdb0664dba9c0 100755 (executable)
@@ -230,8 +230,9 @@ done
 
 [ "$#" -ge 2 ] || die "Insufficient arguments"
 
-program_required "aiaiai-locker" \
-                "You probably did not compile it, run 'make' in the topmost aiaiai source code directory"
+compile_helpers "$srcdir"
+
+program_required "aiaiai-locker" ""
 program_required "${cross}gcc" ""
 program_required "make" ""
 
index abbd0f4524e256fce51b37fcbdaeca6c1d55fb64..b32e4571e6b8aefc197f632b87919af109ad5c47 100644 (file)
@@ -57,6 +57,30 @@ program_required()
        fi
 }
 
+# Some tools in the "helpers" subdirectory have to be compiled before they can
+# be sued. When Aiaiai is used from the source tree (as opposed to being
+# installed from an RPM package), the user may froget to compile the tools.
+# This function tries to compile them.
+#
+# Usage: compile_helpers <srcdir>
+#
+# where <srcdir> is the directory where the helper tools are supposed to live.
+compile_helpers()
+{
+       local srcdir="$1"
+       local tools="remap-log aiaiai-locker"
+
+       for tool in $tools; do
+               if command -v "$tool" >/dev/null 2>&1; then
+                       continue
+               fi
+
+               if [ -f "$srcdir/${tool}.c" ]; then
+                       make -C "$srcdir" "$tool" >/dev/null 2>&1 ||:
+               fi
+       done
+}
+
 # Fetch the first occurrence of an mbox header from a file
 # Usage: fetch_header <header_name> < <mbox_file>
 fetch_header()