diff options
| author | hiddenalpha.ch | 2026-08-29 22:27:37 +0200 |
|---|---|---|
| committer | hiddenalpha.ch | 2026-08-29 22:27:37 +0200 |
| commit | 845e872837e78856fef7b07bd70571d99c7298a6 (patch) | |
| tree | 587defd77c9f99d6d38256c0d0604615d7f7a00d | |
| parent | fc355ee88235a718f2e5f87acaae62ff08589f2f (diff) | |
| download | quotprint-845e872837e78856fef7b07bd70571d99c7298a6.tar.gz quotprint-845e872837e78856fef7b07bd70571d99c7298a6.zip | |
Drop bloat and put everything into one single file
| -rw-r--r-- | README | 0 | ||||
| -rwxr-xr-x | configure | 64 | ||||
| -rw-r--r-- | src/quotprint.c | 46 |
3 files changed, 46 insertions, 64 deletions
diff --git a/configure b/configure deleted file mode 100755 index 645c7b2..0000000 --- a/configure +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env lua - - -do - - function getCFLAGSArr()return{ - "-Wall", "-Werror", "-pedantic", "-std=c99", "-fmax-errors=1", "-ggdb", "-O0", - }end - - function getLDFLAGSAarr()return{ }end - -end - - -function main() - local snk = io.open("Makefile", "wb") - snk:write([=[ - -.SILENT: - -CC=gcc -LD=gcc -MKDIRS=mkdir -p -RIMRAF=rm -rf - -PROJECT_NAME=quotprint -PROJECT_VERSION=$(shell git describe --tags|sed -E 's;^v;;' || date -u +0.0.0-%Y%m%d.%H%M%S) - -CFLAGS=]=])for _, f in ipairs(getCFLAGSArr())do snk:write(" ")snk:write(f)end snk:write([=[ \ - -DPROJECT_NAME=$(PROJECT_NAME) \ - -DPROJECT_VERSION=$(PROJECT_VERSION) \ - -DFLAGS=]=])for _, f in ipairs(getLDFLAGSAarr())do snk:write(" ")snk:write(f)end snk:write("\n"..[=[ - - -.PHONY: default -default: build/bin/quotprint - - -.PHONY: clean -clean: - $(RIMRAF) build/bin/* build/obj/* - - -build/bin/quotprint: -build/bin/quotprint: build/obj/quotprint.o - printf ' LN\t%s\n' '$@' - $(MKDIRS) "$(shell dirname "$@")" - $(LD) -o $@ $^ $(LDFLAGS) - - -build/obj/quotprint.o: -build/obj/quotprint.o: src/quotprint.c - printf ' CC\t%s\n' '$@' - $(MKDIRS) "$(shell dirname "$@")" - $(CC) -c -o $@ $^ $(CFLAGS) - - -]=]) - snk:close() -end - -main() - diff --git a/src/quotprint.c b/src/quotprint.c index 683ea4f..3b649e7 100644 --- a/src/quotprint.c +++ b/src/quotprint.c @@ -1,4 +1,49 @@ +#if 0 +--[===========================================================================[ + + How to build: + + apt install lua5.4 + lua src/quotprint.c `# will create 'quotprint' in your current dir` + How to use: + + ./quotprint --help + + ]===========================================================================] +do + local sh = io.popen("sh", "w") + assert(sh, "Failed to launch a shell") + sh:write([=[set -e \ + \ + && CC="${CC:-gcc}" \ + && LD="${LD:-gcc}" \ + && RIMRAF="${RIMRAF:-rm -rf}" \ + && BINEXT= \ + && CFLAGS="${CFLAGS:- -std=c99 -Wall -Werror -pedantic -O2}" \ + && LDFLAGS="${LDFLAGS:- -s}" \ + && TMPDIR="${TMPDIR:-/tmp}" \ + \ + && if test -z "$PROJECT_VERSION" ;then true \ + && tag="$(git tag|grep -E '^v'|sed -E 's,^v,,'|sort -V|tail -n1)" \ + && cnt="$(git rev-list --count "v${tag:?}"..HEAD)" \ + && hsh="$(git rev-parse --short HEAD)" \ + && if test -n "$tag" -a -n "$cnt" -a -n "$hsh" ;then \ + && PROJECT_VERSION="${tag:?}-${cnt:?}-g${hsh:?}" \ + ;else true \ + && PROJECT_VERSION="$(date -u +0.0.0-%Y%m%d.%H%M%S)" \ + ;fi \ + ;fi \ + \ + && ${CC:?} -c -o "${TMPDIR:?}"/QwTlrZxWlNzEvZGV src/quotprint.c ${CFLAGS?} \ + && ${LD:?} -o ./quotprint"${BINEXT?}" "${TMPDIR:?}"/QwTlrZxWlNzEvZGV ${LDFLAGS?} \ + && ${RIMRAF:?} "${TMPDIR:?}"/QwTlrZxWlNzEvZGV \ +]=]) + local ok, how, code = sh:close() + if not ok then os.exit(code) end +end +--[===========================================================================[ +#endif #include <assert.h> #include <errno.h> @@ -641,3 +686,4 @@ main( int argc, char**argv ){ } } +/*]===========================================================================]--*/ |
