Makefile (2488B)
1 CC = cc -static 2 CFLAGS = -std=c99 -Wall -Wextra -pedantic 3 4 # ninqu has to exist before any ninqu.rules build (box, dev, ...) can 5 # start, so it compiles with BOOTSTRAP_CC. plain $(CC) could resolve to 6 # an installed aruu cc that cant yet build the tool it is needed for. 7 # defaults to $(CC), override it alone to pick a bootstrap compiler 8 BOOTSTRAP_CC ?= $(CC) 9 10 BACKEND ?= auto 11 12 CPPFLAGS ?= -Ishared -D_POSIX_C_SOURCE=200809L \ 13 -DFEATURE_NOFORK=0 -DFEATURE_NOEXEC=0 14 15 NINQU_LIB_SRC =\ 16 shared/libutil/ealloc.c\ 17 shared/libutil/eprintf.c\ 18 shared/libutil/strlcpy.c\ 19 shared/libutil/strlcat.c\ 20 shared/libutil/estrlcpy.c\ 21 shared/libutil/estrlcat.c\ 22 shared/libutil/strtonum.c\ 23 shared/libutil/fshut.c\ 24 shared/libutil/mkdirp.c\ 25 shared/libutil/recurse_dir.c\ 26 shared/libutil/wexec.c 27 28 NINQU_SRC =\ 29 cmd/dev/ninqu/main.c\ 30 cmd/dev/ninqu/strlist.c\ 31 cmd/dev/ninqu/kv.c\ 32 cmd/dev/ninqu/sexpr.c\ 33 cmd/dev/ninqu/gate.c\ 34 cmd/dev/ninqu/registry.c\ 35 cmd/dev/ninqu/fs.c\ 36 cmd/dev/ninqu/exec.c\ 37 cmd/dev/ninqu/backend.c\ 38 cmd/dev/ninqu/parse.c\ 39 cmd/dev/ninqu/expand.c\ 40 cmd/dev/ninqu/schedule.c\ 41 cmd/dev/ninqu/query.c\ 42 cmd/dev/ninqu/resolve.c\ 43 cmd/dev/ninqu/ninja.c 44 45 NINQU ?= cmd/dev/ninqu/ninqu 46 # no $(filter -j%,$(MAKEFLAGS)) trick here, pass the parallelism 47 # directly: make JOBS=-j8 box 48 JOBS ?= 49 50 # every goal ninqu.rules exposes, since there is no %: FORCE catch-all 51 # here. a new top-level group needs a name added too 52 .PHONY: all default clean box dev man install install-base uninstall \ 53 remove fmt fmt-all lib posix linux net xsi pseudo extra codegen test 54 55 $(NINQU): $(NINQU_SRC) cmd/dev/ninqu/ninqu.h scripts/mk/config.set scripts/mk/features.h shared/libutil/nofork_list.h $(NINQU_LIB_SRC) 56 $(BOOTSTRAP_CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(NINQU_SRC) $(NINQU_LIB_SRC) 57 58 scripts/mk/config.set: build.cfg scripts/genconfig.sh 59 sh scripts/genconfig.sh config-set 60 61 scripts/mk/features.h: build.cfg scripts/genconfig.sh 62 sh scripts/genconfig.sh features-h 63 64 shared/libutil/nofork_list.h: build.cfg scripts/genconfig.sh 65 sh scripts/genconfig.sh nofork-list-h 66 67 all default box dev man install install-base uninstall remove \ 68 fmt fmt-all lib posix linux net xsi pseudo extra codegen test: $(NINQU) 69 $(NINQU) $(JOBS) $@ 70 71 clean: $(NINQU) 72 $(NINQU) clean 73 rm -f $(NINQU) build.ninja