2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 # Win32 GNUSH makefile by Felix Arends
13 # USAGE OF THIS MAKEFILE
15 # call this makefile from commandline: make -f win32.mak
17 # to create a recorder target: make -f win32.mak RECORDER=1
18 # to cerate a recorder target with propfonts: make -f win32.mak RECORDER=1 PROPFONTS=1
19 # to create a recorder target without games: make -f win32.mak RECORDER=1 DISABLE_GAMES=1
20 # to create a player target: make -f win32.mak PLAYER=1
21 # to create an old player target: make -f win32.mak PLAYER_OLD=1
32 FIRMWARE
:= ..
/firmware
36 INCLUDES
= -I
$(FIRMWARE
)/include -I
$(FIRMWARE
)/export -I.
38 # Pick a target to build for
39 TARGET
=-DARCHOS_RECORDER
=1
41 TARGET
=-DARCHOS_RECORDER
=1
44 TARGET
=-DARCHOS_PLAYER
=1
47 TARGET
=-DARCHOS_PLAYER_OLD
=1
52 # store output files in this directory:
54 DEFINES
= -DAPPSVERSION
=\"CVS
\"
57 DEFINES
+= -DDISABLE_GAMES
61 DEFINES
+= -DLCD_PROPFONTS
64 CFLAGS
= -O
-W
-Wall
-m1
-nostdlib
-ffreestanding
-Wstrict-prototypes
-fomit-frame-pointer
-fschedule-insns
$(INCLUDES
) $(DEFINES
)
65 AFLAGS
+= -small
-relax
70 LDS
:= $(FIRMWARE
)/gdb.lds
72 LDS
:= $(FIRMWARE
)/app.lds
75 SRC
:= $(wildcard *.c
)
77 ifeq ($(TARGET
),-DARCHOS_RECORDER
=1)
78 SRC
+= $(wildcard recorder
/*.c
)
82 SRC
+= $(wildcard player
/*.c
)
87 OBJS
:= $(OBJDIR
)/lang.o
$(SRC
:%.c
=$(OBJDIR
)/%.o
)
89 all : $(OBJDIR
)/$(OUTNAME
)
91 $(OBJDIR
)/librockbox.a
:
92 make
-C
$(FIRMWARE
) -f win32.mak TARGET
=$(TARGET
) DEBUG
=$(DEBUG
) OBJDIR
=$(OBJDIR
) PLAYER
=$(PLAYER
) PLAYER_OLD
=$(PLAYER_OLD
)
94 $(OBJDIR
)/archos.elf
: $(OBJS
) $(LDS
) $(OBJDIR
)/librockbox.a
95 $(CC
) -Os
-nostdlib
-o
$(OBJDIR
)/archos.elf
$(OBJS
) -L
$(OBJDIR
) -lrockbox
-lgcc
-L
$(FIRMWARE
) -T
$(LDS
) -Wl
,-Map
,$(OBJDIR
)/archos.map
97 $(OBJDIR
)/archos.bin
: $(OBJDIR
)/archos.elf
98 $(OC
) -O binary
$(OBJDIR
)/archos.elf
$(OBJDIR
)/archos.bin
100 $(OBJDIR
)/archos.asm
: $(OBJDIR
)/archos.bin
101 ..
/tools
/sh2d
-sh1
$(OBJDIR
)/archos.bin
> $(OBJDIR
)/archos.asm
103 $(OBJDIR
)/$(OUTNAME
) : $(OBJDIR
)/archos.bin
104 $(TOOLS
)/scramble
$(OBJDIR
)/archos.bin
$(OBJDIR
)/$(OUTNAME
)
106 $(OBJDIR
)/credits.raw
: $(DOCSDIR
)/CREDITS
107 perl credits.pl
< $< > $(OBJDIR
)/$@
109 $(OBJDIR
)/credits.o
: $(OBJDIR
)/credits.c
$(OBJDIR
)/credits.h
$(OBJDIR
)/credits.raw
110 $(CC
) $(CFLAGS
) -c
$< -o
$@
113 $(CC
) $(CFLAGS
) $(TARGET
) -c
$< -o
$@
115 $(OBJDIR
)/build.lang
: lang
/$(LANGUAGE
).lang
116 perl ..
/tools
/uplang lang
/english.lang
$< > $@
118 $(OBJDIR
)/lang.o
: $(OBJDIR
)/build.lang
119 perl
-s ..
/tools
/genlang
-p
=$(OBJDIR
)/lang
$<
120 $(CC
) $(CFLAGS
) -c
$(OBJDIR
)/lang.c
-o
$@
123 tar czvf
dist.
tar.gz Makefile main.c start.s app.lds
126 -rm -f
$(OBJS
) $(OBJDIR
)/$(OUTNAME
) $(OBJDIR
)/archos.asm \
127 $(OBJDIR
)/archos.bin
$(OBJDIR
)/archos.elf
$(OBJDIR
)/archos.map \
128 $(OBJDIR
)/build.lang
$(OBJDIR
)/lang.c
$(OBJDIR
)/lang.h \
129 $(OBJDIR
)/credits.raw
130 make
-C
$(FIRMWARE
) -f win32.mak TARGET
=$(TARGET
) DEBUG
=$(DEBUG
) OBJDIR
=$(OBJDIR
) clean
133 DEPDIRS
:=$(DEPS
) $(DEPS
)/recorder
135 -include $(SRC
:%.c
=$(OBJDIR
)/$(DEPS
)/%.d
)