Skip to content

Commit

Permalink
qemu-arm/Makefile: Adjust object-file lists to get correct dependencies.
Browse files Browse the repository at this point in the history
With this change both the "run" and "test" targets can be built with -j
passed to make.
  • Loading branch information
dpgeorge committed May 26, 2017
1 parent 825460a commit e5e49be
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions qemu-arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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

Expand All @@ -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) $@

Expand Down

0 comments on commit e5e49be

Please sign in to comment.