>From 87b92ed72f2427b9ed9c634b79f7b9070d429189 Mon Sep 17 00:00:00 2001 From: sin <s...@2f30.org> Date: Thu, 15 Aug 2013 16:46:46 +0100 Subject: [PATCH] Print the available targets for sbase-box
--- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 010391c..3c613b0 100644 --- a/Makefile +++ b/Makefile @@ -149,13 +149,16 @@ sbase-box: $(SRC) util.a @cp $(HDR) build @for f in $(SRC); do sed "s/^main(/`basename $$f .c`_&/" < $$f > build/$$f; done @echo '#include <libgen.h>' > build/$@.c + @echo '#include <stdio.h>' >> build/$@.c @echo '#include <stdlib.h>' >> build/$@.c @echo '#include <string.h>' >> build/$@.c @echo '#include "util.h"' >> build/$@.c @for f in $(SRC); do echo "int `basename $$f .c`_main(int, char **);" >> build/$@.c; done @echo 'int main(int argc, char *argv[]) { char *s = basename(argv[0]); if(0) ;' >> build/$@.c @for f in $(SRC); do echo "else if(!strcmp(s, \"`basename $$f .c`\")) `basename $$f .c`_main(argc, argv);" >> build/$@.c; done - @printf 'else eprintf("%%s: unknown program\\n", s); return EXIT_SUCCESS; }\n' >> build/$@.c + @echo 'else {' >> build/$@.c + @for f in $(SRC); do echo "printf(\"`basename $$f .c`\"); putchar(' ');" >> build/$@.c; done + @echo "putchar(0xa); }; return EXIT_SUCCESS; }" >> build/$@.c @echo LD $@ @$(LD) -o $@ build/*.c util.a $(CFLAGS) $(LDFLAGS) @rm -r build -- 1.8.2.3