diff options
| author | Daniel Jour <d.jour@steiner.de> | 2022-08-02 21:39:02 +0200 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-08-11 13:29:44 +1000 |
| commit | b2e82402688b53829f37475583231b067b9faea7 (patch) | |
| tree | feee79b8890dea9092fd0cb9b685cfcbe640cdeb | |
| parent | 5cfbf18d5fb70a907984781b3ac01aa5c27148be (diff) | |
py/mkrules.mk: Keep all build artefacts inside $(BUILD) directory.
The rules for lib (static library with name $(LIBMICROPYTHON)) and the
default rule to build a binary (name $(PROG)) produced outputs in the
current working directory. Change this to build these files in the build
directory.
Note: An empty BUILD variable can cause issues (references to the root
directory); this is not addressed by this commit due to multiple other
places having the same issue.
| -rw-r--r-- | py/mkrules.mk | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/py/mkrules.mk b/py/mkrules.mk index 41ec4b064..af1167867 100644 --- a/py/mkrules.mk +++ b/py/mkrules.mk @@ -196,9 +196,9 @@ ifneq (,$(findstring mingw,$(COMPILER_TARGET))) PROG := $(PROG).exe endif -all: $(PROG) +all: $(BUILD)/$(PROG) -$(PROG): $(OBJ) +$(BUILD)/$(PROG): $(OBJ) $(ECHO) "LINK $@" # Do not pass COPT here - it's *C* compiler optimizations. For example, # we may want to compile using Thumb, but link with non-Thumb libc. @@ -210,8 +210,8 @@ endif clean: clean-prog clean-prog: - $(RM) -f $(PROG) - $(RM) -f $(PROG).map + $(RM) -f $(BUILD)/$(PROG) + $(RM) -f $(BUILD)/$(PROG).map .PHONY: clean-prog endif @@ -231,8 +231,8 @@ LIBMICROPYTHON = libmicropython.a # with 3rd-party projects which don't have proper dependency # tracking. Then LIBMICROPYTHON_EXTRA_CMD can e.g. touch some # other file to cause needed effect, e.g. relinking with new lib. -lib $(LIBMICROPYTHON): $(OBJ) - $(Q)$(AR) rcs $(LIBMICROPYTHON) $^ +lib $(BUILD)/$(LIBMICROPYTHON): $(OBJ) + $(Q)$(AR) rcs $(BUILD)/$(LIBMICROPYTHON) $^ $(LIBMICROPYTHON_EXTRA_CMD) clean: |
