Skip to content

Commit 7d4a2f7

Browse files
committed
all: Make use of $(TOP) variable in Makefiles, instead of "..".
$(TOP) is defined in py/mkenv.mk and should be used to refer to the top level of this repository.
1 parent f9dfd8a commit 7d4a2f7

File tree

15 files changed

+87
-87
lines changed

15 files changed

+87
-87
lines changed

bare-arm/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ include ../py/mkenv.mk
44
QSTR_DEFS = qstrdefsport.h
55

66
# include py core make definitions
7-
include ../py/py.mk
7+
include $(TOP)/py/py.mk
88

99
CROSS_COMPILE = arm-none-eabi-
1010

1111
INC += -I.
12-
INC += -I..
12+
INC += -I$(TOP)
1313
INC += -I$(BUILD)
1414

1515
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion
@@ -45,4 +45,4 @@ $(BUILD)/firmware.elf: $(OBJ)
4545
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
4646
$(Q)$(SIZE) $@
4747

48-
include ../py/mkrules.mk
48+
include $(TOP)/py/mkrules.mk

cc3200/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ifeq ($(BTARGET), application)
3434
# qstr definitions (must come before including py.mk)
3535
QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h
3636
# include MicroPython make definitions
37-
include ../py/py.mk
37+
include $(TOP)/py/py.mk
3838
include application.mk
3939
else
4040
ifeq ($(BTARGET), bootloader)
@@ -45,7 +45,7 @@ endif
4545
endif
4646

4747
# always include MicroPython make rules
48-
include ../py/mkrules.mk
48+
include $(TOP)/py/mkrules.mk
4949

5050
erase:
5151
cc3200tool -p $(PORT) format_flash --size $(FLASH_SIZE_$(BOARD))

cc3200/application.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
APP_INC = -I.
2-
APP_INC += -I..
2+
APP_INC += -I$(TOP)
33
APP_INC += -Ifatfs/src
44
APP_INC += -Ifatfs/src/drivers
55
APP_INC += -IFreeRTOS
@@ -10,15 +10,15 @@ APP_INC += -Ihal
1010
APP_INC += -Ihal/inc
1111
APP_INC += -Imisc
1212
APP_INC += -Imods
13-
APP_INC += -I../drivers/cc3100/inc
13+
APP_INC += -I$(TOP)/drivers/cc3100/inc
1414
APP_INC += -Isimplelink
1515
APP_INC += -Isimplelink/oslib
1616
APP_INC += -Itelnet
1717
APP_INC += -Iutil
1818
APP_INC += -Ibootmgr
1919
APP_INC += -I$(BUILD)
2020
APP_INC += -I$(BUILD)/genhdr
21-
APP_INC += -I../stmhal
21+
APP_INC += -I$(TOP)/stmhal
2222

2323
APP_CPPDEFINES = -Dgcc -DTARGET_IS_CC3200 -DSL_FULL -DUSE_FREERTOS
2424

cc3200/bootmgr/bootloader.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ BOOT_INC = -Ibootmgr
44
BOOT_INC += -Ibootmgr/sl
55
BOOT_INC += -Ihal
66
BOOT_INC += -Ihal/inc
7-
BOOT_INC += -I../drivers/cc3100/inc
7+
BOOT_INC += -I$(TOP)/drivers/cc3100/inc
88
BOOT_INC += -Imisc
99
BOOT_INC += -Imods
1010
BOOT_INC += -Isimplelink
1111
BOOT_INC += -Isimplelink/oslib
1212
BOOT_INC += -Iutil
13-
BOOT_INC += -I..
13+
BOOT_INC += -I$(TOP)
1414
BOOT_INC += -I.
1515
BOOT_INC += -I$(BUILD)
1616

esp8266/Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ FROZEN_DIR ?= scripts
1212
FROZEN_MPY_DIR ?= modules
1313

1414
# include py core make definitions
15-
include ../py/py.mk
15+
include $(TOP)/py/py.mk
1616

1717
FWBIN = $(BUILD)/firmware-combined.bin
1818
PORT ?= /dev/ttyACM0
@@ -23,7 +23,7 @@ CROSS_COMPILE = xtensa-lx106-elf-
2323
ESP_SDK = $(shell $(CC) -print-sysroot)/usr
2424

2525
INC += -I.
26-
INC += -I..
26+
INC += -I$(TOP)
2727
INC += -I$(BUILD)
2828
INC += -I$(ESP_SDK)/include
2929

@@ -220,16 +220,16 @@ ota:
220220
#$(BUILD)/pins_$(BOARD).o: $(BUILD)/pins_$(BOARD).c
221221
# $(call compile_c)
222222

223-
include ../py/mkrules.mk
223+
include $(TOP)/py/mkrules.mk
224224

225225
axtls: $(BUILD)/libaxtls.a
226226

227227
$(BUILD)/libaxtls.a:
228-
cd ../lib/axtls; cp config/upyconfig config/.config
229-
cd ../lib/axtls; $(MAKE) oldconfig -B
230-
cd ../lib/axtls; $(MAKE) clean
231-
cd ../lib/axtls; $(MAKE) all CC="$(CC)" LD="$(LD)" AR="$(AR)" CFLAGS_EXTRA="$(CFLAGS_XTENSA) -Dabort=abort_ -DRT_MAX_PLAIN_LENGTH=1024 -DRT_EXTRA=4096"
232-
cp ../lib/axtls/_stage/libaxtls.a $@
228+
cd $(TOP)/lib/axtls; cp config/upyconfig config/.config
229+
cd $(TOP)/lib/axtls; $(MAKE) oldconfig -B
230+
cd $(TOP)/lib/axtls; $(MAKE) clean
231+
cd $(TOP)/lib/axtls; $(MAKE) all CC="$(CC)" LD="$(LD)" AR="$(AR)" CFLAGS_EXTRA="$(CFLAGS_XTENSA) -Dabort=abort_ -DRT_MAX_PLAIN_LENGTH=1024 -DRT_EXTRA=4096"
232+
cp $(TOP)/lib/axtls/_stage/libaxtls.a $@
233233

234234
clean-modules:
235235
git clean -f -d modules

minimal/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ CROSS = 0
66
QSTR_DEFS = qstrdefsport.h
77

88
# include py core make definitions
9-
include ../py/py.mk
9+
include $(TOP)/py/py.mk
1010

1111
ifeq ($(CROSS), 1)
1212
CROSS_COMPILE = arm-none-eabi-
1313
endif
1414

1515
INC += -I.
16-
INC += -I..
16+
INC += -I$(TOP)
1717
INC += -I$(BUILD)
1818

1919
ifeq ($(CROSS), 1)
20-
DFU = ../tools/dfu.py
21-
PYDFU = ../tools/pydfu.py
20+
DFU = $(TOP)/tools/dfu.py
21+
PYDFU = $(TOP)/tools/pydfu.py
2222
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion
2323
CFLAGS = $(INC) -Wall -Werror -std=c99 -nostdlib $(CFLAGS_CORTEX_M4) $(COPT)
2424
LDFLAGS = -nostdlib -T stm32f405.ld -Map=$@.map --cref --gc-sections
@@ -57,7 +57,7 @@ endif
5757

5858
$(BUILD)/_frozen_mpy.c: frozentest.mpy $(BUILD)/genhdr/qstrdefs.generated.h
5959
$(ECHO) "MISC freezing bytecode"
60-
$(Q)../tools/mpy-tool.py -f -q $(BUILD)/genhdr/qstrdefs.preprocessed.h -mlongint-impl=none $< > $@
60+
$(Q)$(TOP)/tools/mpy-tool.py -f -q $(BUILD)/genhdr/qstrdefs.preprocessed.h -mlongint-impl=none $< > $@
6161

6262
$(BUILD)/firmware.elf: $(OBJ)
6363
$(ECHO) "LINK $@"
@@ -87,4 +87,4 @@ run:
8787
test: $(BUILD)/firmware.elf
8888
$(Q)/bin/echo -e "print('hello world!', list(x+1 for x in range(10)), end='eol\\\\n')\\r\\n\\x04" | $(BUILD)/firmware.elf | tail -n2 | grep "^hello world! \\[1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\]eol"
8989

90-
include ../py/mkrules.mk
90+
include $(TOP)/py/mkrules.mk

mpy-cross/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ QSTR_DEFS = qstrdefsport.h
2323
UNAME_S := $(shell uname -s)
2424

2525
# include py core make definitions
26-
include ../py/py.mk
26+
include $(TOP)/py/py.mk
2727

2828
INC += -I.
29-
INC += -I..
29+
INC += -I$(TOP)
3030
INC += -I$(BUILD)
3131

3232
# compiler settings
@@ -71,4 +71,4 @@ endif
7171
OBJ = $(PY_O)
7272
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
7373

74-
include ../py/mkrules.mk
74+
include $(TOP)/py/mkrules.mk

pic16bit/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include ../py/mkenv.mk
44
QSTR_DEFS = qstrdefsport.h
55

66
# include py core make definitions
7-
include ../py/py.mk
7+
include $(TOP)/py/py.mk
88

99
XC16 = /opt/microchip/xc16/v1.24
1010
CROSS_COMPILE = $(XC16)/bin/xc16-
@@ -13,7 +13,7 @@ PARTFAMILY = dsPIC33F
1313
PART = 33FJ256GP506
1414

1515
INC += -I.
16-
INC += -I..
16+
INC += -I$(TOP)
1717
INC += -I$(BUILD)
1818
INC += -I$(XC16)/include
1919
INC += -I$(XC16)/support/$(PARTFAMILY)/h
@@ -67,4 +67,4 @@ $(BUILD)/firmware.elf: $(OBJ)
6767
$(PY_BUILD)/gc.o: CFLAGS += -O1
6868
$(PY_BUILD)/vm.o: CFLAGS += -O1
6969

70-
include ../py/mkrules.mk
70+
include $(TOP)/py/mkrules.mk

py/py.mk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ CFLAGS_MOD += -DFFCONF_H=\"lib/oofatfs/ffconf.h\"
2222
ifeq ($(MICROPY_PY_USSL),1)
2323
CFLAGS_MOD += -DMICROPY_PY_USSL=1
2424
ifeq ($(MICROPY_SSL_AXTLS),1)
25-
CFLAGS_MOD += -DMICROPY_SSL_AXTLS=1 -I../lib/axtls/ssl -I../lib/axtls/crypto -I../lib/axtls/config
25+
CFLAGS_MOD += -DMICROPY_SSL_AXTLS=1 -I$(TOP)/lib/axtls/ssl -I$(TOP)/lib/axtls/crypto -I$(TOP)/lib/axtls/config
2626
LDFLAGS_MOD += -Lbuild -laxtls
2727
else ifeq ($(MICROPY_SSL_MBEDTLS),1)
2828
# Can be overridden by ports which have "builtin" mbedTLS
29-
MICROPY_SSL_MBEDTLS_INCLUDE ?= ../lib/mbedtls/include
29+
MICROPY_SSL_MBEDTLS_INCLUDE ?= $(TOP)/lib/mbedtls/include
3030
CFLAGS_MOD += -DMICROPY_SSL_MBEDTLS=1 -I$(MICROPY_SSL_MBEDTLS_INCLUDE)
31-
LDFLAGS_MOD += -L../lib/mbedtls/library -lmbedx509 -lmbedtls -lmbedcrypto
31+
LDFLAGS_MOD += -L$(TOP)/lib/mbedtls/library -lmbedx509 -lmbedtls -lmbedcrypto
3232
endif
3333
endif
3434

@@ -38,7 +38,7 @@ endif
3838

3939
ifeq ($(MICROPY_PY_LWIP),1)
4040
LWIP_DIR = lib/lwip/src
41-
INC += -I../lib/lwip/src/include -I../lib/lwip/src/include/ipv4 -I../extmod/lwip-include
41+
INC += -I$(TOP)/lib/lwip/src/include -I$(TOP)/lib/lwip/src/include/ipv4 -I$(TOP)/extmod/lwip-include
4242
CFLAGS_MOD += -DMICROPY_PY_LWIP=1
4343
SRC_MOD += extmod/modlwip.c lib/netutils/netutils.c
4444
SRC_MOD += $(addprefix $(LWIP_DIR)/,\
@@ -75,7 +75,7 @@ endif
7575
ifeq ($(MICROPY_PY_BTREE),1)
7676
BTREE_DIR = lib/berkeley-db-1.xx
7777
BTREE_DEFS = -D__DBINTERFACE_PRIVATE=1 -Dmpool_error=printf -Dabort=abort_ -Dvirt_fd_t=mp_obj_t "-DVIRT_FD_T_HEADER=<py/obj.h>"
78-
INC += -I../$(BTREE_DIR)/PORT/include
78+
INC += -I$(TOP)/$(BTREE_DIR)/PORT/include
7979
SRC_MOD += extmod/modbtree.c
8080
SRC_MOD += $(addprefix $(BTREE_DIR)/,\
8181
btree/bt_close.c \

qemu-arm/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ include ../py/mkenv.mk
55
QSTR_DEFS = qstrdefsport.h
66

77
# include py core make definitions
8-
include ../py/py.mk
8+
include $(TOP)/py/py.mk
99

1010
CROSS_COMPILE = arm-none-eabi-
1111

1212
INC += -I.
13-
INC += -I..
13+
INC += -I$(TOP)
1414
INC += -I$(BUILD)
15-
INC += -I../tools/tinytest/
15+
INC += -I$(TOP)/tools/tinytest/
1616

1717
CFLAGS_CORTEX_M3 = -mthumb -mcpu=cortex-m3 -mfloat-abi=soft
1818
CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -std=gnu99 $(CFLAGS_CORTEX_M3) $(COPT) \
@@ -98,10 +98,10 @@ test: $(BUILD)/firmware-test.elf
9898

9999
$(BUILD)/test_main.o: $(BUILD)/genhdr/tests.h
100100
$(BUILD)/genhdr/tests.h:
101-
$(Q)echo "Generating $@";(cd ../tests; ../tools/tinytest-codegen.py) > $@
101+
$(Q)echo "Generating $@";(cd $(TOP)/tests; ../tools/tinytest-codegen.py) > $@
102102

103103
$(BUILD)/tinytest.o:
104-
$(Q)$(CC) $(CFLAGS) -DNO_FORKING -o $@ -c ../tools/tinytest/tinytest.c
104+
$(Q)$(CC) $(CFLAGS) -DNO_FORKING -o $@ -c $(TOP)/tools/tinytest/tinytest.c
105105

106106
## `$(LD)` doesn't seem to like `--specs` for some reason, but we can just use `$(CC)` here.
107107
$(BUILD)/firmware.elf: $(OBJ_COMMON) $(OBJ_RUN)
@@ -112,4 +112,4 @@ $(BUILD)/firmware-test.elf: $(OBJ_COMMON) $(OBJ_TEST)
112112
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
113113
$(Q)$(SIZE) $@
114114

115-
include ../py/mkrules.mk
115+
include $(TOP)/py/mkrules.mk

0 commit comments

Comments
 (0)