forked from Lucretia/tamp2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
112 lines (89 loc) · 3.13 KB
/
makefile
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
# -*- Mode: GNUmakefile -*-
# Filename : makefile
# Description : Makefile for the kernel, which utilises the GPR.
# Author : Luke A. Guest
# Created On : Thu Jun 14 11:59:53 2012
# Licence : See LICENCE in the root directory.
###############################################################################
# These variables should be edited depending on the platform you are building
# for TAMP for.
###############################################################################
BOARD = pc
BUILD = debug
#BUILD = release
# The next option is for when there is a bug box and we need to build with
# extra options so we can file a bug.
#BUG = bug
BUG = clean
###############################################################################
# Everything after here should not be touched.
###############################################################################
PWD = $(shell pwd)
GNATMAKE = gnatmake
AS = as
###############################################################################
# Platform specific.
###############################################################################
ifeq ($(BOARD),pc)
ARCH = i386
TOOL_PREFIX =
AS_FLAGS = --32 -march=$(ARCH)
AS_OBJS = obj/startup.o
ADA_OBJS = obj/multiboot.o
IMAGE = boot.iso
QEMU = qemu
QEMU_FLAGS = -s -cdrom $(IMAGE)
QEMUD_FLAGS = -S $(QEMU_FLAGS)
OUTDIR = out/disk/boot/
else
ifeq ($(BOARD),rpi)
ARCH = arm
TOOL_PREFIX = arm-none-eabi-
AS_FLAGS = -march=armv6zk -mfpu=vfp -mfloat-abi=hard -marm \
-mcpu=arm1176jzf-s -mtune=arm1176jzf-s
endif
endif
###############################################################################
# Force make not to try to build these objects as gnatmake and the project
# file does this for us.
###############################################################################
.PHONY: $(ADA_OBJS)
OBJS = $(AS_OBJS) $(ADA_OBJS)
RTS_DIR = $(PWD)/rts/boards/$(ARCH)
###############################################################################
# Debug specific flags.
###############################################################################
ifeq ($(BUILD),debug)
AS_FLAGS += -g
else
ifeq ($(BUILD),release)
endif
endif
# The final output filename.
TARGET = $(OUTDIR)tamp-$(ARCH).elf
###############################################################################
# Rules.
###############################################################################
all: $(TARGET)
$(TARGET): $(OBJS) src/tamp.adb
$(TOOL_PREFIX)$(GNATMAKE) --RTS=$(RTS_DIR) \
-XBoard=$(BOARD) -XBuild=$(BUILD) -XBug=$(BUG) \
-Ptamp.gpr
obj/startup.o: src/$(BOARD)/startup.s
$(AS) $(AS_FLAGS) src/$(BOARD)/startup.s -o obj/startup.o
# This will start qemu, but then stop the emulation, press ctrl+alt+shift+f2
# to get to the console, press c to continue once GDB has been configured. For
# more on QEMU's monitor, see http://en.wikibooks.org/wiki/QEMU/Monitor
#
# To debug using GDB:
# ./gdb-qemu.sh
qemud: $(IMAGE)
$(QEMU) $(QEMUD_FLAGS)
qemu: $(IMAGE)
$(QEMU) $(QEMU_FLAGS)
# The PC boot.iso image that qemu uses.
boot.iso: $(TARGET)
grub-mkrescue -o boot.iso out/disk/
.PHONY: clean
clean:
-rm obj/* *~ $(TARGET)