From ad5172e99520e2fe2a35b4bbd7fbc74d9df36df1 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Sat, 17 Feb 2018 09:35:16 +1000 Subject: [PATCH] Add explicit support for single-file delivery Signed-off-by: Steve Bennett --- Makefile | 22 ++++++++++++++++------ README.markdown | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 251029e..f4638e2 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,23 @@ CFLAGS += -Wall -W -Os -g -Wno-unused-parameter -CC := gcc +CC ?= gcc all: linenoise_example linenoise_utf8_example -linenoise_example: linenoise.h linenoise.c stringbuf.c stringbuf.h linenoise-win32.c example.c - $(CC) $(CFLAGS) -o $@ linenoise.c example.c stringbuf.c +linenoise_example: linenoise.h linenoise-ship.c linenoise-win32.c example.c + $(CC) $(CFLAGS) -o $@ linenoise-ship.c example.c -linenoise_utf8_example: linenoise.h linenoise.c stringbuf.c stringbuf.h utf8.c linenoise-win32.c - $(CC) $(CFLAGS) -DUSE_UTF8 -o $@ linenoise.c utf8.c example.c stringbuf.c +linenoise_utf8_example: linenoise.h linenoise-ship.c linenoise-win32.c + $(CC) $(CFLAGS) -DUSE_UTF8 -o $@ linenoise-ship.c example.c clean: - rm -f linenoise_example linenoise_utf8_example *.o + rm -f linenoise_example linenoise_utf8_example linenoise-ship.c *.o + +ship: linenoise-ship.c + +# linenoise-ship.c simplifies delivery of linenoise support +# simple copy linenoise-ship.c to linenoise.c in your application, and also linenoise.h +# - If you want win32 support, also copy linenoise-win32.c +# - If you never want to support utf-8, you can omit utf8.h and utf8.c + +linenoise-ship.c: stringbuf.h stringbuf.c utf8.h utf8.c linenoise.c + cat $^ >$@ diff --git a/README.markdown b/README.markdown index cf7e10e..70cba8b 100644 --- a/README.markdown +++ b/README.markdown @@ -8,6 +8,25 @@ - no hints yet - now with multiline +## How do I include linenoise line editing support in my application? + +From the Makefile: + + linenoise-ship.c simplifies delivery of linenoise support + + simple copy linenoise-ship.c to linenoise.c in your application, and also linenoise.h + + * If you want win32 support, also copy linenoise-win32.c + * If you never want to support utf-8, you can omit utf8.h and utf8.c + +To enable utf-8 support, define USE_UTF8 + +## Where do I get it? + +Get it here: [https://github.com/msteveb/linenoise](https://github.com/msteveb/linenoise) + +-------------------------------------------------------- + ## Original README below Can a line editing library be 20k lines of code? -- 2.44.0