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.
This commit is contained in:
parent
5cfbf18d5f
commit
b2e8240268
@ -196,9 +196,9 @@ ifneq (,$(findstring mingw,$(COMPILER_TARGET)))
|
|||||||
PROG := $(PROG).exe
|
PROG := $(PROG).exe
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: $(PROG)
|
all: $(BUILD)/$(PROG)
|
||||||
|
|
||||||
$(PROG): $(OBJ)
|
$(BUILD)/$(PROG): $(OBJ)
|
||||||
$(ECHO) "LINK $@"
|
$(ECHO) "LINK $@"
|
||||||
# Do not pass COPT here - it's *C* compiler optimizations. For example,
|
# 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.
|
# we may want to compile using Thumb, but link with non-Thumb libc.
|
||||||
@ -210,8 +210,8 @@ endif
|
|||||||
|
|
||||||
clean: clean-prog
|
clean: clean-prog
|
||||||
clean-prog:
|
clean-prog:
|
||||||
$(RM) -f $(PROG)
|
$(RM) -f $(BUILD)/$(PROG)
|
||||||
$(RM) -f $(PROG).map
|
$(RM) -f $(BUILD)/$(PROG).map
|
||||||
|
|
||||||
.PHONY: clean-prog
|
.PHONY: clean-prog
|
||||||
endif
|
endif
|
||||||
@ -231,8 +231,8 @@ LIBMICROPYTHON = libmicropython.a
|
|||||||
# with 3rd-party projects which don't have proper dependency
|
# with 3rd-party projects which don't have proper dependency
|
||||||
# tracking. Then LIBMICROPYTHON_EXTRA_CMD can e.g. touch some
|
# tracking. Then LIBMICROPYTHON_EXTRA_CMD can e.g. touch some
|
||||||
# other file to cause needed effect, e.g. relinking with new lib.
|
# other file to cause needed effect, e.g. relinking with new lib.
|
||||||
lib $(LIBMICROPYTHON): $(OBJ)
|
lib $(BUILD)/$(LIBMICROPYTHON): $(OBJ)
|
||||||
$(Q)$(AR) rcs $(LIBMICROPYTHON) $^
|
$(Q)$(AR) rcs $(BUILD)/$(LIBMICROPYTHON) $^
|
||||||
$(LIBMICROPYTHON_EXTRA_CMD)
|
$(LIBMICROPYTHON_EXTRA_CMD)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
Loading…
Reference in New Issue
Block a user