Let the Makefile decide which include to use for .pde files
Previously, the C preprocessor would pick either Arduino.h or WProgram.h based on a define. Now, the Makefile makes the decision earlier. This prevents having to duplicate the #if line in the next commit.
This commit is contained in:
parent
1329730dfe
commit
97fa5ae161
1 changed files with 14 additions and 3 deletions
|
@ -686,6 +686,19 @@ ifndef MONITOR_CMD
|
||||||
MONITOR_CMD = screen
|
MONITOR_CMD = screen
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# Include file to use for old .pde files
|
||||||
|
#
|
||||||
|
ifndef PDE_INCLUDE
|
||||||
|
# We should check for Arduino version, if the file is .pde because a
|
||||||
|
# .pde file might be used in Arduino 1.0
|
||||||
|
ifeq ($(shell expr $(ARDUINO_VERSION) '<' 100), 1)
|
||||||
|
PDE_INCLUDE=WProgram.h
|
||||||
|
else
|
||||||
|
PDE_INCLUDE=Arduino.h
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Rules for making stuff
|
# Rules for making stuff
|
||||||
#
|
#
|
||||||
|
@ -845,11 +858,9 @@ $(OBJDIR)/%.d: %.S $(COMMON_DEPS)
|
||||||
$(OBJDIR)/%.d: %.s $(COMMON_DEPS)
|
$(OBJDIR)/%.d: %.s $(COMMON_DEPS)
|
||||||
$(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o)
|
$(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o)
|
||||||
|
|
||||||
#backward compatibility for .pde files
|
|
||||||
# We should check for Arduino version, if the file is .pde because a .pde file might be used in Arduino 1.0
|
|
||||||
# the pde -> cpp -> o file
|
# the pde -> cpp -> o file
|
||||||
$(OBJDIR)/%.cpp: %.pde $(COMMON_DEPS)
|
$(OBJDIR)/%.cpp: %.pde $(COMMON_DEPS)
|
||||||
$(ECHO) '#if ARDUINO >= 100\n #include "Arduino.h"\n#else\n #include "WProgram.h"\n#endif\n#line 1' > $@
|
$(ECHO) '#include "$(PDE_INCLUDE)"\n#line 1' > $@
|
||||||
$(CAT) $< >> $@
|
$(CAT) $< >> $@
|
||||||
|
|
||||||
# the ino -> cpp -> o file
|
# the ino -> cpp -> o file
|
||||||
|
|
Loading…
Reference in a new issue