26
26
# Boards default to all modules enabled (with exceptions)
27
27
# Manually disable by overriding in #mpconfigboard.mk
28
28
29
+ enable-if-any =$(lastword $(sort $(1 ) 0) )
30
+ enable-if-all =$(firstword $(sort $(1 ) 1) )
31
+
32
+ # $(info enable-if-any 0 1 -> $(call enable-if-any,0 1))
33
+ # $(info enable-if-any 1 0 -> $(call enable-if-any,1 0))
34
+ # $(info enable-if-any 1 1 -> $(call enable-if-any,1 1))
35
+ # $(info enable-if-any 0 0 -> $(call enable-if-any,0 0))
36
+ # $(info enable-if-all 0 1 -> $(call enable-if-all,0 1))
37
+ # $(info enable-if-all 1 0 -> $(call enable-if-all,1 0))
38
+ # $(info enable-if-all 1 1 -> $(call enable-if-all,1 1))
39
+ # $(info enable-if-all 0 0 -> $(call enable-if-all,0 0))
40
+
29
41
# Always on. Present here to help generate documentation module support matrix for "builtins".
30
42
CIRCUITPY = 1
31
43
CFLAGS += -DCIRCUITPY=$(CIRCUITPY )
@@ -95,13 +107,7 @@ CFLAGS += -DCIRCUITPY_AUDIOIO=$(CIRCUITPY_AUDIOIO)
95
107
CIRCUITPY_AUDIOPWMIO ?= 0
96
108
CFLAGS += -DCIRCUITPY_AUDIOPWMIO=$(CIRCUITPY_AUDIOPWMIO )
97
109
98
- ifndef CIRCUITPY_AUDIOCORE
99
- ifeq ($(CIRCUITPY_AUDIOPWMIO ) ,1)
100
- CIRCUITPY_AUDIOCORE = $(CIRCUITPY_AUDIOPWMIO )
101
- else
102
- CIRCUITPY_AUDIOCORE = $(CIRCUITPY_AUDIOIO )
103
- endif
104
- endif
110
+ CIRCUITPY_AUDIOCORE ?= $(call enable-if-any,$(CIRCUITPY_AUDIOPWMIO ) $(CIRCUITPY_AUDIOIO ) $(CIRCUITPY_AUDIOBUSIO ) )
105
111
CFLAGS += -DCIRCUITPY_AUDIOCORE=$(CIRCUITPY_AUDIOCORE )
106
112
107
113
CIRCUITPY_AUDIOMIXER ?= $(CIRCUITPY_AUDIOCORE )
@@ -112,13 +118,7 @@ CIRCUITPY_AUDIOCORE_DEBUG ?= 0
112
118
endif
113
119
CFLAGS += -DCIRCUITPY_AUDIOCORE_DEBUG=$(CIRCUITPY_AUDIOCORE_DEBUG )
114
120
115
- ifndef CIRCUITPY_AUDIOMP3
116
- ifeq ($(CIRCUITPY_FULL_BUILD ) ,1)
117
- CIRCUITPY_AUDIOMP3 = $(CIRCUITPY_AUDIOCORE )
118
- else
119
- CIRCUITPY_AUDIOMP3 = 0
120
- endif
121
- endif
121
+ CIRCUITPY_AUDIOMP3 ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD ) $(CIRCUITPY_AUDIOCORE ) )
122
122
CFLAGS += -DCIRCUITPY_AUDIOMP3=$(CIRCUITPY_AUDIOMP3 )
123
123
124
124
CIRCUITPY_BINASCII ?= $(CIRCUITPY_FULL_BUILD )
@@ -200,15 +200,9 @@ endif
200
200
CFLAGS += -DCIRCUITPY_PARALLELDISPLAY=$(CIRCUITPY_PARALLELDISPLAY )
201
201
202
202
# bitmaptools and framebufferio rely on displayio
203
- ifeq ($(CIRCUITPY_DISPLAYIO ) ,1)
204
- CIRCUITPY_BITMAPTOOLS ?= $(CIRCUITPY_FULL_BUILD )
205
- CIRCUITPY_FRAMEBUFFERIO ?= $(CIRCUITPY_FULL_BUILD )
206
- CIRCUITPY_VECTORIO ?= 1
207
- else
208
- CIRCUITPY_BITMAPTOOLS ?= 0
209
- CIRCUITPY_FRAMEBUFFERIO ?= 0
210
- CIRCUITPY_VECTORIO ?= 0
211
- endif
203
+ CIRCUITPY_BITMAPTOOLS ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD ) $(CIRCUITPY_DISPLAYIO ) )
204
+ CIRCUITPY_FRAMEBUFFERIO ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD ) $(CIRCUITPY_DISPLAYIO ) )
205
+ CIRCUITPY_VECTORIO ?= $(CIRCUITPY_DISPLAYIO )
212
206
CFLAGS += -DCIRCUITPY_BITMAPTOOLS=$(CIRCUITPY_BITMAPTOOLS )
213
207
CFLAGS += -DCIRCUITPY_FRAMEBUFFERIO=$(CIRCUITPY_FRAMEBUFFERIO )
214
208
CFLAGS += -DCIRCUITPY_VECTORIO=$(CIRCUITPY_VECTORIO )
@@ -255,12 +249,7 @@ CFLAGS += -DCIRCUITPY_FUTURE=$(CIRCUITPY_FUTURE)
255
249
CIRCUITPY_GETPASS ?= $(CIRCUITPY_FULL_BUILD )
256
250
CFLAGS += -DCIRCUITPY_GETPASS=$(CIRCUITPY_GETPASS )
257
251
258
- ifeq ($(CIRCUITPY_DISPLAYIO ) ,1)
259
- # CIRCUITPY_GIFIO ?= $(CIRCUITPY_CAMERA)
260
- CIRCUITPY_GIFIO ?= 1
261
- else
262
- CIRCUITPY_GIFIO ?= 0
263
- endif
252
+ CIRCUITPY_GIFIO ?= $(call enable-if-any,$(CIRCUITPY_DISPLAYIO ) $(CIRCUITPY_CAMERA ) )
264
253
CFLAGS += -DCIRCUITPY_GIFIO=$(CIRCUITPY_GIFIO )
265
254
266
255
CIRCUITPY_GNSS ?= 0
@@ -468,10 +457,7 @@ CFLAGS += -DCIRCUITPY_SYS=$(CIRCUITPY_SYS)
468
457
CIRCUITPY_TERMINALIO ?= $(CIRCUITPY_DISPLAYIO )
469
458
CFLAGS += -DCIRCUITPY_TERMINALIO=$(CIRCUITPY_TERMINALIO )
470
459
471
- ifeq ($(CIRCUITPY_DISPLAYIO ) ,1)
472
- CIRCUITPY_FONTIO ?= $(CIRCUITPY_TERMINALIO )
473
- endif
474
- CFLAGS += -DCIRCUITPY_FONTIO=$(CIRCUITPY_FONTIO )
460
+ CIRCUITPY_FONTIO ?= $(call enable-if-all,$(CIRCUITPY_DISPLAYIO ) $(CIRCUITPY_TERMINALIO ) )
475
461
476
462
CIRCUITPY_TIME ?= 1
477
463
CFLAGS += -DCIRCUITPY_TIME=$(CIRCUITPY_TIME )
0 commit comments