[PATCH] Print the available targets for sbase-box

From: sin <sin_AT_2f30.org>
Date: Thu, 15 Aug 2013 16:46:46 +0100

---
 Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 010391c..3c613b0 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -149,13 +149,16 @@ sbase-box: $(SRC) util.a
 	_AT_cp $(HDR) build
 	_AT_for f in $(SRC); do sed "s/^main(/`basename $$f .c`_&/" < $$f > build/$$f; done
 	_AT_echo '#include <libgen.h>'  > build/$@.c
+	_AT_echo '#include <stdio.h>'  >> build/$@.c
 	_AT_echo '#include <stdlib.h>' >> build/$@.c
 	_AT_echo '#include <string.h>' >> build/$@.c
 	_AT_echo '#include "util.h"'   >> build/$@.c
 	_AT_for f in $(SRC); do echo "int `basename $$f .c`_main(int, char **);" >> build/$@.c; done
 	_AT_echo 'int main(int argc, char *argv[]) { char *s = basename(argv[0]); if(0) ;' >> build/$@.c
 	_AT_for f in $(SRC); do echo "else if(!strcmp(s, \"`basename $$f .c`\")) `basename $$f .c`_main(argc, argv);" >> build/$@.c; done
-	_AT_printf 'else eprintf("%%s: unknown program\\n", s); return EXIT_SUCCESS; }\n' >> build/$@.c
+	_AT_echo 'else {' >> build/$@.c
+	_AT_for f in $(SRC); do echo "printf(\"`basename $$f .c`\"); putchar(' ');" >> build/$@.c; done
+	_AT_echo "putchar(0xa); }; return EXIT_SUCCESS; }" >> build/$@.c
 	_AT_echo LD $@
 	_AT_$(LD) -o $@ build/*.c util.a $(CFLAGS) $(LDFLAGS)
 	_AT_rm -r build
-- 
1.8.2.3
--YiEDa0DAkWCtVeE4--
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 16 2013 - 20:12:02 CEST