mbv: clean up build
This commit is contained in:
24
mbv/Makefile
24
mbv/Makefile
@@ -23,20 +23,24 @@ sources += hal/uart/xuartlite.c hal/uart/xuartlite_stats.c hal/uart/xuartlite_in
|
||||
includes += -Ihal/uart
|
||||
|
||||
bootloader_objects = bootloader.o start.o $(sources:.c=.o)
|
||||
app_objects = helloworld.o start.o $(sources:.c=.o)
|
||||
helloworld_objects = helloworld.o start.o $(sources:.c=.o)
|
||||
|
||||
all_objects = $(bootloader_objects) $(helloworld_objects)
|
||||
deps = $(all_objects:.o=.d)
|
||||
|
||||
CPPFLAGS += $(includes)
|
||||
|
||||
%.bin: %.elf
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
|
||||
%.elf: app.ld
|
||||
$(LD) -Wl,-Tapp.ld $(LDFLAGS) -o $@ $(objects)
|
||||
|
||||
bootloader.elf: $(bootloader_objects) bootloader.ld
|
||||
$(LD) -Wl,-Tbootloader.ld $(LDFLAGS) -o $@ $(bootloader_objects)
|
||||
|
||||
app.elf: $(app_objects) app.ld
|
||||
$(LD) -Wl,-Tapp.ld $(LDFLAGS) -o $@ $(app_objects)
|
||||
|
||||
deps = $(app_objects:.o=.d) $(bootloader_objects:.o=.d)
|
||||
helloworld.elf: objects = $(helloworld_objects)
|
||||
helloworld.elf: $(helloworld_objects)
|
||||
|
||||
HOSTCXX = clang++
|
||||
HOSTLDFLAGS = -lgmock -lgtest -lgtest_main -L/usr/local/opt/llvm/lib -L/usr/local/lib
|
||||
@@ -76,8 +80,12 @@ mktest:
|
||||
test_deps =
|
||||
|
||||
.PHONY: bootloader
|
||||
bootloader: ## Build the bootloader in a docker container
|
||||
docker build -o . --target bootloader-export .
|
||||
bootloader: ## Build the bootloader in docker
|
||||
docker build -o . --target export --build-arg TARGET=bootloader.elf .
|
||||
|
||||
.PHONY: helloworld
|
||||
helloworld: ## Build the helloworld app in docker
|
||||
docker build -o . --target export --build-arg TARGET=helloworld.bin .
|
||||
|
||||
.PHONY: dev-image
|
||||
dev-image:
|
||||
@@ -89,7 +97,7 @@ dev: dev-image ## Run a dev container
|
||||
|
||||
.PHONY: clean
|
||||
clean: ## Remove generated files
|
||||
rm -rf *.elf *.bin $(app_objects) $(bootloader_objects) $(deps)
|
||||
rm -rf *.elf *.bin $(all_objects) $(deps)
|
||||
rm -rf test/ *.dSYM $(test_deps) *.o
|
||||
|
||||
.PHONY: help
|
||||
|
Reference in New Issue
Block a user