Make repeat mode/shuffle work in the sbs also
[maemo-rb.git] / rbutil / mkmpioboot / Makefile
blob5e138b6f12d22617222c91e6d8feb51df21ea522
2 #change for releases
3 ifndef APPVERSION
4 APPVERSION=`../../tools/version.sh ../../`
5 endif
7 # We use the UCL code available in the Rockbox tools/ directory
8 CFLAGS=-I../../tools/ucl/include -Wall -DVERSION=\"$(APPVERSION)\"
10 ifndef V
11 SILENT = @
12 endif
14 ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
15 OUTPUT=mkmpioboot.exe
16 CFLAGS+=-mno-cygwin
17 else
18 ifeq ($(findstring MINGW,$(shell uname)),MINGW)
19 OUTPUT=mkmpioboot.exe
20 else
21 ifeq ($(findstring mingw,$(CC)),mingw)
22 OUTPUT=mkmpioboot.exe
23 else
24 OUTPUT=mkmpioboot
25 endif
26 endif
27 endif
29 ifdef RBARCH
30 CFLAGS += -arch $(RBARCH)
31 OBJDIR = $(TARGET_DIR)build/$(RBARCH)/
32 else
33 OBJDIR = $(TARGET_DIR)build/
34 endif
37 all: $(OUTPUT)
39 # inputs
40 LIBSOURCES := mkmpioboot.c
41 SOURCES := $(LIBSOURCES) main.c
42 OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(SOURCES)))
43 LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(LIBSOURCES)))
44 EXTRADEPS := $(LIBUCL)
46 # explicit dependencies
47 $(OBJDIR)mkmpioboot.o: mkmpioboot.c mkmpioboot.h
48 $(OBJDIR)main.o: main.c
50 $(OBJDIR)%.o: %.c
51 @echo CC $< $
52 $(SILENT)mkdir -p $(dir $@)
53 $(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
55 libmkmpioboot$(RBARCH).a: $(LIBOBJS)
56 @echo AR $@
57 $(SILENT)$(AR) rucs $(TARGET_DIR)$@ $^
59 # building the standalone executable
60 $(OUTPUT): $(OBJS) $(EXTRADEPS)
61 @echo LD $@
62 $(SILENT)$(CC) $(CFLAGS) -o $(OUTPUT) $(OBJS) $(EXTRADEPS)
64 # some trickery to build ppc and i386 from a single call
65 ifeq ($(RBARCH),)
66 $(TARGET_DIR)libmkmpiobooti386.a:
67 make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) libmkmpiobooti386.a
69 $(TARGET_DIR)libmkmpiobootppc.a:
70 make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libmkmpiobootppc.a
71 endif
73 libmkmpioboot-universal: $(TARGET_DIR)libmkmpiobooti386.a $(TARGET_DIR)libmkmpiobootppc.a
74 @echo lipo $(TARGET_DIR)libmkmpioboot.a
75 $(SILENT) rm -f $(TARGET_DIR)libmkmpioboot.a
76 $(SILENT)lipo -create $(TARGET_DIR)libmkmpiobootppc.a $(TARGET_DIR)libmkmpiobooti386.a -output $(TARGET_DIR)libmkmpioboot.a
78 clean:
79 rm -f $(OBJS) $(OUTPUT) $(TARGET_DIR)libmkmpioboot*.a mkmpioboot.dmg
80 rm -rf mkmpioboot-* i386 ppc $(OBJDIR)
82 mkmpioboot-i386:
83 $(MAKE) RBARCH=i386
84 mv mkmpioboot mkmpioboot-i386
86 mkmpioboot-ppc:
87 $(MAKE) RBARCH=ppc
88 mv mkmpioboot mkmpioboot-ppc
90 mkmpioboot-mac: mkmpioboot-i386 mkmpioboot-ppc
91 $(SILENT)lipo -create mkmpioboot-ppc mkmpioboot-i386 -output mkmpioboot-mac
93 mkmpioboot.dmg: mkmpioboot-mac
94 mkdir -p mkmpioboot-dmg
95 cp -p mkmpioboot-mac mkmpioboot-dmg
96 hdiutil create -srcfolder mkmpioboot-dmg mkmpioboot.dmg