Makefile (934B)
1 TARGET:=linux-glibc-amd64 2 3 BIN:=linkd 4 5 .PHONY: default 6 default: build/${TARGET}/${BIN} 7 8 FIND:=$(shell command -v gfind find) 9 10 WATCH?= 11 WATCH+=$(shell $(FIND) src -type f -name '*.c') 12 WATCH+=$(shell $(FIND) src -type f -name '*.h') 13 14 build/${TARGET}/${BIN}: build/${TARGET} $(WATCH) 15 cd build/${TARGET} && dep install 16 $(MAKE) --directory build/${TARGET} TARGET=${TARGET} 17 18 build/${TARGET}: $(WATCH) 19 mkdir -p build/${TARGET} 20 cp -rT src/ build/${TARGET}/src 21 cp -rT target/common/ build/${TARGET} 22 cp -rT target/${TARGET}/ build/${TARGET} 23 24 .PHONY: targets 25 targets: 26 @ls -1 target | grep -v '^common$$' 27 28 .PHONY: clean 29 clean: 30 rm -rf build 31 32 # Never let the catch-all try to rebuild the makefiles themselves 33 Makefile: ; 34 35 # Forward any other goal verbatim into the assembled target tree 36 .PHONY: FORCE 37 FORCE: 38 %: build/${TARGET} FORCE 39 cd build/${TARGET} && dep install 40 $(MAKE) --directory build/${TARGET} TARGET=${TARGET} $@