summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/default/Makefile
blob: d0fbfb0a3c08b1968a85ea29215ccddffed16f05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
###############################################################################
# Makefile for the project RoboCode
###############################################################################

## General Flags
PROJECT = RoboCode
MCU = atmega128
TARGET = RoboCode.elf
CC = avr-g++.exe

## Options common to compile, link and assembly rules
COMMON = -mmcu=$(MCU)

## Compile options common for all C compilation units.
CFLAGS = $(COMMON)
CFLAGS += -Wall -gdwarf-2 -O3 -fsigned-char 
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d 

## Assembly specific flags
ASMFLAGS = $(COMMON)
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2

## Linker flags
LDFLAGS = $(COMMON)
LDFLAGS += 


## Intel Hex file production flags
HEX_FLASH_FLAGS = -R .eeprom

HEX_EEPROM_FLAGS = -j .eeprom
HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0


## Include Directories
INCLUDES = -I"Y:\Concept\Framework\modules" -I"Y:\Concept\Framework\modules\executor" -I"Y:\Concept\Framework\modules\input" -I"Y:\Concept\Framework\modules\interpreter" -I"Y:\Concept\Framework\modules\logic" -I"Y:\Concept\Framework\modules\output" 

## Objects that must be built in order to link
OBJECTS = io_module.o atmega128io.o main.o robot.o tools.o distance_sensor.o ir_sensor.o keyboard.o mouse_sensor.o sensor.o position_tracker.o display.o dribbler.o engine.o kicker.o led.o ball_tracker.o navigator.o 

## Objects explicitly added by the user
LINKONLYOBJECTS = 

## Build
all: $(TARGET) RoboCode.hex RoboCode.eep size

## Compile
io_module.o: ../modules/io_module.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

atmega128io.o: ../atmega128io.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

main.o: ../main.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

robot.o: ../robot.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

tools.o: ../tools.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

distance_sensor.o: ../modules/input/distance_sensor.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

ir_sensor.o: ../modules/input/ir_sensor.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

keyboard.o: ../modules/input/keyboard.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

mouse_sensor.o: ../modules/input/mouse_sensor.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

sensor.o: ../modules/input/sensor.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

position_tracker.o: ../modules/interpreter/position_tracker.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

display.o: ../modules/output/display.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

dribbler.o: ../modules/output/dribbler.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

engine.o: ../modules/output/engine.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

kicker.o: ../modules/output/kicker.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

led.o: ../modules/output/led.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

ball_tracker.o: ../modules/interpreter/ball_tracker.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

navigator.o: ../modules/executor/navigator.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

##Link
$(TARGET): $(OBJECTS)
	 $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)

%.hex: $(TARGET)
	avr-objcopy -O ihex $(HEX_FLASH_FLAGS)  $< $@

%.eep: $(TARGET)
	avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@

%.lss: $(TARGET)
	avr-objdump -h -S $< > $@

size: ${TARGET}
	@echo
	@avr-size -C --mcu=${MCU} ${TARGET}

## Clean target
.PHONY: clean
clean:
	-rm -rf $(OBJECTS) RoboCode.elf dep/* RoboCode.hex RoboCode.eep

## Other dependencies
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)