]> cloudbase.mooo.com Git - avrcpm.git/blobdiff - avr/Makefile
SVN --> GIT
[avrcpm.git] / avr / Makefile
index 7c0328fee51dc981597773b2c3a53e240afc7a0f..a91a77237bd7569eb498346822c2eb5b707374d3 100644 (file)
@@ -6,42 +6,59 @@
 #Defining options here will override the defaults from the config file.
 
 #MCU = atmega88
-MCU = atmega328P
+MCU = atmega328p
 #F_CPU = 20000000
 #DRAM_8BIT = 0
 #BAUD = 57600
 #BAUD = 115200
-#I2C = 0
+#I2C_SUPPORT = 0
 #EM_Z80        = 0
 #FAT16_SUPPORT = 0
+#CPMDSK_SUPPORT = 0
 #MMCBOOTLOADER = 0
 
 
-# Version defined in 'config.inc'.
-VMAJOR = $(call conf-val, VMAJOR, config.inc)
-VMINOR = $(call conf-val, VMINOR, config.inc)
-
-
 TARGET = avrcpm
-ASRC0  = avrcpm.asm 
+ASRC0  = avrcpm.asm
 
-ASRC0 += config.inc macros.inc init.asm dram-refresh.asm timer.asm utils.asm 
+ASRC0 += config.inc macros.inc init.asm dram-refresh.asm timer.asm utils.asm
 ASRC0 += mmc.asm mmc-old.asm virt_ports.asm
-ASRC0 += dsk_cpm.asm dsk_fat16.asm dsk_fsys.asm dsk_mgr.asm dsk_ram.asm 
+ASRC0 += dsk_cpm.asm dsk_fat16.asm dsk_fsys.asm dsk_mgr.asm dsk_ram.asm
 ASRC0 += 8080int-orig.asm 8080int.asm 8080int-jmp.asm 8080int-t3.asm 8080int-t3-jmp.asm Z80int-jmp.asm
 
+EXTRA_DIST := autorevision.cache
+
+PREFIX = $(PROG)_$(VERSION)
+DIST_NAME = $(PREFIX).zip
+
+$(foreach X,$(subst =,:=,$(subst ",,$(filter VCS_%,\
+       $(shell autorevision -q -t sh -o ./autorevision.cache)))),$(eval $X))
+
+VERSION := $(shell echo "$(VCS_TAG)" | sed -e 's/^v//g')
+VMAJOR  := $(shell echo "$(VCS_TAG)" | sed -E 's/([^0-9]*)([0-9]+)([.])([0-9]+)([^0-9]*)/\2/')
+VMINOR  := $(shell echo "$(VCS_TAG)" | sed -E 's/([^0-9]*)([0-9]+)([.])([0-9]+)([^0-9]*)/\4/')
+
+
+ifneq ($(VCS_TICK),0)
+  VERSION := $(VERSION)-$(VCS_TICK)
+endif
+ifneq ($(VCS_BRANCH),master)
+  VERSION := $(VERSION)-$(VCS_BRANCH)
+endif
+ifeq ($(VCS_WC_MODIFIED),1)
+  VERSION := $(VERSION)-dirty
+endif
+
 ifneq ($(DRAM_8BIT),0)
   ASRC0 += dram-8bit.inc dram-8bit.asm sw-uart.asm i2c.asm
 else
-  ASRC0 += dram-4bit.inc dram-4bit.asm hw-uart.asm 
+  ASRC0 += dram-4bit.inc dram-4bit.asm hw-uart.asm
 endif
 
-ASRC = $(ASRC0) svnrev.inc
-#ASRC := $(ASRC0) svnrev.inc
+ASRC = $(ASRC0)
 
 # Place -D or -U options here
-CDEFS = -D$(MCU) 
-
+CDEFS = -D$(MCU) -DVERSION=\"$(VERSION)\" -DVMAJOR=$(VMAJOR) -DVMINOR=$(VMINOR)
 ifdef F_CPU
   CDEFS += -DF_CPU=$(F_CPU)
 endif
@@ -51,8 +68,8 @@ endif
 ifdef BAUD
   CDEFS += -DBAUD=$(BAUD)
 endif
-ifdef I2C
-  CDEFS += -DI2C=$(I2C)
+ifdef I2C_SUPPORT
+  CDEFS += -DI2C_SUPPORT=$(I2C_SUPPORT)
 endif
 ifdef EM_Z80
   CDEFS += -DEM_Z80=$(EM_Z80)
@@ -60,6 +77,9 @@ endif
 ifdef FAT16_SUPPORT
   CDEFS += -DFAT16_SUPPORT=$(FAT16_SUPPORT)
 endif
+ifdef CPMDSK_SUPPORT
+  CDEFS += -DCPMDSK_SUPPORT=$(CPMDSK_SUPPORT)
+endif
 ifdef MMCBOOTLOADER
   CDEFS += -DMMCBOOTLOADER=$(MMCBOOTLOADER)
 endif
@@ -67,8 +87,8 @@ ifdef TESTVERSION
   CDEFS += -DTESTVERSION=$(TESTVERSION)
 endif
 
-ASPATH = C:/Programme/Atmel/AVR\ Tools/AvrAssembler2
-DEFS = $(ASPATH)/Appnotes
+ASPATH := C:/Programme/Atmel/AVR\ Tools/AvrAssembler2
+DEFS := $(ASPATH)/Appnotes
 
 ifeq "$(OS)" "Windows_NT"
   PLATFORM=win32
@@ -84,16 +104,10 @@ endif
 AS = $(WINE) $(ASPATH)/avrasm2.exe
 ASFLAGS = -I $(DEFS) $(CDEFS)
 
-AWK = gawk
 OBJCOPY = avr-objcopy
 CRCGEN = crcgen
 
-HEXTOBIN = $(OBJCOPY) -I ihex -O binary --gap-fill 0xff 
-
-#(call conf-val,config-id,config-file)
-#conf-val = $(shell awk -vID=$(strip $1) '$$0 ~ "^[ \t]*\#define[ \t]+" ID "[ \t]+" {print $$3}' $2 )
-conf-val = $(shell awk -vID=$(strip $1) '$$1$$2 ~ "\#define"ID {print $$3}' $2)
-
+HEXTOBIN = $(OBJCOPY) -I ihex -O binary --gap-fill 0xff
 
 # Programming support using avrdude. Settings and variables.
 
@@ -103,7 +117,6 @@ AVRDUDE_PORT = usb
 AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
 AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
 
-
 # Uncomment the following if you want avrdude's erase cycle counter.
 # Note that this counter needs to be initialized first using -Yn,
 # see avrdude manual.
@@ -114,7 +127,7 @@ AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
 #AVRDUDE_NO_VERIFY = -V
 
 # Increase verbosity level.  Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> 
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
 # to submit bug reports.
 #AVRDUDE_VERBOSE = -v -v
 
@@ -137,7 +150,7 @@ map: $(TARGET).map
 bin: $(TARGET)-$(VMAJOR).$(VMINOR).bin
 
 
-# Program the device.  
+# Program the device.
 program: $(TARGET).hex $(TARGET).eep
        $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
 
@@ -172,12 +185,7 @@ $(TARGET).map: $(ASRC)
 tags: $(SRC) $(ASRC)
        ctags $(SRC) $(ASRC)
 
-svnrev.inc: $(ASRC0)
-       svnrev -osvnrev.inc $^
-       touch svnrev.inc
-
 # Target: clean project.
 clean:
        $(REMOVE) $(TARGET).hex $(TARGET).eep $(TARGET).obj $(TARGET).map $(TARGET).lst \
                $(TARGET)-$(VMAJOR).$(VMINOR).bin
-