servicepoint-binding-c/example/target.mk
Vinzenz Schroeter 5a6d595b4d
All checks were successful
Rust / build-gnu-apt (pull_request) Successful in 5m16s
Rust / build-size-gnu-unstable (pull_request) Successful in 1m11s
per-config build output using VPATH
based on https://make.mad-scientist.net/papers/multi-architecture-builds/
2025-05-28 14:57:01 +02:00

39 lines
1.2 KiB
Makefile

# Based on https://make.mad-scientist.net/papers/multi-architecture-builds/
.SUFFIXES:
OBJDIR := _out_$(RUST_TARGET)-$(_link_type)-$(_profile)
# Define the rules to build in the target subdirectories.
#
MAKETARGET = $(MAKE) --no-print-directory -C $@ -f $(CURDIR)/Makefile \
SRCDIR=$(CURDIR) $(MAKECMDGOALS)
.PHONY: $(OBJDIR)
$(OBJDIR):
+@[ -d "$@" ] || mkdir -p "$@"
+@$(MAKETARGET)
# These rules keep make from trying to use the match-anything rule below to
# rebuild the makefiles--ouch! Obviously, if you don't follow my convention
# of using a `.mk' suffix on all non-standard makefiles you'll need to change
# the pattern rule.
#
Makefile : ;
%.mk :: ;
# Anything we don't know how to build will use this rule. The command is a
# do-nothing command, but the prerequisites ensure that the appropriate
# recursive invocations of make will occur.
#
% :: $(OBJDIR) ;
# The clean rule is best handled from the source directory: since we're
# rigorous about keeping the target directories containing only target files
# and the source directory containing only source files, `clean' is as trivial
# as removing the target directories!
#
.PHONY: clean
clean:
rm -rf $(OBJDIR)