Makefile (957B)
1 .POSIX: 2 3 SCCMAKE = $$PWD/scc-make 4 5 all: deps 6 7 scc-make: 8 $(CC) -o $@ src/cmd/scc-make/*.c 9 10 deps: scc-make 11 +@$(SCCMAKE) dep 12 touch $@;\ 13 14 all dep tests install uninstall: scc-make check_config FORCE 15 +@$(SCCMAKE) -f main.mk $@ 16 17 check_config: scc-make FORCE 18 @if ! test -f config.mk;\ 19 then\ 20 $(SCCMAKE) config;\ 21 fi 22 23 config: scc-make FORCE 24 @if ! command -v qbe > /dev/null;\ 25 then \ 26 echo "qbe code generator is required to use scc" >&2;\ 27 exit 1;\ 28 fi 29 mkdir -p bin 30 ./scripts/config 31 @$(SCCMAKE) -f main.mk config 32 33 config-musl: scc-make FORCE 34 $(SCCMAKE) LIBPROFILE=musl config 35 gcc -v 2>&1 |\ 36 sed -En '/COLLECT_LTO_WRAPPER=/ s/.*=(.*)\/lto-wrapper/\1/p' |\ 37 (read -r path; \ 38 printf "g/define GCCLIBPATH/ s@.*@#define GCCLIBPATH \"$$path/\"@\nw\n") |\ 39 ed -s include/bits/scc/sys.h 40 41 clean: FORCE 42 touch config.mk 43 $(MAKE) -f main.mk clean 44 45 distclean: clean FORCE 46 touch config.mk 47 $(MAKE) -f main.mk distclean 48 rm -f config.mk deps scc-make 49 50 FORCE: