summaryrefslogtreecommitdiff
path: root/rbutil/Makefile
blob: fe3b5b74a1d8db509c13906ba72d5c4706242324 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#             __________               __   ___.
#   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
#   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
#   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
#   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
#                     \/            \/     \/    \/            \/
# $Id$
#

# Unix-style Makefile for rbutil

#detect cygwin 
ifneq ($(strip $(shell gcc -v 2>&1 | grep "cygwin")),)
   __CYGWIN__ := 1
endif

CXX=$(shell $(PREFIX)wx-config --version=2.8 --cxx)
INC = `$(PREFIX)wx-config --version=2.8 --cxxflags`
LIBS = `$(PREFIX)wx-config --version=2.8 --libs`
CFLAGS= -Wall -Wundef -DRBUTIL -D_LARGEFILE64_SOURCE
OBJS=rbutil.o rbutilApp.o rbutilFrm.o rbutilCtrls.o install_dialogs.o bootloaders.o installlog.o ipodpatcher/ipodpatcher.o sansapatcher/sansapatcher.o irivertools.o md5sum.o autodetection.o talkfile.o

ifdef __CYGWIN__
OBJS+=ipodpatcher/ipodio-win32.o sansapatcher/sansaio-win32.o
CFLAGS+= -mno-cygwin -mwindows
else
OBJS+=ipodpatcher/ipodio-posix.o sansapatcher/sansaio-posix.o
endif


EXTRAOBJS = $(wildcard icons/*.o)

SILENT = @

# Install with / as root by default
ifndef DESTDIR
  DESTDIR=""
endif

# type "make WIN=1" for a Windows build using the Debian mingw cross-compiler
ifdef WIN
  CROSS=i586-mingw32msvc-
  WINDRES=i586-mingw32msvc-windres
  EXT=.exe
  PREFIX=/usr/i586-mingw32msvc/bin/
  OBJS+=rbutil-rc.o
endif

.PHONY: all
all: icons rbutil$(EXT)

.cpp.o :
	$(SILENT) echo CXX $<
	$(SILENT) $(CXX) $(CFLAGS) $(INC) -c -o $@ $<

.c.o :
	$(SILENT) echo CC $<
	$(SILENT) $(CC) $(CFLAGS) $(INC) -c -o $@ $<

rbutil-rc.o: rbutil-rc.rc
	$(WINDRES) -O coff -F pe-i386 -o $@ $<

rbutil$(EXT): $(OBJS)
	$(SILENT) echo CXX $<
	$(SILENT) $(CXX) -o $@ $(OBJS) $(EXTRAOBJS) $(LIBS)

.PHONY: icons
icons:
	$(SILENT) $(MAKE) -C icons

.PHONY: clean
clean:
	rm -f rbutil rbutil.exe $(OBJS) *~
	make -C icons clean

.PHONY: install
install:
	install -D rbutil$(EXT) $(DESTDIR)/usr/bin/rbutil$(EXT)