summaryrefslogtreecommitdiff
path: root/Makefile
blob: cbe93c80fdb0bd8b902c0ade1b2dd60d7a5c2b65 (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
128
129
130
default: build/system.elf

INCLUDES = -Iinclude -Iinclude/arch/${arch}
COMMON_FLAGS = -g -Os -Wall -Wextra -fno-rtti
CFLAGS = -std=c99
CXXFLAGS = -std=c++14

TARGETS = src/app/${app}/main.cc src/os/object/cpp_helpers.cc src/os/object/outputstream.cc

QUIET = @

ifneq (${verbose}, )
	QUIET =
endif

include src/app/${app}/Makefile.inc

ifneq ($(findstring lm75,${drivers}), )
	TARGETS += src/driver/lm75.cc
	COMMON_FLAGS += -DDRIVER_LM75
endif

ifneq ($(findstring am2320,${drivers}), )
	TARGETS += src/driver/am2320.cc
	COMMON_FLAGS += -DDRIVER_AM2320
endif

ifneq ($(findstring ccs811,${drivers}), )
	TARGETS += src/driver/ccs811.cc
	COMMON_FLAGS += -DDRIVER_CCS811
endif

ifneq ($(findstring eeprom24lc64,${drivers}), )
	TARGETS += src/driver/eeprom24lc64.cc
	COMMON_FLAGS += -DDRIVER_EEPROM24LC64
endif

ifneq ($(findstring max44006,${drivers}), )
	TARGETS += src/driver/max44006.cc
	COMMON_FLAGS += -DDRIVER_MAX44006
endif

ifneq ($(findstring max44009,${drivers}), )
	TARGETS += src/driver/max44009.cc
	COMMON_FLAGS += -DDRIVER_MAX44009
endif

ifneq ($(findstring mmsimple,${drivers}), )
	TARGETS += src/driver/mmsimple.cc
	COMMON_FLAGS += -DDRIVER_MMSIMPLE
endif

ifneq ($(findstring sharp96,${drivers}), )
	TARGETS += src/driver/sharp96.cc
	COMMON_FLAGS += -DDRIVER_SHARP6
	COMMON_FLAGS += -DSHARP96_POWER_PIN=GPIO::${sharp96_power_pin}
	COMMON_FLAGS += -DSHARP96_EN_PIN=GPIO::${sharp96_en_pin}
	COMMON_FLAGS += -DSHARP96_CS_PIN=GPIO::${sharp96_cs_pin}
endif

ifneq ($(findstring softi2c,${drivers}), )
	TARGETS += src/driver/soft_i2c.cc
	COMMON_FLAGS += -DDRIVER_SOFTI2C
endif

ifneq (${i2c_freq}, )
	COMMON_FLAGS += -DF_I2C=${i2c_freq}
endif

ifneq (${timer_freq}, )
	COMMON_FLAGS += -DF_TIMER=${timer_freq}
endif

ifeq (${softi2c_pullup}, 1)
	COMMON_FLAGS += -DSOFTI2C_PULLUP
endif

ifeq (${softi2c_timer}, 1)
	arch_drivers += ,timer
	COMMON_FLAGS += -DSOFTI2C_TIMER
endif

ifeq (${kout_nop}, 1)
	COMMON_FLAGS += -DKOUT_NOP
endif

ifeq (${timer_cycles}, 1)
	COMMON_FLAGS += -DTIMER_CYCLES
endif

ifeq (${timer_us}, 1)
	COMMON_FLAGS += -DTIMER_US
endif

ifeq (${timer_s}, 1)
	COMMON_FLAGS += -DTIMER_S
endif

ifeq (${loop}, 1)
	COMMON_FLAGS += -DWITH_LOOP
endif

ifeq (${wakeup}, 1)
	COMMON_FLAGS += -DWITH_WAKEUP
endif

include src/arch/${arch}/Makefile.inc

clean: arch_clean
	rm -f build/system.elf

help: arch_help
	@echo
	@echo "Global flags:"
	@echo "    timer_cycles timer_us timer_s"
	@echo "    loop"
	@echo
	@echo "${arch} drivers:"
	@echo "    $(shell ls src/arch/${arch}/driver | fgrep .c | cut -d . -f 1)"
	@echo
	@echo "Global drivers:"
	@echo "    $(shell ls src/driver | fgrep .c | cut -d . -f 1)"
	@echo
	@echo "Global architectures:"
	@echo "    $(shell ls src/arch)"

info: arch_info
	@echo "Selected Drivers: ${drivers} / ${arch_drivers}"

.PHONY: clean help info