aboutsummaryrefslogtreecommitdiff
path: root/kernel/Makefile.inc
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2011-07-04 06:08:19 +0000
committerDimitri Sokolyuk <demon@dim13.org>2011-07-04 06:08:19 +0000
commit980d2f10a80f5c1f844809a3ecdea44b8a4235b3 (patch)
treeb4b3c905e706629e43e135d455e42a7b1817eb33 /kernel/Makefile.inc
parent9c5d5fa5a856064007e38335604a07451c7c35e6 (diff)
split build tree
rearange Makefiles
Diffstat (limited to 'kernel/Makefile.inc')
-rw-r--r--kernel/Makefile.inc48
1 files changed, 48 insertions, 0 deletions
diff --git a/kernel/Makefile.inc b/kernel/Makefile.inc
new file mode 100644
index 0000000..9417686
--- /dev/null
+++ b/kernel/Makefile.inc
@@ -0,0 +1,48 @@
+# $Id$
+
+.PATH: ${.CURDIR}/..
+
+CC= avr-gcc
+OBJCOPY= avr-objcopy
+OBJDUMP= avr-objdump
+SIZE= avr-size
+
+CFLAGS= -Wall -Os -mmcu=${MCU} \
+ -DF_CPU=${F_CPU} -DPRESCALE=${PRESCALE} -DBAUD=${BAUD} \
+ -DSTACK=${STACK} -DTASKS=${TASKS} -DSEMAPHORES=${SEMAPHORES}
+LDFLAGS= -Wl,-Map,${PROG}.map
+
+.SUFFIXES: .lst .hex .bin .srec .ehex .ebin .esrec
+
+all: ${PROG} ${PROG}.lst ${PROG}.hex ${PROG}.ehex size
+
+size: ${PROG}
+ ${SIZE} -C --mcu=${MCU} ${.ALLSRC}
+
+clean:
+ rm -f *.o ${PROG} *.bak *.lst *.map *.hex *.bin *srec *.ehex *.ebin *.esrec
+
+${PROG}.lst: ${PROG}
+ ${OBJDUMP} -h -S ${.ALLSRC} > ${.TARGET}
+
+# Rules for building the .text rom images
+
+${PROG}.hex: ${PROG}
+ ${OBJCOPY} -j .text -j .data -O ihex ${.ALLSRC} ${.TARGET}
+
+${PROG}.bin: ${PROG}
+ ${OBJCOPY} -j .text -j .data -O binary ${.ALLSRC} ${.TARGET}
+
+${PROG}.srec: ${PROG}
+ ${OBJCOPY} -j .text -j .data -O srec ${.ALLSRC} ${.TARGET}
+
+# Rules for building the .eeprom rom images
+
+${PROG}.ehex: ${PROG}
+ ${OBJCOPY} -j .eeprom --change-section-lma .eeprom=0 -O ihex ${.ALLSRC} ${.TARGET}
+
+${PROG}.ebin: ${PROG}
+ ${OBJCOPY} -j .eeprom --change-section-lma .eeprom=0 -O binary ${.ALLSRC} ${.TARGET}
+
+${PROG}.esrec: ${PROG}
+ ${OBJCOPY} -j .eeprom --change-section-lma .eeprom=0 -O srec ${.ALLSRC} ${.TARGET}