2009-10-28 21:11:43 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
2009-10-29 21:31:50 +00:00
|
|
|
|
|
|
|
# We use the Telechips code available in the Rockbox tools/ directory
|
2009-10-28 21:11:43 +00:00
|
|
|
TOOLSDIR=../../tools
|
|
|
|
CFLAGS := -O -g -W -Wall -Wshadow -pedantic -I$(TOOLSDIR)
|
|
|
|
|
2009-10-29 21:31:50 +00:00
|
|
|
ifndef V
|
|
|
|
SILENT = @
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
2009-10-30 14:27:16 +00:00
|
|
|
OUTPUT=mktccboot.exe
|
2009-10-29 21:31:50 +00:00
|
|
|
CFLAGS+=-mno-cygwin
|
|
|
|
else
|
|
|
|
ifeq ($(findstring MINGW,$(shell uname)),MINGW)
|
2009-10-30 14:27:16 +00:00
|
|
|
OUTPUT=mktccboot.exe
|
2009-10-29 21:31:50 +00:00
|
|
|
else
|
|
|
|
ifeq ($(findstring mingw,$(CC)),mingw)
|
2009-10-30 14:27:16 +00:00
|
|
|
OUTPUT=mktccboot.exe
|
2009-10-29 21:31:50 +00:00
|
|
|
else
|
2009-10-30 14:27:16 +00:00
|
|
|
OUTPUT=mktccboot
|
2009-10-29 21:31:50 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef RBARCH
|
|
|
|
CFLAGS += -arch $(RBARCH)
|
|
|
|
endif
|
|
|
|
|
2011-09-26 20:51:23 +00:00
|
|
|
TARGET_DIR ?= $(shell pwd)/
|
|
|
|
OBJDIR = $(TARGET_DIR)build$(RBARCH)
|
2009-10-29 21:31:50 +00:00
|
|
|
|
|
|
|
all: $(OUTPUT)
|
|
|
|
|
2009-11-04 21:56:40 +00:00
|
|
|
# inputs
|
|
|
|
LIBSOURCES := mktccboot.c $(TOOLSDIR)/telechips.o
|
|
|
|
SOURCES := $(LIBSOURCES) main.c
|
2011-09-26 20:51:23 +00:00
|
|
|
OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR)/,$(notdir $(SOURCES))))
|
|
|
|
LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR)/,$(notdir $(LIBSOURCES))))
|
2009-11-04 21:56:40 +00:00
|
|
|
EXTRADEPS :=
|
|
|
|
|
|
|
|
# rule for sources from tools dir
|
2011-09-26 20:51:23 +00:00
|
|
|
$(OBJDIR)/%.o: $(TOOLSDIR)/%.c
|
2009-10-30 21:04:07 +00:00
|
|
|
@echo CC $<
|
2011-09-26 20:51:23 +00:00
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
2009-11-04 21:56:40 +00:00
|
|
|
$(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
|
2009-10-28 21:11:43 +00:00
|
|
|
|
2011-09-26 20:51:23 +00:00
|
|
|
$(OBJDIR)/%.o: %.c
|
2009-10-29 21:31:50 +00:00
|
|
|
@echo CC $<
|
2011-09-26 20:51:23 +00:00
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
2009-11-04 21:56:40 +00:00
|
|
|
$(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
|
2009-10-29 21:31:50 +00:00
|
|
|
|
2011-09-26 20:51:23 +00:00
|
|
|
libmktccboot$(RBARCH).a: $(TARGET_DIR)libmktccboot$(RBARCH).a
|
|
|
|
|
|
|
|
$(TARGET_DIR)libmktccboot$(RBARCH).a: $(LIBOBJS)
|
|
|
|
@echo AR $(notdir $@)
|
|
|
|
$(SILENT)$(AR) rucs $@ $^
|
2009-11-04 21:56:40 +00:00
|
|
|
|
|
|
|
# building the standalone executable
|
|
|
|
$(OUTPUT): $(OBJS) $(EXTRADEPS)
|
|
|
|
@echo LD $@
|
|
|
|
$(SILENT)$(CC) $(CFLAGS) -o$(OUTPUT) $(OBJS) $(EXTRADEPS)
|
2009-10-29 21:31:50 +00:00
|
|
|
|
|
|
|
# some trickery to build ppc and i386 from a single call
|
|
|
|
ifeq ($(RBARCH),)
|
2009-11-28 22:39:00 +00:00
|
|
|
$(TARGET_DIR)libmktccbooti386.a:
|
2009-10-30 14:27:16 +00:00
|
|
|
make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) libmktccbooti386.a
|
2009-10-29 21:31:50 +00:00
|
|
|
|
2009-11-28 22:39:00 +00:00
|
|
|
$(TARGET_DIR)libmktccbootppc.a:
|
2009-10-30 14:27:16 +00:00
|
|
|
make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libmktccbootppc.a
|
2011-09-26 20:51:23 +00:00
|
|
|
endif
|
|
|
|
|
2009-11-28 22:39:00 +00:00
|
|
|
libmktccboot-universal: $(TARGET_DIR)libmktccbooti386.a $(TARGET_DIR)libmktccbootppc.a
|
2009-10-30 14:27:16 +00:00
|
|
|
@echo lipo $(TARGET_DIR)libmktccboot.a
|
|
|
|
$(SILENT) rm -f $(TARGET_DIR)libmktccboot.a
|
2009-12-13 21:30:28 +00:00
|
|
|
$(SILENT)lipo -create $(TARGET_DIR)libmktccbootppc.a $(TARGET_DIR)libmktccbooti386.a -output $(TARGET_DIR)libmktccboot.a
|
2011-09-26 20:51:23 +00:00
|
|
|
|
2009-10-28 21:11:43 +00:00
|
|
|
clean:
|
2009-11-04 21:56:40 +00:00
|
|
|
rm -f $(OUTPUT) $(TARGET_DIR)libmktccboot*.a mktccboot.dmg
|
2011-09-26 20:51:23 +00:00
|
|
|
rm -rf $(OBJDIR)
|
2009-10-29 21:31:50 +00:00
|
|
|
|
2009-10-30 14:27:16 +00:00
|
|
|
mktccboot-i386:
|
2009-10-29 21:31:50 +00:00
|
|
|
$(MAKE) RBARCH=i386
|
2009-10-30 14:27:16 +00:00
|
|
|
mv mktccboot mktccboot-i386
|
2009-10-29 21:31:50 +00:00
|
|
|
|
2009-10-30 14:27:16 +00:00
|
|
|
mktccboot-ppc:
|
2009-10-29 21:31:50 +00:00
|
|
|
make RBARCH=ppc
|
2009-10-30 14:27:16 +00:00
|
|
|
mv mktccboot mktccboot-ppc
|
2009-10-29 21:31:50 +00:00
|
|
|
|
2009-10-30 14:27:16 +00:00
|
|
|
mktccboot-mac: mktccboot-i386 mktccboot-ppc
|
2009-12-13 21:30:28 +00:00
|
|
|
$(SILENT)lipo -create mktccboot-ppc mktccboot-i386 -output mktccboot-mac
|
2009-10-29 21:31:50 +00:00
|
|
|
|
2009-10-30 14:27:16 +00:00
|
|
|
mktccboot.dmg: mktccboot-mac
|
|
|
|
mkdir -p mktccboot-dmg
|
|
|
|
cp -p mktccboot-mac mktccboot-dmg
|
|
|
|
hdiutil create -srcfolder mktccboot-dmg mktccboot.dmg
|
2011-09-26 20:51:23 +00:00
|
|
|
|
2009-10-30 14:27:16 +00:00
|
|
|
|