Files

51 lines
1.5 KiB
Makefile
Raw Permalink Normal View History

BUILDDIR:=$(shell pwd)
2019-01-04 22:01:43 +01:00
BUILDROOT=$(BUILDDIR)/buildroot
BUILDROOT_EXTERNAL=$(BUILDDIR)/buildroot-external
2019-01-04 22:01:43 +01:00
DEFCONFIG_DIR = $(BUILDROOT_EXTERNAL)/configs
TARGETS := $(notdir $(patsubst %_defconfig,%,$(wildcard $(DEFCONFIG_DIR)/*_defconfig)))
TARGETS_CONFIG := $(notdir $(patsubst %_defconfig,%-config,$(wildcard $(DEFCONFIG_DIR)/*_defconfig)))
2020-09-04 21:07:32 +02:00
# Set O variable if not already done on the command line
ifneq ("$(origin O)", "command line")
2021-07-08 16:19:37 +02:00
O := $(BUILDDIR)/output
2020-09-04 21:07:32 +02:00
else
2021-07-08 16:19:37 +02:00
override O := $(BUILDDIR)/$(O)
2020-09-04 21:07:32 +02:00
endif
2019-01-04 22:01:43 +01:00
.NOTPARALLEL: $(TARGETS) $(TARGETS_CONFIG) all
.PHONY: $(TARGETS) $(TARGETS_CONFIG) all clean help
all: $(TARGETS)
savedefconfig:
@echo "config $*"
$(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) "savedefconfig"
2019-01-04 22:01:43 +01:00
$(TARGETS_CONFIG): %-config:
@echo "config $*"
2021-07-08 16:19:37 +02:00
$(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) "$*_defconfig"
2019-01-04 22:01:43 +01:00
2023-07-11 23:18:01 +02:00
$(TARGETS): %: %-config
2019-01-04 22:01:43 +01:00
@echo "build $@"
$(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL)
2019-01-04 22:01:43 +01:00
# Do not clean when building for one target
ifneq ($(words $(filter $(TARGETS),$(MAKECMDGOALS))), 1)
@echo "clean $@"
2021-07-08 16:19:37 +02:00
$(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) clean
2019-01-04 22:01:43 +01:00
endif
@echo "finished $@"
clean:
2021-07-08 16:19:37 +02:00
$(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) clean
2019-01-04 22:01:43 +01:00
help:
@echo "Supported targets: $(TARGETS)"
@echo "Run 'make <target>' to build a target image."
@echo "Run 'make all' to build all target images."
@echo "Run 'make clean' to clean the build output."
@echo "Run 'make <target>-config' to configure buildroot for a target."