# Makefile for Draw (32-bit, ARM32, RISC OS 5) and nothing else.
#
#   make -j2 CROSS_TARGET=arm-none-eabi BUILD=build/arm32 app32-drawapp
#
# Written for this zip; the full tree's Makefile builds the ROM, the 64-bit
# modules and every application, and is not included. BUILDING.txt says more.

include mk/toolchain.mk

BUILD ?= build
$(eval $(call check-build-target,$(BUILD)))
ARCH_MACHINE ?= $(ARCH_iomd)

CLIB := $(BUILD)/lib/libclib.a
DESKTOP_LIB := $(BUILD)/lib/libdesktop.a
# Kept empty: the ROM's resource block is not built here, but the module.mk
# files name it as a prerequisite and append to MOD_DESKTOP_RES.
MOD_KRES_BLOCK :=
MOD_DESKTOP_RES :=

# -fno-jump-tables is required: a switch lowered to a table of addresses
# needs load-time relocation, which a ROM module cannot have.
MOD_CFLAGS := --target=arm-none-eabi -ffreestanding -fno-builtin \
              -fpie -fvisibility=hidden -fno-jump-tables \
              -fno-stack-protector -fno-common -mno-unaligned-access \
              $(ARCH_MACHINE) -Os -g -std=gnu17 \
              -fno-unwind-tables -fno-asynchronous-unwind-tables \
              -Wall -Wextra -Wno-unused-parameter -MMD -MP \
              -Iinclude -I$(BUILD)/include -ISources/Kernel/hdr

include mk/clib32.mk
include mk/desktop32.mk
include mk/apps32.mk
include Sources/Apps/Draw/module.mk
include mk/app32.mk

clean:
	rm -rf $(BUILD)
.PHONY: clean
