diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-10-24 02:26:10 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-10-24 15:46:53 +0300 |
commit | 0dbd928ceefed09d65276211c70d0137b4734011 (patch) | |
tree | 27ae07b46c07da5185d3023b2e788bb102915f54 /py | |
parent | 9a334d41e3c20dfde053cd95b9f80c384c51c2a9 (diff) | |
download | micropython-0dbd928ceefed09d65276211c70d0137b4734011.tar.gz micropython-0dbd928ceefed09d65276211c70d0137b4734011.zip |
Makefiles: Remove duplicate object files when linking.
Scenario: module1 depends on some common file from lib/, so specifies it
in its SRC_MOD, and the same situation with module2, then common file
from lib/ eventually ends up listed twice in $(OBJ), which leads to link
errors.
Make is equipped to deal with such situation easily, quoting the manual:
"The value of $^ omits duplicate prerequisites, while $+ retains them and
preserves their order." So, just use $^ consistently in all link targets.
Diffstat (limited to 'py')
-rw-r--r-- | py/mkrules.mk | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/py/mkrules.mk b/py/mkrules.mk index 18bfd98471..26afdf227c 100644 --- a/py/mkrules.mk +++ b/py/mkrules.mk @@ -81,14 +81,14 @@ all: $(PROG) $(PROG): $(OBJ) $(ECHO) "LINK $@" - $(Q)$(CC) $(COPT) -o $@ $(OBJ) $(LIB) $(LDFLAGS) + $(Q)$(CC) $(COPT) -o $@ $^ $(LIB) $(LDFLAGS) ifndef DEBUG $(Q)$(STRIP) $(STRIPFLAGS_EXTRA) $(PROG) endif $(Q)$(SIZE) $(PROG) lib: $(OBJ) - $(AR) rcs libmicropython.a $(OBJ) + $(AR) rcs libmicropython.a $^ clean: clean-prog clean-prog: |