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