Files
bsb2/user/Makefile
2026-01-05 10:41:27 +01:00

46 lines
1.1 KiB
Makefile

# Default target
.DEFAULT_GOAL = all
include ../tools/common.mk
# assemble list of all apps
APPS = $(filter app%/, $(wildcard */))
IMGBUILDER = $(BUILDDIR)/imgbuilder
# (Achtung: ist auch in ../Makefile definiert!)
INITRD = $(BUILDDIR)/initrd.img
all: $(INITRD)
# Rezepte fuer Apps (Unterverzeichnisse)
$(APPS): $(BUILDDIR)/init.o
$(VERBOSE) $(MAKE) -C $@ -f ../Makefile.app
# recipe for compiling imgbuilder
$(IMGBUILDER): imgbuilder.cc $(MAKEFILE_LIST)
@echo "CXX $@"
@mkdir -p $(@D)
$(VERBOSE) $(CXX) -std=c++23 -o $@ $<
.ONESHELL:
# recipe for building the initrd image
$(INITRD): $(APPS) $(IMGBUILDER)
@echo "IMGBUILD $@"
@mkdir -p $(@D)
if [ -z "$(APPS)" ] ; then touch $@ ; exit 0 ; fi
$(VERBOSE) $(IMGBUILDER) $(addsuffix $(BUILDDIR)/app.img, $(APPS)) > $@
lint::
$(VERBOSE) $(foreach APP,$(APPS),$(MAKE) -C $(APP) -f ../Makefile.app lint && ) true
tidy::
$(VERBOSE) $(foreach APP,$(APPS),$(MAKE) -C $(APP) -f ../Makefile.app tidy && ) true
# clean all apps additionally to default clean recipe from common.mk
clean::
$(VERBOSE) $(foreach APP,$(APPS),$(MAKE) -C $(APP) -f ../Makefile.app clean && ) true
.PHONY: all clean $(APPS)