Project

General

Profile

Revision 950

Updated makefile to compile binaries for simulator.

View differences:

Makefile
2 2
#
3 3
#
4 4

  
5
# Relative path to the root directory (containing lib directory)
6
ifndef COLONYROOT
7
COLONYROOT = ../../..
8
endif
5
# COMX in Windows. /dev/ttyUSBX in Linux.
6
AVRDUDE_PORT = /dev/ttyUSB0
9 7

  
10 8
# Target file name (without extension).
11 9
TARGET = template
......
13 11
# Uncomment this to use the wireless library
14 12
# USE_WIRELESS = 1
15 13

  
16
# com1 = serial port. Use lpt1 to connect to parallel port.
17
AVRDUDE_PORT = /dev/ttyUSB0
14
# Relative path to the root directory (containing lib directory)
15
ifndef COLONYLIB
16
COLONYLIB = ../../lib
17
endif
18

  
18 19
#
19 20
#
20 21
###################################
......
111 112
CDEFS += -DF_CPU=$(F_CPU)UL
112 113
CDEFS += -DFFP
113 114
# for wireless library
114
ifdef USE_WIRELESS
115
	CDEFS += -DROBOT
116
endif
115
CDEFS += -DROBOT
117 116

  
118 117
# Place -I, -L options here
119
CINCS = -I$(COLONYROOT)/code/lib/include/libdragonfly
120
CINCS += -L$(COLONYROOT)/code/lib/bin
118
CINCS = -I$(COLONYLIB)/include/libdragonfly
119
CINCS += -L$(COLONYLIB)/bin
121 120
ifdef USE_WIRELESS
122
	CINCS += -I$(COLONYROOT)/code/lib/include/libwireless
121
	CINCS += -I$(COLONYLIB)/include/libwireless
123 122
endif
124 123

  
125 124
#---------------- Compiler Options ----------------
......
135 134
CFLAGS += -O$(OPT)
136 135
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
137 136
CFLAGS += -Wall -Wstrict-prototypes
137
CFLAGS += $(CSTANDARD)
138 138
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
139
CFLAGS += $(CSTANDARD)
140 139

  
140
SIMCFLAGS = 
141
# SIMCFLAGS = -g$(DEBUG)
142
SIMCFLAGS += $(CDEFS) $(CINCS)
143
SIMCFLAGS += -O$(OPT)
144
SIMCFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
145
SIMCFLAGS += -Wall -Wstrict-prototypes
146
CFSIMLAGS += $(CSTANDARD)
147

  
141 148
#---------------- Assembler Options ----------------
142 149
#  -Wa,...:   tell GCC to pass this to the assembler.
143 150
#  -ahlms:    create listing
......
197 204
	LDFLAGS += -lwireless
198 205
endif
199 206
LDFLAGS += -ldragonfly
207
SIMLDFLAGS = -lsim
200 208

  
201 209

  
202 210

  
......
275 283
# Define programs and commands.
276 284
SHELL = sh
277 285
CC = avr-gcc
286
SIMCC = gcc
278 287
OBJCOPY = avr-objcopy
279 288
OBJDUMP = avr-objdump
280 289
SIZE = avr-size
......
309 318

  
310 319
# Define all object files.
311 320
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
321
SIMOBJ = $(SRC:.c=.obj) $(ASRC:.S=.obj)
312 322

  
313 323
# Define all listing files.
314 324
LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)
......
321 331
# Combine all necessary flags and optional flags.
322 332
# Add target processor to flags.
323 333
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
334
SIMALL_CFLAGS = -I. $(SIMCFLAGS)
324 335
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
325 336

  
326

  
327

  
328

  
329

  
330 337
# Default target.
331 338
all: begin gccversion sizebefore build sizeafter end
332 339

  
333 340
build: elf hex eep lss sym
341
sim: $(SIMOBJ)
342
	$(SIMCC) $(SIMALL_CFLAGS) $^ -o $(TARGET) $(SIMLDFLAGS)
334 343

  
344
%.obj : %.c
345
	$(SIMCC) -c $(SIMALL_CFLAGS) $< -o $@
346

  
347

  
335 348
elf: $(TARGET).elf
336 349
hex: $(TARGET).hex
337 350
eep: $(TARGET).eep
......
502 515
	$(REMOVE) $(TARGET).sym
503 516
	$(REMOVE) $(TARGET).lss
504 517
	$(REMOVE) $(OBJ)
518
	$(REMOVE) $(SIMOBJ)
505 519
	$(REMOVE) $(LST)
506 520
	$(REMOVE) $(SRC:.c=.s)
507 521
	$(REMOVE) $(SRC:.c=.d)

Also available in: Unified diff