Project

General

Profile

Statistics
| Revision:

root / branches / library_refactor / projects / libdragonfly / Makefile @ 1083

History | View | Annotate | Download (5.56 KB)

1
# Modified Makefile for the branch (no docs here, no code directory)
2
# Further changes:
3
#   - ... go here
4

    
5
############################
6
### Update this Section ####
7
############################
8

    
9
COLONYROOT = ../..
10

    
11
# Target file name (without extension).
12
TARGET = libdragonfly
13

    
14
############################
15

    
16
CDEFS = 
17

    
18
# MCU name
19
MCU = atmega128
20

    
21

    
22
# Processor frequency.
23
#     This will define a symbol, F_CPU, in all source code files equal to the 
24
#     processor frequency. You can then use this symbol in your source code to 
25
#     calculate timings. Do NOT tack on a 'UL' at the end, this will be done
26
#     automatically to create a 32-bit value in your source code.
27
F_CPU = 16000000
28

    
29

    
30
# Output format. (can be srec, ihex, binary)
31
FORMAT = ihex
32

    
33

    
34
# List C source files here. (C dependencies are automatically generated.)
35
SRC = $(wildcard *.c)
36

    
37
# List Assembler source files here.
38
#     Make them always end in a capital .S.  Files ending in a lowercase .s
39
#     will not be considered source files but generated files (assembler
40
#     output from the compiler), and will be deleted upon "make clean"!
41
#     Even though the DOS/Win* filesystem matches both .s and .S the same,
42
#     it will preserve the spelling of the filenames, and gcc itself does
43
#     care about how the name is spelled on its command-line.
44
ASRC = 
45

    
46
# Optimization level, can be [0, 1, 2, 3, s]. 
47
#     0 = turn off optimization. s = optimize for size.
48
#     (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
49
OPT = s
50

    
51
# Debugging format.
52
#     Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
53
#     AVR Studio 4.10 requires dwarf-2.
54
#     AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
55
DEBUG = 
56
# dwarf-2
57

    
58
# List any extra directories to look for include files here.
59
#     Each directory must be seperated by a space.
60
#     Use forward slashes for directory separators.
61
#     For a directory that has spaces, enclose it in quotes.
62
EXTRAINCDIRS = 
63

    
64
# Compiler flag to set the C Standard level.
65
#     c89   = "ANSI" C
66
#     gnu89 = c89 plus GCC extensions
67
#     c99   = ISO C99 standard (not yet fully implemented)
68
#     gnu99 = c99 plus GCC extensions
69
CSTANDARD = -std=gnu99
70

    
71

    
72
# Place -D or -U options here
73
CDEFS += -DF_CPU=$(F_CPU)UL 
74

    
75
# Place -I options here
76

    
77

    
78
#---------------- Compiler Options ----------------
79
#  -g*:          generate debugging information
80
#  -O*:          optimization level
81
#  -f...:        tuning, see GCC manual and avr-libc documentation
82
#  -Wall...:     warning level
83
#  -Wa,...:      tell GCC to pass this to the assembler.
84
#    -adhlns...: create assembler listing
85
CFLAGS = -g$(DEBUG)
86
CFLAGS += $(CDEFS) $(CINCS)
87
CFLAGS += -O$(OPT)
88
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
89
CFLAGS += -Wall -Wstrict-prototypes
90
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
91
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
92
CFLAGS += $(CSTANDARD)
93

    
94

    
95
#---------------- Library Options ----------------
96
# Minimalistic printf version
97
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
98

    
99
# Floating point printf version (requires MATH_LIB = -lm below)
100
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
101

    
102
# If this is left blank, then it will use the Standard printf version.
103
PRINTF_LIB = 
104
#PRINTF_LIB = $(PRINTF_LIB_MIN)
105
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
106

    
107
# Minimalistic scanf version
108
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
109

    
110
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
111
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
112

    
113
# If this is left blank, then it will use the Standard scanf version.
114
SCANF_LIB = 
115
#SCANF_LIB = $(SCANF_LIB_MIN)
116
#SCANF_LIB = $(SCANF_LIB_FLOAT)
117

    
118
MATH_LIB = -lm
119

    
120
#============================================================================
121

    
122

    
123
# Define programs and commands.
124
SHELL = sh
125
CC = avr-gcc
126
AR = avr-ar
127
OBJCOPY = avr-objcopy
128
OBJDUMP = avr-objdump
129
SIZE = avr-size
130
NM = avr-nm
131
AVRDUDE = avrdude
132
REMOVE = rm -f
133
REMOVEDIR = rm -rf
134
COPY = cp
135
DOXYGEN = doxygen
136
WINSHELL = cmd
137

    
138

    
139
# Define Messages
140
# English
141
MSG_ERRORS_NONE = Errors: none
142
MSG_BEGIN = -------- begin --------
143
MSG_END = --------  end  --------
144
MSG_COMPILING = Compiling:
145
MSG_CLEANING = Cleaning project:
146

    
147
# Define all object files.
148
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) 
149

    
150
# Define all listing files.
151
LST = $(SRC:.c=.lst) $(ASRC:.S=.lst) 
152

    
153
# Compiler flags to generate dependency files.
154
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
155

    
156
# Combine all necessary flags and optional flags.
157
# Add target processor to flags.
158
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
159
ALL_ASFLAGS = rcs
160

    
161
# Default target.
162
all: begin build end
163

    
164
dist: all publish
165

    
166
publish:
167
	$(COPY) $(TARGET).a $(COLONYROOT)/lib/bin
168
	$(COPY) *.h $(COLONYROOT)/lib/include/$(TARGET)
169

    
170
#docs:
171
#	$(DOXYGEN)
172
#	$(COPY) docs/html/* $(COLONYROOT)/docs/$(TARGET)
173

    
174

    
175
build: $(OBJ)
176
	$(AR) $(ALL_ASFLAGS) $(TARGET).a $(OBJ)
177

    
178
# Eye candy.
179
# AVR Studio 3.x does not check make's exit code but relies on
180
# the following magic strings to be generated by the compile job.
181
begin:
182
	@echo
183
	@echo $(MSG_BEGIN)
184

    
185
end:
186
	@echo $(MSG_END)
187
	@echo
188

    
189
# Compile: create object files from C source files.
190
%.o : %.c
191
	@echo
192
	@echo $(MSG_COMPILING) $<
193
	$(CC) -c $(ALL_CFLAGS) $< -o $@ 
194

    
195

    
196
# Target: clean project.
197
clean: begin clean_list end
198

    
199
clean_list :
200
	@echo
201
	@echo $(MSG_CLEANING)
202
	$(REMOVE) $(TARGET).a
203
	$(REMOVE) $(OBJ)
204
	$(REMOVE) $(LST)
205
	$(REMOVE) $(SRC:.c=.s)
206
	$(REMOVE) $(SRC:.c=.d)
207
	$(REMOVEDIR) .dep
208

    
209

    
210

    
211
# Include the dependency files.
212
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
213