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 Messages
27
# English
28
MSG_CLEANING = Cleaning project:
550 andfri 29
MSG_CREATEDIR = Creating directory:
361 andfri 30
 
31
 
32
# Default target.
1719 arune 33
all: check_systeminc $(abspath $(BUILDDIR))
559 andfri 34
	@$(MAKE) $(APPMAKEFLAGS) -C $(BUILDDIR) -f $(abspath $(SRCDIR)/Makefile) all
361 andfri 35
 
1719 arune 36
bios: check_systeminc $(abspath $(BIOSDIR))
559 andfri 37
	@$(MAKE) $(BIOSMAKEFLAGS) -C $(BIOSDIR) -f $(abspath $(BIOSSRCDIR)/Makefile) all
554 andfri 38
 
39
installbios: bios
40
	$(UPLOAD) $(ULFLAGS)
41
 
42
upgradebios: bios
772 arune 43
	$(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -i $(NODE_HW_ID) -f $(BIOSDIR)/$(BIOSTARGET).hex -r -b
554 andfri 44
 
1719 arune 45
defaultbios: bios
46
	$(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -i $(NODE_HW_ID) -f $(BIOSDIR)/$(BIOSTARGET).hex -r -d
47
 
550 andfri 48
install: $(BUILDDIR)/$(TARGET).hex
772 arune 49
	$(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -i $(NODE_HW_ID) -f $< -r
361 andfri 50
 
472 arune 51
reset: 
772 arune 52
	$(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -i $(NODE_HW_ID) -r
472 arune 53
 
54
start: 
772 arune 55
	$(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -i $(NODE_HW_ID) -s
472 arune 56
 
1719 arune 57
$(BUILDDIR)/$(TARGET).hex: check_systeminc $(abspath $(BUILDDIR))
559 andfri 58
	@$(MAKE) $(APPMAKEFLAGS) -C $(BUILDDIR) -f $(abspath $(SRCDIR)/Makefile) $(TARGET).hex
361 andfri 59
 
1719 arune 60
$(abspath $(BUILDDIR) $(BIOSDIR)): check_systeminc
890 arune 61
	@$(ECHO) $(MSG_CREATEDIR) $@
550 andfri 62
	@$(MKDIR) -p $@
361 andfri 63
 
64
# Target: clean project.
1719 arune 65
clean: check_systeminc
559 andfri 66
	@$(MAKE) $(APPMAKEFLAGS) -C $(BUILDDIR) -f $(abspath $(SRCDIR)/Makefile) clean
361 andfri 67
 
1719 arune 68
cleanbios: check_systeminc
559 andfri 69
	@$(MAKE) $(BIOSMAKEFLAGS) -C $(BIOSDIR) -f $(abspath $(BIOSSRCDIR)/Makefile) clean
554 andfri 70
 
1719 arune 71
distclean: check_systeminc
890 arune 72
	@$(ECHO) $(MSG_CLEANING)
550 andfri 73
	$(RM) -r $(BUILDDIR)
554 andfri 74
	$(RM) -r $(BIOSDIR)
361 andfri 75
 
1719 arune 76
setconfig: check_systeminc
77
	@$(SETCONF) $(CANULFLAGS)
903 arune 78
 
1867 arune 79
installnoappl:
80
	@$(ECHO) ":02000000FFFF00" > tmpfil
1888 arune 81
	@$(ECHO) ":00000001FF" >> tmpfil
1867 arune 82
	$(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -i $(NODE_HW_ID) -f tmpfil -r
83
	@$(RM) tmpfile
84
 
1719 arune 85
check_systeminc:
86
ifndef SETCONF
891 arune 87
	@echo 
1719 arune 88
	@echo ERROR! This is because your system.inc is out of date
89
	@echo Please update system.inc.template from SVN and then diff with your system.inc and add the appropriate settings
891 arune 90
	@echo 
91
	@false
92
endif
93
 
361 andfri 94
# Listing of phony targets.
1719 arune 95
.PHONY : all bios installbios upgradebios defaultbios \
554 andfri 96
install reset start \
1867 arune 97
clean cleanbios distclean check_systeminc setconfig installnoappl
361 andfri 98