Fix for ff/rw in long MP3 files.
[kugel-rb.git] / apps / win32.mak
blob86ad2b067c8b2bc7f8380b8727133616f2ee1e9b
1 # __________ __ ___.
2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 # \/ \/ \/ \/ \/
7 # $Id$
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
24 CC = sh-elf-gcc
25 LD = sh-elf-ld
26 AR = sh-elf-ar
27 AS = sh-elf-as
28 OC = sh-elf-objcopy
30 LANGUAGE = english
32 FIRMWARE := ../firmware
33 TOOLS := ../tools
34 DOCSDIR := ../docs
36 INCLUDES= -I$(FIRMWARE)/include -I$(FIRMWARE)/export -I.
38 # Pick a target to build for
39 TARGET=-DARCHOS_RECORDER=1
40 ifdef RECORDER
41 TARGET=-DARCHOS_RECORDER=1
42 else
43 ifdef PLAYER
44 TARGET=-DARCHOS_PLAYER=1
45 else
46 ifdef PLAYER_OLD
47 TARGET=-DARCHOS_PLAYER_OLD=1
48 endif
49 endif
50 endif
52 # store output files in this directory:
53 OBJDIR = .
54 DEFINES = -DAPPSVERSION=\"CVS\"
56 ifdef DISABLE_GAMES
57 DEFINES += -DDISABLE_GAMES
58 endif
60 ifdef PROPFONTS
61 DEFINES += -DLCD_PROPFONTS
62 endif
64 CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(DEFINES)
65 AFLAGS += -small -relax
67 ifdef DEBUG
68 DEFINES += -DDEBUG
69 CFLAGS += -g
70 LDS := $(FIRMWARE)/gdb.lds
71 else
72 LDS := $(FIRMWARE)/app.lds
73 endif
75 SRC := $(wildcard *.c)
77 ifeq ($(TARGET),-DARCHOS_RECORDER=1)
78 SRC += $(wildcard recorder/*.c)
79 CFLAGS += -Irecorder
80 OUTNAME = ajbrec.ajz
81 else
82 SRC += $(wildcard player/*.c)
83 CFLAGS += -Iplayer
84 OUTNAME = archos.mod
85 endif
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 $@
112 $(OBJDIR)/%.o: %.c
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 $@
122 dist:
123 tar czvf dist.tar.gz Makefile main.c start.s app.lds
125 clean:
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
132 DEPS:=.deps
133 DEPDIRS:=$(DEPS) $(DEPS)/recorder
135 -include $(SRC:%.c=$(OBJDIR)/$(DEPS)/%.d)