# MEMMODEL = -mmemory-model=medium -misr20
#MEMMODEL = -mmemory-model=medium
-#APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2
+APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2
#APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2 -DWITH_BTSTACK
#APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2 -DCC256x_TRANSP
-APPCONFIG = -DDIGITAL -DMW_DIGITAL_V2
+#APPCONFIG = -DDIGITAL -DMW_DIGITAL_V2
# List all the source files here
# eg if you have a source file foo.c then list it here
#INCLUDES = $(BT_SMALLTOOTH_INV)
INCLUDES = -I../ui/
+# BUILDNO = \"\#$(shell cat .buildno)-$(shell date +%y%m%d)\"
+BUILDNO = \"$(shell date +%y%m%d)-\#$(shell cat .buildno)\"
+
# Add or subtract whatever MSPGCC flags you want. There are plenty more
#######################################################################################
-CFLAGS = -mmcu=$(MCU) $(MEMMODEL) -g -Os -Wall -Wunused $(INCLUDES) $(APPCONFIG)
+CFLAGS = -mmcu=$(MCU) $(MEMMODEL) -g -Os -Wall -Wunused $(INCLUDES) $(APPCONFIG) -DBUILDNO=$(BUILDNO)
ASFLAGS = -mmcu=$(MCU) $(MEMMODEL) -x assembler-with-cpp -Wa,-gstabs
LDFLAGS = -mmcu=$(MCU) $(MEMMODEL) -Wl,-gc-sections -Wl,-Map=$(TARGET).map
########################################################################################
# all the object files
OBJECTS = $(SOURCES:.c=.o)
-all: $(TARGET).elf $(TARGET).hex $(TARGET).txt
+all: .buildno $(TARGET).elf $(TARGET).hex $(TARGET).txt
prog: $(TARGET).hex
mspdebug tilib -d /dev/ttyACM3 -v 2500 "prog $(TARGET).hex"
-$(RM) $(TARGET).*
-$(RM) $(SOURCES:.c=.lst)
-$(RM) $(DEPEND)
+
+.buildno: $(OBJECTS)
+ @if ! test -f .buildno; then echo 0 > .buildno; fi
+ @echo $$(($$(cat .buildno) + 1)) > .buildno