Make a top-level make build everything in order

This commit is contained in:
TuxSH 2018-05-15 01:30:56 +02:00
parent 8bf4cd1908
commit d9c2a54464
3 changed files with 22 additions and 58 deletions

View file

@ -1,4 +1,4 @@
SUBFOLDERS := exosphere fusee/fusee-primary fusee/fusee-secondary stratosphere/libstratosphere thermosphere
SUBFOLDERS := exosphere fusee stratosphere thermosphere
TOPTARGETS := all clean
@ -7,4 +7,6 @@ $(TOPTARGETS): $(SUBFOLDERS)
$(SUBFOLDERS):
$(MAKE) -C $@ $(MAKECMDGOALS)
fusee: exosphere thermosphere stratosphere
.PHONY: $(TOPTARGETS) $(SUBFOLDERS)

View file

@ -1,61 +1,10 @@
rwildcard = $(foreach d, $(wildcard $1*), $(filter $(subst *, %, $2), $d) $(call rwildcard, $d/, $2))
SUBFOLDERS := fusee-primary fusee-secondary
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
TOPTARGETS := all clean
include $(DEVKITARM)/base_tools
$(TOPTARGETS): $(SUBFOLDERS)
dir_source := src
dir_out := out
dir_exosphere := ../exosphere
dir_loader := fusee-secondary
dir_stage1 := fusee-primary
$(SUBFOLDERS):
$(MAKE) -C $@ $(MAKECMDGOALS)
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
ASFLAGS := -g $(ARCH)
# For debug builds, replace -O2 by -Og and comment -fomit-frame-pointer out
CFLAGS = \
$(ARCH) \
-g \
-O2 \
-fomit-frame-pointer \
-ffunction-sections \
-fdata-sections \
-std=gnu11 \
-Werror \
-Wall
LDFLAGS = -specs=linker.specs -g $(ARCH)
.PHONY: all
all: $(dir_out)
.PHONY: clean
clean:
@$(MAKE) -C $(dir_exosphere) clean
@$(MAKE) -C $(dir_loader) clean
@$(MAKE) -C $(dir_stage1) clean
@rm -rf $(dir_out)
.PHONY: $(dir_exosphere) $(dir_loader) $(dir_stage1)
$(dir_out): $(dir_loader) $(dir_stage1)
@mkdir -p "$(dir_out)"
@$(MAKE) -C $(dir_exosphere)
$(dir_exosphere)/out/exosphere.bin: $(dir_exosphere)
@$(MAKE) -C $<
$(dir_loader):
@mkdir -p "$(dir_out)"
@$(MAKE) -C $(dir_loader)
@cp "$(dir_loader)/out/$(dir_loader).bin" "out/$(dir_loader).bin"
$(dir_stage1):
@mkdir -p "$(dir_out)"
@$(MAKE) -C $(dir_stage1)
@cp "$(dir_stage1)/out/$(dir_stage1).bin" "out/$(dir_stage1).bin"
.PHONY: $(TOPTARGETS) $(SUBFOLDERS)

13
stratosphere/Makefile Normal file
View file

@ -0,0 +1,13 @@
KIPS := boot boot2 loader pm sm
SUBFOLDERS := libstratosphere $(KIPS)
TOPTARGETS := all clean
$(TOPTARGETS): $(SUBFOLDERS)
$(SUBFOLDERS):
$(MAKE) -C $@ $(MAKECMDGOALS)
$(KIPS): libstratosphere
.PHONY: $(TOPTARGETS) $(SUBFOLDERS)