Subversion Repositories HomeAutomation

Rev

Details | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
361 andfri 1
# Target file name (without extension).
2
TARGET = main
554 andfri 3
BIOSTARGET = bios
361 andfri 4
 
559 andfri 5
LIBDIR = ../../avr-lib
6
SRCDIR = src
7
CFGDIR = .
8
BIOSDIR = bios
9
BIOSSRCDIR = $(LIBDIR)/bios
10
BUILDDIR = build
550 andfri 11
 
559 andfri 12
include bios.inc
554 andfri 13
include ../system.inc
361 andfri 14
 
554 andfri 15
APPMAKEFLAGS = 	TARGET=$(TARGET) \
559 andfri 16
				LIBDIR=$(abspath $(LIBDIR)) \
17
				SRCDIR=$(abspath $(SRCDIR)) \
18
				BIOSDIR=$(abspath $(BIOSDIR)) \
19
				CFGDIR=$(abspath $(CFGDIR)) 
361 andfri 20
 
554 andfri 21
BIOSMAKEFLAGS = TARGET=$(BIOSTARGET) \
559 andfri 22
				LIBDIR=$(abspath $(LIBDIR)) \
23
				SRCDIR=$(abspath $(BIOSSRCDIR)) \
24
				CFGDIR=$(abspath $(CFGDIR)) 
554 andfri 25
 
361 andfri 26
# Define programs and commands.
27
SHELL = sh
28
CC = avr-gcc
468 arune 29
AWK = awk
361 andfri 30
OBJCOPY = avr-objcopy
31
OBJDUMP = avr-objdump
32
SIZE = avr-size
33
NM = avr-nm
550 andfri 34
RM = rm -f
361 andfri 35
COPY = cp
550 andfri 36
MKDIR = mkdir
361 andfri 37
 
38
# Define Messages
39
# English
40
MSG_CLEANING = Cleaning project:
550 andfri 41
MSG_CREATEDIR = Creating directory:
361 andfri 42
 
43
 
44
# Default target.
559 andfri 45
all: $(abspath $(BUILDDIR))
46
	@$(MAKE) $(APPMAKEFLAGS) -C $(BUILDDIR) -f $(abspath $(SRCDIR)/Makefile) all
361 andfri 47
 
559 andfri 48
bios: $(abspath $(BIOSDIR))
49
	@$(MAKE) $(BIOSMAKEFLAGS) -C $(BIOSDIR) -f $(abspath $(BIOSSRCDIR)/Makefile) all
554 andfri 50
 
51
installbios: bios
52
	$(UPLOAD) $(ULFLAGS)
53
 
54
upgradebios: bios
559 andfri 55
	$(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -f $(BIOSDIR)/$(BIOSTARGET).hex -r -b
554 andfri 56
 
550 andfri 57
install: $(BUILDDIR)/$(TARGET).hex
58
	$(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -f $< -r
361 andfri 59
 
472 arune 60
reset: 
61
	$(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -r
62
 
63
start: 
64
	$(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -s
65
 
559 andfri 66
$(BUILDDIR)/$(TARGET).hex: $(abspath $(BUILDDIR))
67
	@$(MAKE) $(APPMAKEFLAGS) -C $(BUILDDIR) -f $(abspath $(SRCDIR)/Makefile) $(TARGET).hex
361 andfri 68
 
559 andfri 69
$(abspath $(BUILDDIR) $(BIOSDIR)):
550 andfri 70
	@echo $(MSG_CREATEDIR) $@
71
	@$(MKDIR) -p $@
361 andfri 72
 
73
# Target: clean project.
550 andfri 74
clean:
559 andfri 75
	@$(MAKE) $(APPMAKEFLAGS) -C $(BUILDDIR) -f $(abspath $(SRCDIR)/Makefile) clean
361 andfri 76
 
554 andfri 77
cleanbios:
559 andfri 78
	@$(MAKE) $(BIOSMAKEFLAGS) -C $(BIOSDIR) -f $(abspath $(BIOSSRCDIR)/Makefile) clean
554 andfri 79
 
550 andfri 80
distclean:
361 andfri 81
	@echo $(MSG_CLEANING)
550 andfri 82
	$(RM) -r $(BUILDDIR)
554 andfri 83
	$(RM) -r $(BIOSDIR)
361 andfri 84
 
85
# Listing of phony targets.
554 andfri 86
.PHONY : all bios installbios upgradebios \
87
install reset start \
88
clean cleanbios distclean
361 andfri 89