aboutsummaryrefslogtreecommitdiff
path: root/arduino-mk/Arduino.mk
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2013-05-30 13:29:25 +0200
committerMatthijs Kooijman <matthijs@stdin.nl>2013-05-30 19:27:11 +0200
commit97fa5ae161e3aae3fb5f503effc8b8cb0ee65935 (patch)
treeeaba164a644e1cc5ef3075eebfbc8d7d097797c6 /arduino-mk/Arduino.mk
parent1329730dfef14bccf163457d1371abb201d76bf4 (diff)
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.
Diffstat (limited to 'arduino-mk/Arduino.mk')
-rw-r--r--arduino-mk/Arduino.mk17
1 files changed, 14 insertions, 3 deletions
diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk
index 2fb5b10..f2ec06e 100644
--- a/arduino-mk/Arduino.mk
+++ b/arduino-mk/Arduino.mk
@@ -687,6 +687,19 @@ ifndef MONITOR_CMD
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
#
@@ -845,11 +858,9 @@ $(OBJDIR)/%.d: %.S $(COMMON_DEPS)
$(OBJDIR)/%.d: %.s $(COMMON_DEPS)
$(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
$(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) $< >> $@
# the ino -> cpp -> o file