aruu

[MIRROR] Actual replacement for Busybox | suckless
git clone https://git.daat.foo/aruu.git
Log | Files | Refs | README | LICENSE

commit d4eae9b32c04fcf4144427666730e37dfe718672
parent 1695915d9c2cbe6f6d33bce91a880998a30cdbdf
Author: xplshn <anto@xplshn.com.ar>
Date:   Tue, 18 Aug 2026 20:39:15 -0300

!

Signed-off-by: xplshn <anto@xplshn.com.ar>

Diffstat:
AGNUmakefile | 92+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MMakefile | 58+++++++++++++++-------------------------------------------
2 files changed, 107 insertions(+), 43 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile @@ -0,0 +1,92 @@ +CC ?= cc -static +CFLAGS ?= -std=c99 -Wall -Wextra -pedantic + +BACKEND ?= auto + +CPPFLAGS ?= -Ishared -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L \ + -DFEATURE_NOFORK=0 -DFEATURE_NOEXEC=0 +# NOEXEC cannot be on the bootstrap compile, but it can +# be on when one compiles aruu-box with ninqu included + +NINQU_LIB_SRC =\ + shared/libutil/ealloc.c\ + shared/libutil/eprintf.c\ + shared/libutil/strlcpy.c\ + shared/libutil/strlcat.c\ + shared/libutil/strtonum.c\ + shared/libutil/fshut.c\ + shared/libutil/mkdirp.c\ + shared/libutil/recurse_dir.c\ + shared/libutil/wexec.c + +NINQU_SRC =\ + cmd/dev/ninqu/main.c\ + cmd/dev/ninqu/strlist.c\ + cmd/dev/ninqu/kv.c\ + cmd/dev/ninqu/sexpr.c\ + cmd/dev/ninqu/gate.c\ + cmd/dev/ninqu/registry.c\ + cmd/dev/ninqu/fs.c\ + cmd/dev/ninqu/exec.c\ + cmd/dev/ninqu/backend.c\ + cmd/dev/ninqu/parse.c\ + cmd/dev/ninqu/expand.c\ + cmd/dev/ninqu/schedule.c\ + cmd/dev/ninqu/query.c\ + cmd/dev/ninqu/resolve.c\ + cmd/dev/ninqu/ninja.c + +# map make's -j to ninqu's -j flag +NINQU ?= cmd/dev/ninqu/ninqu +JOBS ?= $(filter -j%,$(MAKEFLAGS)) + +# rebuilds config.set first so a build.cfg edit is picked up before +# ninqu compiles, ninqu also does this lazily on its own via +# (set-file), this just avoids the extra shell startup on every run +$(NINQU): $(NINQU_SRC) cmd/dev/ninqu/ninqu.h scripts/mk/config.set $(NINQU_LIB_SRC) + $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(NINQU_SRC) $(NINQU_LIB_SRC) + +# FORCE has no rule, thus making any pattern +# that depends on it be always outdated +.PHONY: FORCE +FORCE: + +# ninqu generates build.ninja if ninja/samu is available and execs that +# instead of running its own backend, but you can use make backend=internal +# to force the internal one to be used anyways +%: $(NINQU) FORCE + $(NINQU) $(JOBS) $@ + +clean: $(NINQU) + $(NINQU) clean + rm -f $(NINQU) build.ninja + +scripts/mk/config.set: build.cfg scripts/genconfig.sh + sh scripts/genconfig.sh config + +# stops the % pattern rule above from trying to rebuild these as if +# they were stale build targets: GNU make's own implicit "remake my +# makefiles" check runs the pattern rule against this file's own +# name too, otherwise (and, since a POSIX Makefile can sit right next +# to this one, against that name as well) +GNUmakefile: ; +Makefile: ; +ninqu.rules: ; +cmd/dev/ninqu/ninqu.h: ; +cmd/dev/ninqu/main.c: ; +cmd/dev/ninqu/strlist.c: ; +cmd/dev/ninqu/kv.c: ; +cmd/dev/ninqu/sexpr.c: ; +cmd/dev/ninqu/gate.c: ; +cmd/dev/ninqu/registry.c: ; +cmd/dev/ninqu/fs.c: ; +cmd/dev/ninqu/exec.c: ; +cmd/dev/ninqu/backend.c: ; +cmd/dev/ninqu/parse.c: ; +cmd/dev/ninqu/expand.c: ; +cmd/dev/ninqu/schedule.c: ; +cmd/dev/ninqu/query.c: ; +cmd/dev/ninqu/resolve.c: ; +cmd/dev/ninqu/ninja.c: ; +build.cfg: ; +scripts/genconfig.sh: ; diff --git a/Makefile b/Makefile @@ -1,12 +1,10 @@ -CC ?= cc -static -CFLAGS ?= -std=c99 -Wall -Wextra -pedantic +CC = cc -static +CFLAGS = -std=c99 -Wall -Wextra -pedantic BACKEND ?= auto CPPFLAGS ?= -Ishared -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L \ -DFEATURE_NOFORK=0 -DFEATURE_NOEXEC=0 -# NOEXEC cannot be on the bootstrap compile, but it can -# be on when one compiles aruu-box with ninqu included NINQU_LIB_SRC =\ shared/libutil/ealloc.c\ @@ -36,53 +34,27 @@ NINQU_SRC =\ cmd/dev/ninqu/resolve.c\ cmd/dev/ninqu/ninja.c -# map make's -j to ninqu's -j flag NINQU ?= cmd/dev/ninqu/ninqu -JOBS ?= $(filter -j%,$(MAKEFLAGS)) +# no $(filter -j%,$(MAKEFLAGS)) equivalent here (GNUmakefile's own +# trick): pass ninqu's own parallelism directly, "make JOBS=-j8 box" +JOBS ?= + +# every real goal ninqu.rules exposes, listed once instead of +# GNUmakefile's own "%: FORCE" catch-all. a new top-level group needs +# a matching name added here too +.PHONY: all default clean box dev man install install-base uninstall \ + remove fmt fmt-all lib posix linux net xsi pseudo extra codegen -# rebuilds config.set first so a build.cfg edit is picked up before -# ninqu compiles, ninqu also does this lazily on its own via -# (set-file), this just avoids the extra shell startup on every run $(NINQU): $(NINQU_SRC) cmd/dev/ninqu/ninqu.h scripts/mk/config.set $(NINQU_LIB_SRC) $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(NINQU_SRC) $(NINQU_LIB_SRC) -# FORCE has no rule, thus making any pattern -# that depends on it be always outdated -.PHONY: FORCE -FORCE: +scripts/mk/config.set: build.cfg scripts/genconfig.sh + sh scripts/genconfig.sh config -# ninqu generates build.ninja if ninja/samu is available and execs that -# instead of running its own backend, but you can use make backend=internal -# to force the internal one to be used anyways -%: $(NINQU) FORCE +all default box dev man install install-base uninstall remove \ +fmt fmt-all lib posix linux net xsi pseudo extra codegen: $(NINQU) $(NINQU) $(JOBS) $@ clean: $(NINQU) $(NINQU) clean rm -f $(NINQU) build.ninja - -scripts/mk/config.set: build.cfg scripts/genconfig.sh - sh scripts/genconfig.sh config - -# stops the % pattern rule above from trying to rebuild these as if -# they were stale build targets -Makefile: ; -ninqu.rules: ; -cmd/dev/ninqu/ninqu.h: ; -cmd/dev/ninqu/main.c: ; -cmd/dev/ninqu/strlist.c: ; -cmd/dev/ninqu/kv.c: ; -cmd/dev/ninqu/sexpr.c: ; -cmd/dev/ninqu/gate.c: ; -cmd/dev/ninqu/registry.c: ; -cmd/dev/ninqu/fs.c: ; -cmd/dev/ninqu/exec.c: ; -cmd/dev/ninqu/backend.c: ; -cmd/dev/ninqu/parse.c: ; -cmd/dev/ninqu/expand.c: ; -cmd/dev/ninqu/schedule.c: ; -cmd/dev/ninqu/query.c: ; -cmd/dev/ninqu/resolve.c: ; -cmd/dev/ninqu/ninja.c: ; -build.cfg: ; -scripts/genconfig.sh: ;