qemu-arm/Makefile: Adjust object-file lists to get correct dependencies.

With this change both the "run" and "test" targets can be built with -j
passed to make.
This commit is contained in:
Damien George 2017-05-26 22:51:14 +10:00
parent 825460a093
commit e5e49bedcb
1 changed files with 17 additions and 18 deletions

View File

@ -34,15 +34,15 @@ endif
## - gcc-arm-none-eabi-4_8-2014q1/share/gcc-arm-none-eabi/samples/src/qemu/Makefile
LDFLAGS= --specs=nano.specs --specs=rdimon.specs -Wl,--gc-sections -Wl,-Map=$(@:.elf=.map)
SRC_C = \
main.c \
SRC_COMMON_C = \
moduos.c \
modmachine.c \
SRC_RUN_C = \
main.c \
SRC_TEST_C = \
test_main.c \
moduos.c \
modmachine.c \
LIB_SRC_C = $(addprefix lib/,\
libm/math.c \
@ -69,25 +69,24 @@ STM_SRC_C = $(addprefix stmhal/,\
pybstdio.c \
)
SRC_S = \
OBJ_COMMON =
OBJ_COMMON += $(PY_O)
OBJ_COMMON += $(addprefix $(BUILD)/, $(SRC_COMMON_C:.c=.o))
OBJ_COMMON += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
OBJ_COMMON += $(addprefix $(BUILD)/, $(STM_SRC_C:.c=.o))
OBJ =
OBJ += $(PY_O)
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(STM_SRC_C:.c=.o))
OBJ_RUN =
OBJ_RUN += $(addprefix $(BUILD)/, $(SRC_RUN_C:.c=.o))
OBJ_TEST =
OBJ_TEST += $(PY_O)
OBJ_TEST += $(addprefix $(BUILD)/, $(SRC_TEST_C:.c=.o))
OBJ_TEST += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
OBJ_TEST += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
OBJ_TEST += $(addprefix $(BUILD)/, $(STM_SRC_C:.c=.o))
OBJ_TEST += $(BUILD)/tinytest.o
# All object files, needed to get dependencies correct
OBJ = $(OBJ_COMMON) $(OBJ_RUN) $(OBJ_TEST)
# List of sources for qstr extraction
SRC_QSTR += $(SRC_C) $(STM_SRC_C)
SRC_QSTR += $(SRC_COMMON_C) $(SRC_RUN_C) $(STM_SRC_C)
all: run
@ -109,11 +108,11 @@ $(BUILD)/tinytest.o:
$(Q)$(CC) $(CFLAGS) -DNO_FORKING -o $@ -c ../tools/tinytest/tinytest.c
## `$(LD)` doesn't seem to like `--specs` for some reason, but we can just use `$(CC)` here.
$(BUILD)/firmware.elf: $(OBJ)
$(BUILD)/firmware.elf: $(OBJ_COMMON) $(OBJ_RUN)
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
$(Q)$(SIZE) $@
$(BUILD)/firmware-test.elf: $(OBJ_TEST)
$(BUILD)/firmware-test.elf: $(OBJ_COMMON) $(OBJ_TEST)
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
$(Q)$(SIZE) $@