PageRenderTime 18ms CodeModel.GetById 13ms app.highlight 4ms RepoModel.GetById 0ms app.codeStats 0ms

/packages/libndsfpc/examples/graphics/3D/nehe/lesson02/Makefile.fpc

https://github.com/slibre/freepascal
Unknown | 93 lines | 80 code | 13 blank | 0 comment | 0 complexity | 4edb8bbf5703f4904078825b06ede500 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
 1#
 2#   Makefile.fpc for Free Pascal libndsfpc 2.x.y Examples
 3#
 4
 5[target]
 6loaders= 
 7programs=lesson02
 8
 9[require]
10packages=libndsfpc
11tools=bin2s mmutil grit rmdir
12nortl=y
13
14[install]
15fpcpackage=y
16
17[default]
18cpu=arm
19target=nds
20fpcdir=../../../../../../..
21
22[compiler]
23options=-g -Xm  
24#-d__THUMB__
25
26[clean]
27files=*.elf *.o *.s *.nds *.nef *.h *.bin *.map \
28       $(BUILD)/* \
29       $(INC)/*
30units=*
31
32[prerules]
33BUILD = build
34INC = inc
35AUDIO_FILES = $(foreach dir, $(notdir $(wildcard audio/*.*)), $(CURDIR)/audio/$(dir))
36GFX_FILES = $(foreach dir,gfx,$(notdir $(wildcard $(dir)/*.png)))
37BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
38
39[rules]
40.NOTPARALLEL:
41clean: dir_delete fpc_clean fpc_cleanall
42all: dir_make $(BIN_FILES) $(GFX_FILES) fpc_all 
43
44#
45# Delete temp directories
46#
47dir_delete:
48        @$(DELTREE) $(CURDIR)/$(BUILD) 
49        @$(DELTREE) $(CURDIR)/$(INC) 
50        
51#
52# Create temp directories
53#
54dir_make:
55ifneq ($(BUILD), $(CURDIR))
56        @$(MKDIR) $(BUILD)
57endif
58ifneq ($(INC), $(CURDIR))
59        @$(MKDIR) $(INC)
60endif
61
62#
63# Audio files processing rule
64#
65soundbank.bin.o : $(AUDIO_FILES)
66        @$(MMUTIL) $^ -d -o$(BUILD)/soundbank.bin -h$(BUILD)/soundbank.h
67        $(BIN2S) $(BUILD)/soundbank.bin > $(BUILD)/soundbank.bin.s
68        $(AS) -o $(BUILD)/soundbank.bin.o $(BUILD)/soundbank.bin.s
69
70#
71# Png files processing rule
72#
73$(GFX_FILES): $(wildcard %.png) 
74        @echo 'Converting $(@) file to asm...'
75        $(GRIT) gfx/$(@) -fts -ff gfx/$(basename $(@)).grit -o$(BUILD)/$(@)
76        @echo 'Assembling $(@).s file...'
77        $(AS) -o $(BUILD)/$(basename $(@)).o $(BUILD)/$(basename $(@)).s
78        @echo 'Done!'
79
80#
81# Binary files processing rule
82# 
83$(BIN_FILES): $(wildcard %.*)
84        @echo 'Converting $(@) file to asm...'
85        @$(BIN2S) data/$(@) > $(BUILD)/$(@).s
86        @echo 'Creating $(@).inc include file...'
87        @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
88        @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
89        @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
90        @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
91        @echo 'Assembling $(@).s file...'
92        @$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
93        @echo 'Done!'