Subversion Repositories HomeAutomation

Rev

Rev 469 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 469 Rev 550
Line 1... Line 1...
1
# $Id: Makefile 469 2007-05-17 15:09:35Z arune $
1
# $Id: Makefile 550 2007-07-19 22:44:46Z andfri $
2
PRG            = bios
2
PRG            = bios
3
ASRC           = $(BIOSDIR)/vectors.S
3
ASRC           = $(BIOSDIR)/vectors.S
4
CSRC           = $(BIOSDIR)/bios_export.c $(BIOSDIR)/bios.c $(BIOSDIR)/flash.c
4
CSRC           = $(BIOSDIR)/bios_export.c $(BIOSDIR)/bios.c $(BIOSDIR)/flash.c
5
BIOS_VERSION   = 0x1338
5
BIOS_VERSION   = 0x1338
6
OPTIMIZE       = -Os -mcall-prologues
6
OPTIMIZE       = -Os -mcall-prologues
Line 61... Line 61...
61
update: clean all updateconfig
61
update: clean all updateconfig
62
 
62
 
63
# Move config from a node-folder to avr-lib dir to be able to compile a new version of bios
63
# Move config from a node-folder to avr-lib dir to be able to compile a new version of bios
64
# this removes the lines starting with BIOS_RAM_END and BIOS_VERSION becasue they are added in make template
64
# this removes the lines starting with BIOS_RAM_END and BIOS_VERSION becasue they are added in make template
65
oldconfig:
65
oldconfig:
-
 
66
	cp config.inc config.old
66
	@$(AWK) '!/^BIOS_RAM_END*/ && !/^BIOS_VERSION*/ { print }' $(PERSONALDIR)/*$(NODE_ID)*/bios.inc > config.inc
67
	@$(AWK) '!/^BIOS_RAM_END*/ && !/^BIOS_VERSION*/ { print }' $(PERSONALDIR)/*$(NODE_ID)*/$(BIOSDIR)/bios.inc > config.inc
67
#	- cp $(PERSONALDIR)/*$(NODE_ID)*/bios.inc config.inc
68
#	- cp $(PERSONALDIR)/*$(NODE_ID)*/bios.inc config.inc
68
 
69
 
69
# Copy template to personal dir
70
# Copy template to personal dir
70
move:
71
move:
71
	- mkdir -p $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME)
72
	- mkdir -p $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME)
72
	- cp $(TEMPLATEDIR)/bios.h $(TEMPLATEDIR)/bios.inc $(TEMPLATEDIR)/config.inc $(TEMPLATEDIR)/libbios.a $(TEMPLATEDIR)/main.c $(TEMPLATEDIR)/Makefile $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME)/
73
	- cp -r $(TEMPLATEDIR)/* $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME)/
73
 
74
 
74
# Copy template to personal dir but dont copy makefile and main.c as you dont want these files replaced generally 
75
# Copy template to personal dir but dont copy makefile and main.c as you dont want these files replaced generally 
75
updateconfig:
76
updateconfig:
76
	- mkdir -p $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME)
-
 
77
	- cp $(TEMPLATEDIR)/bios.h $(TEMPLATEDIR)/bios.inc $(TEMPLATEDIR)/config.inc $(TEMPLATEDIR)/libbios.a $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME)/
77
	- cp -r $(TEMPLATEDIR)/$(BIOSDIR) $(TEMPLATEDIR)/config.inc $(TEMPLATEDIR)/Makefile $(PERSONALDIR)/$(NODE_ID)_*/
78
 
78
 
79
 
79
 
80
.PHONY: clean cleanintermediate cleantemplate
80
.PHONY: clean cleanintermediate cleantemplate distclean
81
clean: cleanintermediate cleantemplate
81
clean: cleanintermediate cleantemplate
82
	-rm -f $(PRG).elf $(PRG).lst $(PRG).map *.hex
82
	-rm -f $(PRG).elf $(PRG).lst $(PRG).map *.hex
83
 
83
 
84
cleanintermediate:
84
cleanintermediate:
85
	-rm -f $(OBJ) $(LIBNAME).[So] *.d $(BIOSDIR)/config.h
85
	-rm -f $(OBJ) $(LIBNAME).[So] *.d $(BIOSDIR)/config.h
86
 
86
 
87
cleantemplate:
87
cleantemplate:
88
	-rm -f $(TEMPLATEDIR)/bios.* $(TEMPLATEDIR)/$(LIBNAME).a
88
	-rm -f $(TEMPLATEDIR)/$(BIOSDIR)/*
-
 
89
 
-
 
90
distclean:
-
 
91
	@echo Cleaning: template
-
 
92
	$(MAKE) -C template distclean
-
 
93
	@echo Cleaning: bios
-
 
94
	$(MAKE) clean
89
 
95
 
90
.PHONY: lst
96
.PHONY: lst
91
lst:  $(PRG).lst
97
lst:  $(PRG).lst
92
 
98
 
93
%.lst: %.elf
99
%.lst: %.elf
Line 105... Line 111...
105
 
111
 
106
$(BIOSDIR)/config.h: config.inc
112
$(BIOSDIR)/config.h: config.inc
107
	@echo Generating $@
113
	@echo Generating $@
108
	@$(AWK) 'BEGIN { FS="="; print "#ifndef CONFIG_H_\n#define CONFIG_H_\n" } /^[^#].*=.*/ { print "#define "$$1,$$2 } END { print "#endif" }' $< > $@
114
	@$(AWK) 'BEGIN { FS="="; print "#ifndef CONFIG_H_\n#define CONFIG_H_\n" } /^[^#].*=.*/ { print "#define "$$1,$$2 } END { print "#endif" }' $< > $@
109
 
115
 
110
$(TEMPLATEDIR)/bios.inc: config.inc $(PRG).elf
116
$(TEMPLATEDIR)/$(BIOSDIR)/bios.inc: config.inc $(PRG).elf
111
	@echo Generating $@
117
	@echo Generating $@
112
	@echo "# This file is automatically generated. Do not edit." > $@
118
	@echo "# This file is automatically generated. Do not edit." > $@
113
	@$(AWK) '/^[^#].*=.*/ { print $$0 }' config.inc >> $@
119
	@$(AWK) '/^[^#].*=.*/ { print $$0 }' config.inc >> $@
114
	@$(AWK) '/0x[0-9a-f]+.*__bios_ram_end/ { print "BIOS_RAM_END="$$1 }' bios.map >> $@
120
	@$(AWK) '/0x[0-9a-f]+.*__bios_ram_end/ { print "BIOS_RAM_END="$$1 }' bios.map >> $@
115
	@echo "BIOS_VERSION=$(BIOS_VERSION)" >> $@
121
	@echo "BIOS_VERSION=$(BIOS_VERSION)" >> $@
116
 
122
 
117
$(TEMPLATEDIR)/bios.h: drivers/can/can.h $(BIOSDIR)/bios_export.h
123
$(TEMPLATEDIR)/$(BIOSDIR)/bios.h: drivers/can/can.h $(BIOSDIR)/bios_export.h
118
	@echo Generating $@
124
	@echo Generating $@
119
	@echo "/* This file is automatically generated. Do not edit. */\n" > $@
125
	@echo "/* This file is automatically generated. Do not edit. */\n" > $@
120
	@echo "#ifndef BIOS_H_\n#define BIOS_H_\n" >> $@
126
	@echo "#ifndef BIOS_H_\n#define BIOS_H_\n" >> $@
121
	@cat $^ >> $@
127
	@cat $^ >> $@
122
	@echo "\n#endif /*BIOS_H_*/" >> $@
128
	@echo "\n#endif /*BIOS_H_*/" >> $@
123
 
129
 
124
.PHONY: template
130
.PHONY: template
125
template: $(TEMPLATEDIR)/bios.h $(TEMPLATEDIR)/bios.inc $(TEMPLATEDIR)/$(LIBNAME).a($(LIBNAME).o)
131
template: $(TEMPLATEDIR)/$(BIOSDIR)/bios.h $(TEMPLATEDIR)/$(BIOSDIR)/bios.inc $(TEMPLATEDIR)/$(BIOSDIR)/$(LIBNAME).a($(LIBNAME).o)
126
 
132
 
127
%.d: %.c
133
%.d: %.c
128
	@set -e; rm -f $@; \
134
	@set -e; rm -f $@; \
129
	$(CC) -M $(CFLAGS) $< > $@.$$$$; \
135
	$(CC) -M $(CFLAGS) $< > $@.$$$$; \
130
	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
136
	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \