Make demo Qt emulator compile again.
[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 # Based on:
7 #   GCC-AVR standard Makefile part 1
8 #   Volker Oth 1/2000
9 #
10 # Author: Bernardo Innocenti <bernie@develer.com>
11 #
12 # $Log$
13 # Revision 1.11  2007/09/29 15:54:14  bernie
14 # Make demo Qt emulator compile again.
15 #
16 # Revision 1.10  2007/09/18 10:17:00  batt
17 # Merge from triface.
18 #
19 # Revision 1.9  2006/09/20 14:28:42  marco
20 # Add MOC. Changed OPTCFLAGS.
21 #
22 # Revision 1.8  2006/09/19 17:50:56  bernie
23 # Make native build the default.
24 #
25 # Revision 1.7  2006/07/19 12:56:24  bernie
26 # Convert to new Doxygen style.
27 #
28 # Revision 1.6  2006/06/12 22:05:09  marco
29 # Bring back config wrongly commited
30 #
31 # Revision 1.4  2006/05/27 22:41:46  bernie
32 # Tweak optimization flags for loops.
33 #
34 # Revision 1.3  2006/05/18 00:40:10  bernie
35 # Setup for AVR development.
36 #
37 # Revision 1.2  2006/03/27 04:48:33  bernie
38 # Add CXXFLAGS; Add recursive targets.
39 #
40 # Revision 1.1  2006/03/22 09:51:53  bernie
41 # Add build infrastructure.
42 #
43 #
44
45 #
46 # Programmer type
47 # see local pgm_config.mk for programmer customization.
48 -include pgm_config.mk
49 DPROG ?= -V -c stk500 -P /dev/ttyS0
50
51 # AVR ISP dongle that blows up easily
52 #DPROG = -V -c stk500 -P /dev/ttyS0
53 #DPROG = -V -c jtag2slow
54 #-P /dev/ttyUSB0
55
56 # STK200 parallel cable
57 #DPROG = -c stk200 -E noreset
58
59 # JTAG ICE mkII
60 #DPROG = avarice --mkII -j usb -l
61
62 # PonyProg serial programmer
63 #DPROG = -c dasa2
64
65 OPTCFLAGS = -ffunction-sections -fdata-sections
66 #OPTCFLAGS = -funsafe-loop-optimizations
67
68 # For AVRStudio
69 #DEBUGCFLAGS = -gdwarf-2
70
71 # For GDB
72 DEBUGCFLAGS = -ggdb
73
74 #
75 # define some variables based on the AVR base path in $(AVR)
76 #
77 CROSS   = #avr-
78 CC      = $(CROSS)gcc
79 CXX     = $(CROSS)g++
80 AS      = $(CC) -x assembler-with-cpp
81 LD      = $(CC)
82 OBJCOPY = $(CROSS)objcopy
83 STRIP   = $(CROSS)strip
84 INSTALL = cp -a
85 RM      = rm -f
86 RM_R    = rm -rf
87 RN      = mv
88 MKDIR_P = mkdir -p
89
90 # For conversion from ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
91 COFFCONVERT=$(OBJCOPY) \
92         --debugging \
93         --change-section-address .data-0x800000 \
94         --change-section-address .bss-0x800000 \
95         --change-section-address .noinit-0x800000 \
96         --change-section-address .eeprom-0x810000
97
98 INCDIR  = -I. -Ihw
99 LIBDIR  = lib
100 OBJDIR  = obj
101 OUTDIR  = images
102 SHELL   = /bin/sh
103 DOXYGEN = doxygen
104 UISP    = uisp
105 AVRDUDE = avrdude
106 FLEXCAT = $(top_srcdir)/tools/flexcat/flexcat
107
108 # output format can be srec, ihex (avrobj is always created)
109 FORMAT = srec
110 #FORMAT = ihex
111
112 # Compiler flags for generating dependencies
113 DEP_FLAGS = -MMD -MP
114
115 # Compiler flags for generating source listings
116 LIST_FLAGS = -Wa,-anhlmsd=$(@:.o=.lst)
117
118 # Linker flags for generating map files
119 #bernie: bogus binutils from Fedora 6 can't cope with this
120 #MAP_FLAGS = -Wl,-Map=$(@:%.elf=%.map),--cref
121
122 # Compiler warning flags for both C and C++
123 WARNFLAGS = \
124         -W -Wformat -Wall -Wundef -Wpointer-arith -Wcast-qual \
125         -Wcast-align -Wwrite-strings -Wsign-compare \
126         -Wmissing-noreturn \
127         -Wextra -Wstrict-aliasing=2 \
128 #       -Wunsafe-loop-optimizations
129
130 # Compiler warning flags for C only
131 C_WARNFLAGS = \
132         -Wmissing-prototypes -Wstrict-prototypes
133
134 # Default C preprocessor flags (for C, C++ and cpp+as)
135 CPPFLAGS = $(INCDIR)
136
137 # Default C compiler flags
138 CFLAGS = $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) $(C_WARNFLAGS) \
139         $(DEP_FLAGS) $(LIST_FLAGS) -std=gnu99
140
141 # Default C++ compiler flags
142 CXXFLAGS = $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) \
143         $(DEP_FLAGS) $(LIST_FLAGS)
144
145 # Default compiler assembly flags
146 CPPAFLAGS = $(DEBUGCFLAGS) -MMD
147
148 # Default assembler flags
149 ASFLAGS = $(DEBUGCFLAGS)
150
151 # Default linker flags
152 #LDFLAGS = $(MAP_FLAGS)
153
154 #bernie: does not complain for missing symbols!
155 LDFLAGS = $(MAP_FLAGS) -Wl,--gc-sections
156
157 # Flags for avrdude
158 AVRDUDEFLAGS = $(DPROG)
159
160 # additional libs
161 LIB = -lm