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