Add resource.
[bertos.git] / rules.mk
index 3bd0228a4e45abb3f359956b2248e5f95139e9ac..8095a1bc696e61be7022919d3a66450015a4ad30 100755 (executable)
--- a/rules.mk
+++ b/rules.mk
 # Author: Bernardo Innocenti <bernie@develer.com>
 #
 # $Log$
+# Revision 1.6  2006/09/13 18:38:59  bernie
+# Sort CPP options to let apps override include paths.
+#
+# Revision 1.5  2006/09/13 18:30:52  bernie
+# Add CPPFLAGS to all rules.
+#
+# Revision 1.4  2006/07/19 12:56:24  bernie
+# Convert to new Doxygen style.
+#
+# Revision 1.3  2006/05/27 22:42:24  bernie
+# Search for verstag.h in app subdirs first.
+#
 # Revision 1.2  2006/03/27 04:48:33  bernie
 # Add CXXFLAGS; Add recursive targets.
 #
@@ -138,25 +150,25 @@ OBJ         += $$($(1)_OBJ)
 $$($(1)_COBJ) : $$(OBJDIR)/$(1)/%.o : %.c
        $L "$(1): Compiling $$< (C)"
        @$$(MKDIR_P) $$(dir $$@)
-       $Q $$(CC) -c $$(CFLAGS) $$($(1)_CFLAGS) $$< -o $$@
+       $Q $$(CC) -c $$(CFLAGS) $$($(1)_CFLAGS) $$($(1)_CPPFLAGS) $$(CPPFLAGS) $$< -o $$@
 
 # Compile: instructions to create assembler and/or object files from C++ source
 $$($(1)_CXXOBJ) : $$(OBJDIR)/$(1)/%.o : %.cpp
        $L "$(1): Compiling $$< (C++)"
        @$$(MKDIR_P) $$(dir $$@)
-       $Q $$(CXX) -c $$(CXXFLAGS) $$($(1)_CXXFLAGS) $$< -o $$@
+       $Q $$(CXX) -c $$(CXXFLAGS) $$($(1)_CXXFLAGS) $$($(1)_CPPFLAGS) $$(CPPFLAGS) $$< -o $$@
 
 # Generate assembly sources from C files (debug)
 $$(OBJDIR)/$(1)/%.s : %.c
        $L "$(1): Generating asm source $$<"
        @$$(MKDIR_P) $$(dir $$@)
-       $Q $$(CC) -S $$(CFLAGS) $$($(1)_CFLAGS) $$< -o $$@
+       $Q $$(CC) -S $$(CFLAGS) $$($(1)_CFLAGS) $$($(1)_CPPFLAGS) $$< -o $$@
 
 # Generate special progmem variant of a source file
 $$($(1)_PCOBJ) : $$(OBJDIR)/$(1)/%_P.o : %.c
        $L "$(1): Compiling $$< (PROGMEM)"
        @$$(MKDIR_P) $$(dir $$@)
-       $Q $$(CC) -c -D_PROGMEM $$(CFLAGS) $$($(1)_CFLAGS) $$< -o $$@
+       $Q $$(CC) -c -D_PROGMEM $$(CFLAGS) $$($(1)_CFLAGS) $$($(1)_CPPFLAGS) $$(CPPFLAGS) $$< -o $$@
 
 # Assemble: instructions to create object file from assembler files
 $$($(1)_AOBJ): $$(OBJDIR)/$(1)/%.o : %.s
@@ -167,7 +179,7 @@ $$($(1)_AOBJ): $$(OBJDIR)/$(1)/%.o : %.s
 $$($(1)_CPPAOBJ): $$(OBJDIR)/$(1)/%.o : %.S
        $L "$(1): Assembling with CPP $$<"
        @$$(MKDIR_P) $$(dir $$@)
-       $Q $$(CC) -c $$(CPPAFLAGS) $$($(1)_CPPAFLAGS) $$< -o $$@
+       $Q $$(CC) -c $$(CPPAFLAGS) $$($(1)_CPPAFLAGS) $$($(1)_CPPFLAGS) $$(CPPFLAGS) $$< -o $$@
 
 # Link: instructions to create elf output file from object files
 $$(OUTDIR)/$(1).elf: bumprev $$($(1)_OBJ) $$($(1)_LDSCRIPT)
@@ -188,6 +200,7 @@ flash_$(1): $(OUTDIR)/$(1).s19 flash_$(1)_local
        if ! $(AVRDUDE) $(DPROG) -p $$($(1)_MCU) -U flash:w:$$< ; then \
             $(AVRDUDE) $(DPROG) -p $$($(1)_MCU) -U flash:w:$$< ; \
        fi
+       #avarice --mkII -j usb --erase --program --verify --file images/triface.elf
 
 .PHONY: flash_$(1)_local
 flash_$(1)_local:
@@ -266,7 +279,7 @@ $(RECURSIVE_TARGETS):
 
 BUILDREV_H = buildrev.h
 
-ifeq ($(shell [ -e verstag.c ] && echo yes), yes)
+ifeq ($(shell [ -e verstag.c ] && echo yes),yes)
 .PHONY: bumprev
 bumprev:
        @buildnr=0; \