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.
891 arune 33
all: check_binaries $(abspath $(BUILDDIR))
559 andfri 34
	@$(MAKE) $(APPMAKEFLAGS) -C $(BUILDDIR) -f $(abspath $(SRCDIR)/Makefile) all
361 andfri 35
 
891 arune 36
bios: check_binaries $(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
 
550 andfri 45
install: $(BUILDDIR)/$(TARGET).hex
772 arune 46
	$(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -i $(NODE_HW_ID) -f $< -r
361 andfri 47
 
472 arune 48
reset: 
772 arune 49
	$(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -i $(NODE_HW_ID) -r
472 arune 50
 
51
start: 
772 arune 52
	$(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -i $(NODE_HW_ID) -s
472 arune 53
 
891 arune 54
$(BUILDDIR)/$(TARGET).hex: check_binaries $(abspath $(BUILDDIR))
559 andfri 55
	@$(MAKE) $(APPMAKEFLAGS) -C $(BUILDDIR) -f $(abspath $(SRCDIR)/Makefile) $(TARGET).hex
361 andfri 56
 
891 arune 57
$(abspath $(BUILDDIR) $(BIOSDIR)): check_binaries
890 arune 58
	@$(ECHO) $(MSG_CREATEDIR) $@
550 andfri 59
	@$(MKDIR) -p $@
361 andfri 60
 
61
# Target: clean project.
891 arune 62
clean: check_binaries
559 andfri 63
	@$(MAKE) $(APPMAKEFLAGS) -C $(BUILDDIR) -f $(abspath $(SRCDIR)/Makefile) clean
361 andfri 64
 
891 arune 65
cleanbios: check_binaries
559 andfri 66
	@$(MAKE) $(BIOSMAKEFLAGS) -C $(BIOSDIR) -f $(abspath $(BIOSSRCDIR)/Makefile) clean
554 andfri 67
 
891 arune 68
distclean: check_binaries
890 arune 69
	@$(ECHO) $(MSG_CLEANING)
550 andfri 70
	$(RM) -r $(BUILDDIR)
554 andfri 71
	$(RM) -r $(BIOSDIR)
361 andfri 72
 
903 arune 73
sethwid:
74
	@$(PERL) ../../../../PcSoftware/scripts/SetHwId/SetHwId.pl
75
 
891 arune 76
check_binaries:
77
ifndef MKDIR
78
	@echo 
79
	@echo ERROR! This is because you have not defined build-binaries in system.inc
80
	@echo Please update system.inc.template from SVN and then copy the build binaries definitions to your system.inc
81
	@echo 
82
	@false
83
endif
84
 
361 andfri 85
# Listing of phony targets.
554 andfri 86
.PHONY : all bios installbios upgradebios \
87
install reset start \
903 arune 88
clean cleanbios distclean check_binaries sethwid
361 andfri 89