Skip to content

Commit

Permalink
build one elf for each test/platform combination
Browse files Browse the repository at this point in the history
  • Loading branch information
mkannwischer committed Jul 12, 2024
1 parent e2bce9e commit 59df819
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ totestname = $(shell echo $(1) | tr '[a-z]' '[A-Z]')
totestsources = $(addprefix ../../tests/$(1)/,$($(call totestname,$(1))_SOURCES))
totestasm = $(addprefix ../../tests/$(1)/,$($(call totestname,$(1))_ASMS))
toplatform = $(addsuffix --$(1),$($(call totestname,$(1))_PLATFORMS))
toelfname = $(addsuffix -test.elf,$(1))

platformtests := $(foreach test,$(TESTS), $(call toplatform,$(test)))

Expand All @@ -22,11 +23,11 @@ test = $(lastword $(subst --, ,$*))

.PHONY: ${builds}
${builds}: build-%:
make -j$(shell nproc) -C envs/$(platform) build SOURCES='$(call totestsources,$(test))' ASMS='$(call totestasm,$(test))'
make -j$(shell nproc) -C envs/$(platform) build SOURCES='$(call totestsources,$(test))' ASMS='$(call totestasm,$(test))' TARGET=$(call toelfname,$(test))

.PHONY: ${runs}
${runs}: run-%:
make -C envs/$(platform) run SOURCES='$(call totestsources,$(test))' ASMS='$(call totestasm,$(test))'
make -C envs/$(platform) run SOURCES='$(call totestsources,$(test))' ASMS='$(call totestasm,$(test))' TARGET=$(call toelfname,$(test))

.PHONY: run
run: ${runs}
Expand Down
7 changes: 2 additions & 5 deletions envs/m55-an547/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
CC = arm-none-eabi-gcc
LD := $(CC)

TARGET=test.elf

SRC_DIR=./src
BUILD_DIR=./build

Expand Down Expand Up @@ -67,8 +65,7 @@ $(OBJECTS_ASM): $(BUILD_DIR)/%.o: %
mkdir -p $(@D)
$(CC) -x assembler-with-cpp $(CFLAGS) -c -o $@ $<

.PHONY: test.elf
test.elf: $(OBJECTS) $(LDSCRIPT)
$(TARGET): $(OBJECTS) $(LDSCRIPT)
$(LD) $(LDFLAGS) -o $@ $(OBJECTS)

.PHONY: build
Expand All @@ -78,5 +75,5 @@ run: $(TARGET)
qemu-system-arm -M mps3-an547 -nographic -semihosting -kernel $(TARGET)

clean:
rm -f $(TARGET)
rm -f *.elf
rm -rf $(BUILD_DIR)
7 changes: 2 additions & 5 deletions envs/m85-an555/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
CC = arm-none-eabi-gcc
LD := $(CC)

TARGET=test.elf

SRC_DIR=./src
BUILD_DIR=./build

Expand Down Expand Up @@ -67,8 +65,7 @@ $(OBJECTS_ASM): $(BUILD_DIR)/%.o: %
mkdir -p $(@D)
$(CC) -x assembler-with-cpp $(CFLAGS) -c -o $@ $<

.PHONY: test.elf
test.elf: $(OBJECTS) $(LDSCRIPT)
$(TARGET): $(OBJECTS) $(LDSCRIPT)
$(LD) $(LDFLAGS) -o $@ $(OBJECTS)

.PHONY: build
Expand All @@ -78,5 +75,5 @@ run:
@echo "WARNING: AN555 is not supported by qemu. Skipping"

clean:
rm -f $(TARGET)
rm -f *.elf
rm -rf $(BUILD_DIR)

0 comments on commit 59df819

Please sign in to comment.