Makefile (2465B)
1 .PHONY: all clean 2 3 ALL_TARGETS:= out/s6-rc.fileset out/postinstall.fileset out/postinstall.rsfilter out/etc/fstab 4 CURRENT:=/run/current 5 AWK:=awk 6 SED:=sed 7 #FILESET_BIN_DIR:=$(dir $(realpath $(shell which fileset.awk))) 8 AAT_BIN_DIR:=$(realpath $(dir $(realpath $(shell which aat.awk)))) 9 #DATA_AWK:=/current/bzr/aat/data.awk 10 DATA_AWK:=$(realpath $(AAT_BIN_DIR)/..)/data.awk 11 all: $(ALL_TARGETS) 12 13 clean: 14 rm -rf build $(ALL_TARGETS) out 15 16 build/%.awk: %.aat common.aat 17 mkdir -p build 18 $(AWK) -f $(AAT_BIN_DIR)/aat.awk '$<' >'$@.new' 19 $(SED) -f $(AAT_BIN_DIR)/aat_macros.sed -i '$@.new' 20 mv '$@.new' '$@' 21 22 %.qawk: %.awk $(DATA_AWK) version_path.awk 23 cat $(DATA_AWK) version_path.awk >'$@.new' 24 $(AWK) -f $(AAT_BIN_DIR)/query.awk '$<' >>'$@.new' 25 mv '$@.new' '$@' 26 27 %.rsfilter: %.fileset 28 RSFILTER='$@.new' fileset '$<' >/dev/null 29 mv '$@.new' '$@' 30 31 build/s6-rc-mount.awk: s6-rc-mount.aat parse_fs.include.awk rc-common.aat 32 build/s6-rc.awk: s6-rc.aat parse_fs.include.awk rc-common.aat rc-builder.include.awk 33 build/fstab.awk: fstab.aat parse_fs.include.awk rc-common.aat 34 35 out/s6-rc.fileset: build/s6-rc.qawk build/s6-rc-mount.awk fs build/config 36 mkdir -p out 37 rm -f ./build/execfile 38 $(AWK) -v sort_tmpfile=./build/s6-rc-mount.awk.tmp_sort -v execfile=./build/execfile -f version_path.awk -f build/s6-rc-mount.awk fs >'$@.new' 39 $(AWK) -v sort_tmpfile=./build/s6-rc.qawk.tmp_sort -v execfile=./build/execfile -f build/s6-rc.qawk build/config >>'$@.new' 40 if test -d out/s6-rc-source; then rm -r out/s6-rc-source; fi 41 mkdir ./out/s6-rc-source 42 fsapply ./out/s6-rc-source "$$PWD/"'$@.new' 43 mv '$@.new' '$@' 44 45 out/etc/fstab: build/fstab.awk fs 46 mkdir -p out/etc 47 $(AWK) -f build/fstab.awk fs >'$@.new' 48 mv '$@.new' '$@' 49 50 build/config: build/config.awk 51 $(AWK) -f '$<' </dev/null >'$@.new' 52 mv '$@.new' '$@' 53 54 .PHONY: build/postinstall.gen.fileset 55 build/postinstall.gen.fileset: 56 mkdir -p build 57 (cd config && find etc -type d) >build/config.dirs 58 (cd config && find etc -type f) >build/config.files 59 printf '%s\n' >>build/config.files \ 60 etc/fstab 61 sed <build/config.dirs >'$@.new' -Ee \ 62 's|.*|/&\t+\td|' 63 sed <build/config.files >>'$@.new' -Ee \ 64 's|.*|/&\t+\tlf!\t$(CURRENT)/config/&|' 65 rm build/config.dirs build/config.files 66 mv '$@.new' '$@' 67 68 out/postinstall.fileset: build/config build/postinstall.qawk build/postinstall.gen.fileset 69 mkdir -p out 70 $(AWK) -f build/postinstall.qawk build/config >'$@.new' 71 cat build/postinstall.gen.fileset >>'$@.new' 72 mv '$@.new' '$@'