summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/libndsfpc/examples/audio/maxmod/song_events_example/Makefile.fpc
blob: 8838c21291d590fc3cf4596531dd1cc980906b6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#
#   Makefile.fpc for Free Pascal libndsfpc 2.x.y Examples
#

[target]
loaders=mmsolution.bin
programs=song_events_example

[require]
packages=libndsfpc
tools=bin2s mmutil grit rmdir
nortl=y

[install]
fpcpackage=y

[default]
cpu=arm
target=nds
fpcdir=../../../../../..

[compiler]
options=-g -Xm
#-d__THUMB__

[clean]
files=*.elf *.o *.s *.nds *.nef *.h *.bin *.map \
       $(BUILD)/* \
       $(INC)/*
units=*

[prerules]
BUILD = build
INC = inc
AUDIO_FILES = $(foreach dir, $(notdir $(wildcard music/*.*)), $(CURDIR)/music/$(dir))
GFX_FILES = $(foreach dir,gfx,$(notdir $(wildcard $(dir)/*.png)))
BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))

[rules]
.NOTPARALLEL:
clean: dir_delete fpc_clean fpc_cleanall
all: dir_make $(BIN_FILES) $(GFX_FILES) fpc_all

#
# Delete temp directories
#
dir_delete:
        @$(DELTREE) $(CURDIR)/$(BUILD)
        @$(DELTREE) $(CURDIR)/$(INC)

#
# Create temp directories
#
dir_make:
ifneq ($(BUILD), $(CURDIR))
        @$(MKDIR) $(BUILD)
endif
ifneq ($(INC), $(CURDIR))
        @$(MKDIR) $(INC)
endif

#
# Audio files processing rule
#
mmsolution.bin.o : $(AUDIO_FILES)
        @$(MMUTIL) $^ -d -o$(BUILD)/mmsolution.bin -h$(BUILD)/mmsolution.h
        $(BIN2S) $(BUILD)/mmsolution.bin > $(BUILD)/mmsolution.bin.s
        $(AS) -o $(BUILD)/mmsolution.bin.o $(BUILD)/mmsolution.bin.s

#
# Png files processing rule
#
$(GFX_FILES): $(wildcard %.png)
        @echo 'Converting $(@) file to asm...'
        $(GRIT) gfx/$(@) -fts -ff gfx/$(basename $(@)).grit -o$(BUILD)/$(@)
        @echo 'Assembling $(@).s file...'
        $(AS) -o $(BUILD)/$(basename $(@)).o $(BUILD)/$(basename $(@)).s
        @echo 'Done!'