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