summaryrefslogtreecommitdiff
path: root/src/arch/posix/Makefile.inc
blob: 22ddba935f751337320423bb90ffa6afae6a9f11 (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
# vim:ft=make

COMMON_FLAGS += -DMULTIPASS_ARCH_posix

CC = gcc
CXX = g++
OBJDUMP = objdump

ARCH_SHORTNAME = x64

ifeq (${aspectc}, 1)
	CXX = ag++ -r build/repo.acp -v 0 -p . --Xcompiler
endif

CXX_TARGETS += src/arch/posix/arch.cc src/arch/posix/driver/gpio.cc
CXX_TARGETS += src/arch/posix/driver/stdout.cc

ifneq ($(findstring counter,${arch_drivers}), )
	CONFIG_arch_posix_driver_counter = y
endif

ifeq (${timer_s}, 1)
	CONFIG_arch_arduino_nano_driver_uptime = y
endif

ifdef CONFIG_arch_posix_driver_counter
	CXX_TARGETS += src/arch/posix/driver/counter.cc
endif

ifdef CONFIG_arch_arduino_nano_driver_uptime
	COMMON_FLAGS += -DTIMER_S
	CXX_TARGETS += src/arch/arduino-nano/driver/uptime.cc
endif

OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o}

ifneq (${gpio_trace}, )
	COMMON_FLAGS += -DGPIO_TRACE
endif
ifdef CONFIG_gpio_trace
	COMMON_FLAGS += -DGPIO_TRACE
endif

.cc.o:
	${QUIET}${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} -c -o $@ ${@:.o=.cc}

.c.o:
	${QUIET}${CC} ${INCLUDES} ${COMMON_FLAGS} ${CFLAGS} -c -o $@ ${@:.o=.c}

build/system.elf: ${OBJECTS}
	${QUIET}mkdir -p build
	${QUIET}${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} \
		-o $@ ${OBJECTS}

run: build/system.elf
	build/system.elf

monitor: run

program: build/system.elf

arch_clean:
	rm -f ${OBJECTS}

arch_help:
	@echo "posix specific flags:"
	@echo "    gpio_trace = 0 (show GPIO changes on stdout)"

arch_info:
	@echo "Counter Overflow: 18446744073709551616/1"
	@echo "Monitor: run build/system.elf"

.PHONY: arch_clean arch_help arch_info monitor program run