2018-08-13 08:58:24 +00:00
|
|
|
ifeq ($(strip $(DEVKITARM)),)
|
|
|
|
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
|
|
endif
|
|
|
|
|
|
|
|
include $(DEVKITARM)/base_rules
|
|
|
|
|
|
|
|
TARGET := module_sample
|
|
|
|
BUILD := ../../build/$(TARGET)
|
|
|
|
OUTPUT := ../../output
|
2020-06-14 13:45:45 +00:00
|
|
|
SOURCEDIR = simple_sample
|
|
|
|
BDKDIR := bdk
|
|
|
|
BDKINC := -I../../$(BDKDIR)
|
2020-03-03 23:34:35 +00:00
|
|
|
VPATH = $(dir ./) $(dir $(wildcard ./*/))
|
2018-08-13 08:58:24 +00:00
|
|
|
|
|
|
|
OBJS = $(addprefix $(BUILD)/,\
|
|
|
|
module_sample.o \
|
2018-08-21 01:14:31 +00:00
|
|
|
gfx.o \
|
2018-08-13 08:58:24 +00:00
|
|
|
)
|
|
|
|
|
2020-06-14 13:45:45 +00:00
|
|
|
GFX_INC := '"../modules/$(SOURCEDIR)/gfx/gfx.h"'
|
|
|
|
|
|
|
|
CUSTOMDEFINES := -DGFX_INC=$(GFX_INC)
|
|
|
|
|
2018-08-21 01:14:31 +00:00
|
|
|
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb-interwork
|
2020-06-13 15:40:09 +00:00
|
|
|
CFLAGS = $(ARCH) -O2 -nostdlib -fpie -ffunction-sections -fdata-sections -fomit-frame-pointer -std=gnu11 -Wall $(CUSTOMDEFINES)
|
2018-08-21 01:14:31 +00:00
|
|
|
LDFLAGS = $(ARCH) -fpie -pie -nostartfiles -lgcc
|
2018-08-13 08:58:24 +00:00
|
|
|
|
|
|
|
.PHONY: clean all
|
|
|
|
|
|
|
|
all: $(TARGET).bso
|
|
|
|
$(BUILD)/%.o: ./%.c
|
|
|
|
@mkdir -p "$(BUILD)"
|
2020-06-14 13:45:45 +00:00
|
|
|
@$(CC) $(CFLAGS) $(BDKINC) -c $< -o $@
|
2019-10-18 15:02:06 +00:00
|
|
|
|
2018-08-13 08:58:24 +00:00
|
|
|
$(TARGET).bso: $(OBJS)
|
2020-06-13 15:39:17 +00:00
|
|
|
@$(CC) $(LDFLAGS) -e _modInit $^ -o $(OUTPUT)/$(TARGET).bso
|
2018-08-21 01:14:31 +00:00
|
|
|
$(STRIP) -g $(OUTPUT)/$(TARGET).bso
|
2018-08-13 08:58:24 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
@rm -rf $(OUTPUT)/$(TARGET).bso
|