Allow libraries/sketches to have the same name as system libs,

e.g. main or Wire

Doesn't seem to work with main.cpp but main.ino works.

Fixes issue #229 and #244
This commit is contained in:
Simon John 2014-08-21 06:35:21 +02:00
parent 846636b139
commit aa879d8db8
3 changed files with 7 additions and 9 deletions

View file

@ -874,9 +874,9 @@ USER_LIB_AS_SRCS = $(wildcard $(patsubst %,%/*.S,$(USER_LIBS)))
LIB_OBJS = $(patsubst $(ARDUINO_LIB_PATH)/%.c,$(OBJDIR)/libs/%.o,$(LIB_C_SRCS)) \
$(patsubst $(ARDUINO_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(LIB_CPP_SRCS)) \
$(patsubst $(ARDUINO_LIB_PATH)/%.S,$(OBJDIR)/libs/%.o,$(LIB_AS_SRCS))
USER_LIB_OBJS = $(patsubst $(USER_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(USER_LIB_CPP_SRCS)) \
$(patsubst $(USER_LIB_PATH)/%.c,$(OBJDIR)/libs/%.o,$(USER_LIB_C_SRCS)) \
$(patsubst $(USER_LIB_PATH)/%.S,$(OBJDIR)/libs/%.o,$(USER_LIB_AS_SRCS))
USER_LIB_OBJS = $(patsubst $(USER_LIB_PATH)/%.cpp,$(OBJDIR)/userlibs/%.o,$(USER_LIB_CPP_SRCS)) \
$(patsubst $(USER_LIB_PATH)/%.c,$(OBJDIR)/userlibs/%.o,$(USER_LIB_C_SRCS)) \
$(patsubst $(USER_LIB_PATH)/%.S,$(OBJDIR)/userlibs/%.o,$(USER_LIB_AS_SRCS))
# Dependency files
DEPS = $(LOCAL_OBJS:.o=.d) $(LIB_OBJS:.o=.d) $(USER_LIB_OBJS:.o=.d) $(CORE_OBJS:.o=.d)
@ -1034,15 +1034,15 @@ $(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.S
@$(MKDIR) $(dir $@)
$(CC) -MMD -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
$(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.cpp
$(OBJDIR)/userlibs/%.o: $(USER_LIB_PATH)/%.cpp
@$(MKDIR) $(dir $@)
$(CC) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
$(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.c
$(OBJDIR)/userlibs/%.o: $(USER_LIB_PATH)/%.c
@$(MKDIR) $(dir $@)
$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
$(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.S
$(OBJDIR)/userlibs/%.o: $(USER_LIB_PATH)/%.S
@$(MKDIR) $(dir $@)
$(CC) -MMD -c $(CPPFLAGS) $(ASFLAGS) $< -o $@

View file

@ -9,7 +9,6 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
- Fix: Change "tinyladi" username to "ladislas" in HISTORY.md. (https://github.com/ladislas)
- Add: Add information about `Bare-ArduinoProject` in README. (https://github.com/ladislas)
- Fix: Make avr-g++ use CXXFLAGS instead of CFLAGS. (https://github.com/sej7278)
- Add: Add information about overriding system libs (Issue #229). (https://github.com/sej7278)
- Add: Add information about reporting bugs to the correct project (Issue #231). (https://github.com/sej7278)
- Fix: Allow the use of CFLAGS_STD and CXXFLAGS_STD and set defaults (Issue #234) (https://github.com/ladislas)
- Tweak: Remove $(EXTRA_XXX) variables (Issue #234) (https://github.com/ladislas)
@ -17,6 +16,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
- Tweak: Update Malefile-example.mk with STD flags (https://github.com/ladislas)
- Add: Allow "make clean" target to be extended (Issue #239). (https://github.com/sej7278)
- Fix: Update "make show_boards" regex to work with the Due in 1.5. (https://github.com/sej7278)
- Fix: Allow user libaries/sketches to have the same name as system libs. (Issue #244, #229). (https://github.com/sej7278)
### 1.3.4 (2014-07-12)
- Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav)

View file

@ -307,8 +307,6 @@ Directory where additional libraries are stored.
Defaults to `libraries` directory within user's sketchbook.
Note that you cannot have user libraries with the same name as the system Arduino libs.
**Example:**
```Makefile