Refomart.
[bertos.git] / bertos / config.mk
1 #
2 # $Id$
3 # Copyright 2002,2003, 2004, 2006 Develer S.r.l. (http://www.develer.com/)
4 # All rights reserved.
5 #
6 # Author: Bernie Innocenti <bernie@codewiz.org>
7 # Based on: GCC-AVR standard Makefile part 1, Volker Oth 1/2000
8 #
9
10 #
11 # Programmer type
12 # see local pgm_config.mk for programmer customization.
13 -include pgm_config.mk
14 DPROG ?= -V -c stk500 -P /dev/ttyS0
15
16 OPTCFLAGS = -ffunction-sections -fdata-sections
17 #OPTCFLAGS = -funsafe-loop-optimizations
18
19 # For AVRStudio
20 #DEBUGCFLAGS = -gdwarf-2
21
22 # For GDB
23 DEBUGCFLAGS = -ggdb
24
25 #
26 # define some variables based on the AVR base path in $(AVR)
27 #
28 CC      = gcc
29 CXX     = g++
30 AR      = ar
31 AS      = $(CC) -x assembler-with-cpp
32 LD      = $(CC)
33 LDXX    = $(CXX)
34 OBJCOPY = objcopy
35 STRIP   = strip
36 INSTALL = cp -a
37 RM      = rm -f
38 RM_R    = rm -rf
39 RN      = mv
40 MKDIR_P = mkdir -p
41 SHELL   = /bin/sh
42 CHECKER = sparse
43 DOXYGEN = doxygen
44 AVRDUDE = avrdude
45 FLEXCAT = $(top_srcdir)/tools/flexcat/flexcat
46
47 # For conversion from ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
48 COFFCONVERT=$(OBJCOPY) \
49         --debugging \
50         --change-section-address .data-0x800000 \
51         --change-section-address .bss-0x800000 \
52         --change-section-address .noinit-0x800000 \
53         --change-section-address .eeprom-0x810000
54
55 INCDIR  = -I. -Ibertos 
56 LIBDIR  = lib
57 OBJDIR  = obj
58 OUTDIR  = images
59
60 # output format can be srec, ihex (avrobj is always created)
61 FORMAT = srec
62 #FORMAT = ihex
63
64 # Compiler flags for generating dependencies
65 DEP_FLAGS = -MMD -MP
66
67 # Compiler flags for generating source listings
68 LIST_FLAGS = -Wa,-anhlmsd=$(@:.o=.lst) -dp
69
70 # Linker flags for generating map files
71 # Only in embedded related projects generate map files
72 MAP_FLAGS_EMB = -Wl,-Map=$(@:%.elf=%.map),--cref
73 MAP_FLAGS_HOST =
74
75 # Compiler warning flags for both C and C++
76 WARNFLAGS = \
77         -W -Wformat -Wall -Wundef -Wpointer-arith -Wcast-qual \
78         -Wcast-align -Wwrite-strings -Wsign-compare \
79         -Wmissing-noreturn \
80         -Wextra -Wstrict-aliasing=2 \
81 #       -Wunsafe-loop-optimizations
82
83 # Compiler warning flags for C only
84 C_WARNFLAGS = \
85         -Wmissing-prototypes -Wstrict-prototypes
86
87 # Default C preprocessor flags (for C, C++ and cpp+as)
88 CPPFLAGS = $(INCDIR)
89
90 # Default C compiler flags
91 CFLAGS = $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) $(C_WARNFLAGS) \
92         $(DEP_FLAGS) $(LIST_FLAGS) -std=gnu99
93
94 # Default C++ compiler flags
95 CXXFLAGS = $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) \
96         $(DEP_FLAGS) $(LIST_FLAGS)
97
98 # Default compiler assembly flags
99 CPPAFLAGS = $(DEBUGCFLAGS) -MMD
100
101 # Default assembler flags
102 ASFLAGS = $(DEBUGCFLAGS)
103
104 # Default linker flags
105 #LDFLAGS = $(MAP_FLAGS)
106
107 #bernie: does not complain for missing symbols!
108 LDFLAGS = -Wl,--gc-sections
109
110 # Flags for avrdude
111 AVRDUDEFLAGS = $(DPROG)
112
113 # additional libs
114 LIB = -lm
115
116 # Archiver flags
117 ARFLAGS = rcs